void Fire(ShipStateController controller) { float timeInState = controller.GetTimeInCurrentState(); if (timeInState > attackDelay) { Rigidbody shipRigidbody = controller.GetRigidbody(); Ray forward = new Ray(shipRigidbody.position, shipRigidbody.transform.forward); controller.GetWeaponSystem().Fire(forward, controller.GetTarget()); } }
public override bool Decide(StateController controller) { ShipStateController shipController = controller as ShipStateController; //False if we haven't been in the current state long enough if (shipController.GetTimeInCurrentState() < stateDelay) { return(false); } Rigidbody target = controller.GetTarget(); if (target == null) { return(false); } return(ValidatePosition(shipController, target)); }