Example #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();
            }
        }
Example #2
0
        private void FixedUpdate()
        {
            Quaternion tankRotation = m_TankControls.RotateTank(m_HorizontalInputValue);

            m_TankControls.RotateTurret(m_MouseXInputValue, tankRotation);
            m_TankControls.RotateBarrel(m_MouseYInputValue);
            m_TankControls.MoveTank(m_VerticalInputValue);

            UpdateFiringArc();
        }