from unity import *
from flightgroup import FlightGroup

import Objective

# import json

# js = json.loads('["foo", {"bar":["baz", null, 1.0, 2]}]')

# Debug.Log(json.dumps(js))
# Debug.Log(", ".join(sys.path))
# Debug.Log(", ".join(dir(sys)))

# palentisGo = GameObject("Palentis System")
# palentis = palentisGo.AddComponent("Venue")
# palentisGo.transform.position = Vector3(0, 0, 50000)

arthixGo = GameObject("Arthix System")
arthix = arthixGo.AddComponent("Venue")
# arthixGo.transform.position = Vector3(50000, 0, 0)

fg = GameObject("fg 1")
fg.transform.position = Vector3(500, 10, 100)
fg1 = fg.AddComponent("FlightGroup")

fg1.shipType = Resources.Load("Hawk")
# fg1.shipType = Resources.Load("Assault Corvette")
fg1.playerController = Resources.Load("Player")
fg1.craftController = Resources.Load("AI Pilot")
fg1.groupName = "Archer"
fg1.totalCraft = 12
fg1.waveSize = 4
fg1.originationVenue = arthix
fg1.faction = Resources.Load("Ruuvian")
fg1.indigenous = True

arthix.flightGroups.Add(fg1)

fga = FlightGroup("Gamma", "Goose", 30, 4, "Fesande")
fga.go.transform.position = Vector3(400, 10, 1900)
fga.fg.originationVenue = arthix
fga.fg.initialDelay = 30
# fga.fg.indigenous = True

arthix.flightGroups.Add(fga.fg)
# ComponentUtil.setLayerRecursively(caelus, LayerMask.NameToLayer("Distant"))
#caelus.layer = LayerMask.NameToLayer("Distant")

fgb = GameObject("fg 3")
fg3 = fgb.AddComponent("FlightGroup")

fg3.shipType = Resources.Load("Raptor")
fgb.transform.position = Vector3(-600, 10, -400)
# fg3.playerController = Resources.Load("Player")
fg3.craftController = Resources.Load("AI Pilot")
fg3.groupName = "Lancer"
fg3.totalCraft = 12
fg3.waveSize = 4
fg3.originationVenue = arthix
fg3.faction = Resources.Load("Ruuvian")
fg3.initialDelay = 20
# fg3.indigenous = True

arthix.flightGroups.Add(fg3)

fgc = GameObject("fg 4")
fg4 = fgc.AddComponent("FlightGroup")

fg4.shipType = Resources.Load("Medium Transport")
fgc.transform.position = Vector3(600, 10, -1300)
# fg4.playerController = Resources.Load("Player")
fg4.craftController = Resources.Load("AI Pilot")
fg4.groupName = "Star Tours"
fg4.totalCraft = 6
fg4.waveSize = 3
fg4.originationVenue = arthix
fg4.faction = Resources.Load("Fesande")
#fg4.initialDelay = 15
fg4.indigenous = True

arthix.flightGroups.Add(fg4)

obj = Objective()
obj.percent = 1.0
obj.flightGroup = fg4
obj.state = obj.FlightGroupState.DESTROYED

fg1.objectives.Add(obj)

obj2 = Objective()
obj2.percent = 0.5
obj2.flightGroup = fga.fg
obj2.state = obj.FlightGroupState.DESTROYED

fg1.objectives.Add(obj2)

ff = FlightGroup("Resilient", "Assault Corvette", 2, 1, "Fesande")
ff.go.transform.position = Vector3(600, 0, -1000)
ff.fg.originationVenue = arthix
ff.fg.initialDelay = 60



