Пример #1
0
        //  Unity Methods ---------------------------------

        protected void Update()
        {
            // Hold Mouse To Move Target
            if (Input.GetMouseButton((int)_configurationData.MouseButtonToAim))
            {
                const float offset = 0.1f;
                RaycastHit  hit;
                Ray         ray = _camera.ScreenPointToRay(Input.mousePosition);

                if (Physics.Raycast(ray, out hit))
                {
                    _target.transform.position = hit.point - (ray.direction * offset);
                }
            }

            // Aim At Target
            _tank.AimAtTarget(_target);

            // Shoot At Target
            if (Input.GetMouseButtonDown((int)_configurationData.MouseButtonToFire))
            {
                _tank.ShootAtTarget(_target);
            }
        }