コード例 #1
0
ファイル: Player.cs プロジェクト: Gand92/Zero
 void Update()
 {
     //Modify this with a touch system
     if (Input.GetKeyDown(KeyCode.UpArrow))
     {
         ModifyRadius(1);
     }
     if (Input.GetKeyDown(KeyCode.DownArrow) && orbitNum != 1)
     {
         ModifyRadius(-1);
     }
     if (Input.GetKey(KeyCode.Space))
     {
         if (count == 0)
         {
             ModifySpeed(1);
             count += 1;
         }
         fuelHandler.ConsumeFuel(fuelSpeedConsumption * Time.deltaTime);
         if (fuelHandler.GetCurrentFuel() == 0 && count == 1)
         {
             ModifySpeed(-1);
             count -= 1;
         }
     }
     else
     {
         if (count == 1)
         {
             ModifySpeed(-1);
             count -= 1;
         }
         fuelHandler.RestoreFuel(fuelSpeedRecharge * Time.deltaTime); //We have another update in Turbo Handler with the same line, this one has to be removed on release on smartphone
     }
 }
コード例 #2
0
ファイル: TurboHandler.cs プロジェクト: Gand92/Zero
    void Update()
    {
        if (_pressed)
        {
            if (count == 0)
            {
                playerScript.ModifySpeed(1);
                count += 1;
            }
            fuelHandler.ConsumeFuel(fuelSpeedConsumption * Time.deltaTime);
            if (fuelHandler.GetCurrentFuel() == 0 && count == 1)
            {
                playerScript.ModifySpeed(-1);
                count -= 1;
            }
        }

        if (!_pressed)
        {
            if (count == 1)
            {
                playerScript.ModifySpeed(-1);
                count -= 1;
            }
            fuelHandler.RestoreFuel(fuelSpeedRecharge * Time.deltaTime); //We have another update in player with the same line, this is the only one needed on release on smartphone
        }
    }