public override System.Type Tick()
        {
            if (proximity.target != null)
            {
                behavior.previousState = typeof(ShipFiringState);

                if (proximity.target == targeting.target)
                {
                    Debug.Log("Turn to Circling");
                    return(typeof(ShipCirclingState));
                }
                Debug.Log("Turn to Evading");
                return(typeof(ShipEvadingState));
            }

            if (!behavior.targeting.targetLocked)
            {
                Debug.Log("Turn to Tracking");
                return(typeof(ShipTrackingState));
            }

            if (behavior.targeting.target == null)
            {
                Debug.Log("Turn to Standby");
                return(typeof(ShipStandbyState));
            }

            movement.trackTarget(targeting.target);
            movement.move();
            primaryweapon.fire();
            return(null);
        }
Esempio n. 2
0
        void Update()
        {
            if (Input.GetButton("Primary Weapon"))
            {
                primaryWeapon?.fire();
            }

            if (Input.GetButton("Secondary Weapon"))
            {
                secondaryWeapon?.fire();
            }

            if (Input.GetButton("Flare"))
            {
                flare?.fire();
            }

            if (Input.GetButton("Special"))
            {
                special?.fire();
            }

            if (Input.GetButton("Utility"))
            {
                utility?.fire();
            }

            if (Input.GetButton("Link Weapons"))
            {
                linked = !linked;
            }
        }
        public override System.Type Tick()
        {
            if (!targeting.targetLocked)
            {
                Debug.Log("Turn to Tracking");
                return(typeof(TurretTrackingState));
            }
            if (targeting.target == null)
            {
                Debug.Log("Turn to Standby");
                return(typeof(TurretStandbyState));
            }



            movement.trackTarget(targeting.target);
            weapon.fire();
            return(null);
        }