Esempio n. 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();
            }
        }
Esempio n. 2
0
        void Update()
        {
            if (Time.timeScale == 0)
            {
                return;
            }

            m_VerticalInputValue   = Input.GetAxis("Vertical");
            m_HorizontalInputValue = Input.GetAxis("Horizontal");
            m_MouseYInputValue     = Input.GetAxis("Mouse Y");
            m_MouseXInputValue     = Input.GetAxis("Mouse X");

            if (Input.GetButtonDown("Fire1"))
            {
                m_TankControls.Fire();
            }
        }