Пример #1
0
        private void FixedUpdate()
        {
            if (!HaveTargetTank())
            {
                return;
            }

            m_NavMeshAgent.speed        = m_TankControls.Speed;
            m_NavMeshAgent.angularSpeed = m_TankControls.TankRotationSpeed;

            m_NavMeshAgent.destination = TargetTank.transform.position;

            UpdateRotationTargets();
            m_TankControls.RotateTankTowards(m_TankRotationToNavDestination);
            m_TankControls.RotateTurretTowards(m_TurretRotationToTargetTank);
            m_TankControls.RotateBarrelTowards(m_BarrelRotationToTargetTank);

            if (TankShouldMove())
            {
                m_TankControls.MoveTank();
            }

            if (TankShouldFire())
            {
                m_TankControls.Fire();
            }
        }