public bool targetAliveFlag; //This is set to true when we get a target. Then, if it's true and we have no target, it becomes false. protected void Awake() { _parentBaseAI = GetComponent <BaseAI>(); _chassis = GetComponent <ShipChassis>(); rotationSpeed = _chassis.rotateSpeed / 150; //Magic number of 150... this gives us pretty good approximation of player-controlled rotation _rb2d = GetComponent <Rigidbody2D>(); engageSpeed = Mathf.Pow(_chassis.maximumSpeed, 2) * engageMod; //InvokeRepeating("PeriodicUpdate", 0, periodicUpdateFrequency); }
public float validJumpDistance = 50f; //How far from system center to be able to do a hyperspace jump void Awake() { playerObject = GameObject.FindWithTag("PlayerObject"); playerShip = playerObject.transform.GetChild(0).gameObject; shipState = playerShip.GetComponent <ShipStateBehaviour>(); _cameraBehaviour = Camera.main.GetComponent <CameraBehaviour>(); if (playerShip.GetComponent <ShipChassis>()) { shipChassis = playerShip.GetComponent <ShipChassis>(); playerShip.GetComponent <ShipData>()._guiManager = GameObject.FindGameObjectWithTag("GameController").GetComponent <GUIManager>(); //Debug.Log("Got player chassis"); } else { Debug.Log("No chassis found."); } }