コード例 #1
0
        public void Rotate(float rotationInput)
        {
            float input = Mathf.Abs(rotationInput);
            ObjectSelfDirection direction = ObjectSelfDirection.RIGHT;

            if (rotationInput < 0.1f)
            {
                direction = ObjectSelfDirection.LEFT;
            }

            rotationCtrl.Rotate(direction, input);
        }
コード例 #2
0
            //Every block has OnTriggerEnter method, which triggers on player,
            //We want to wait for physics to work, disable blocks and rotate player 90 degrees. Repeat with all gate "prefabs" we have
            IEnumerator ExcludeBlocksFromGates()
            {
                for (int i = 0; i < _gates.Count; i++)
                {
                    _gates[i].gameObject.SetActive(true);
                    yield return(new WaitForFixedUpdate());

                    _gates[i].BlocksArePrepared();
                    _gates[i].gameObject.SetActive(false);
                    _player.Rotate(-90);
                }
                CreateObjectPoolsForGates();
            }
コード例 #3
0
    void Update()
    {
        // Stop if we aren't the local player
        // We don't want to move all the tanks
        if (!isLocalPlayer)
        {
            return;
        }

        // Read the input
        hMotion  = (sbyte)Input.GetAxisRaw("Horizontal");
        vMotion  = (sbyte)Input.GetAxisRaw("Vertical");
        mousePos = Input.mousePosition;

        // Pass it to the controllers
        tankCtrl.Move(hMotion, vMotion);
        turretCtrl.Rotate(mousePos);
        if (Input.GetAxis("Fire1") > 0)
        {
            weaponCtrl.Shoot();
        }
    }
コード例 #4
0
 void Update()
 {
     rotator.Rotate();
     ManageShooting();
 }
コード例 #5
0
 public void Rotate(Vector3 amount)
 {
     rotatable.Rotate(amount);
 }
コード例 #6
0
        public static async Task ApplyAndAddRotation(IRotation rotation, ICollection<IRotation> rotations, IRotatable configuration)
        {
            if (rotation == null) return;

            rotations.Add(rotation);

            var cubeRotation = rotation as CubeRotation;
            var faceRotation = rotation as FaceRotation;
            if (cubeRotation != null)
            {
                await configuration.RotateCube(cubeRotation).ConfigureAwait(false);
            }
            if (faceRotation != null)
            {
                await configuration.Rotate(faceRotation).ConfigureAwait(false);
            }
        }