コード例 #1
0
ファイル: Player.cs プロジェクト: vladpochobut/UnityGames
 void Move()
 {
     isItMove = false;
     if (Input.GetKeyDown(KeyCode.W) && !pushTimer.Running && !isTop)
     {
         HUD.AddDistance();
         distance++;
         isItMove = true;
         pushTimer.Run();
         player.transform.DORotateQuaternion(Quaternion.AngleAxis(-90, Vector3.up), ConfigurationData.ROTATE_DURATION);
         player.transform.DOJump(new Vector3(transform.position.x + 1, transform.position.y, transform.position.z),
                                 ConfigurationData.JUMP_POWER,
                                 ConfigurationData.NUM_JUMPS,
                                 ConfigurationData.JUMP_DURATION, false);
     }
     if (Input.GetKeyDown(KeyCode.A) && !pushTimer.Running && !isLeft)
     {
         isItMove = true;
         pushTimer.Run();
         player.transform.DORotateQuaternion(Quaternion.AngleAxis(-180, Vector3.up), ConfigurationData.ROTATE_DURATION);
         player.transform.DOJump(new Vector3(transform.position.x, transform.position.y, transform.position.z + 1),
                                 ConfigurationData.JUMP_POWER,
                                 ConfigurationData.NUM_JUMPS,
                                 ConfigurationData.JUMP_DURATION, false);
     }
     if (Input.GetKeyDown(KeyCode.D) && !pushTimer.Running && !isRigth)
     {
         isItMove = true;
         pushTimer.Run();
         player.transform.DORotateQuaternion(Quaternion.AngleAxis(0, Vector3.up), ConfigurationData.ROTATE_DURATION);
         player.transform.DOJump(new Vector3(transform.position.x, transform.position.y, transform.position.z - 1),
                                 ConfigurationData.JUMP_POWER,
                                 ConfigurationData.NUM_JUMPS,
                                 ConfigurationData.JUMP_DURATION, false);
     }
 }