Exemple #1
0
        private void ChaseTarget(ShipStateController controller)
        {
            ShipMotor shipMotor = controller.GetMotor();
            Rigidbody ship      = controller.GetRigidbody();
            Rigidbody target    = controller.GetTarget();

            if (target == null)
            {
                return;
            }

            Steer(shipMotor, ship, target);

            AdjustThrottle();

            Vector3 toTarget = target.position - ship.position;

            float angle = Vector3.Angle(ship.transform.forward, toTarget);



            Vector3 velocityDifference = ship.velocity - target.velocity;

            //Check throttle
            //Check angle from player
            //Check velocity differences
            //Adjust throttle

            //steer based on stats/throttle
        }
Exemple #2
0
        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());
            }
        }