public void ControllerInput(int input)
    {
        if (input == 1)
        {
            Debug.Log(input);
            debounceCount++;
            if (debounceCount == 2)
            {
                debounceCount = 0;
                canPress = false;
                currTime = 0;
                Debug.LogWarning("canPress:" + canPress);
                Debug.LogWarning("red button " + debounceCount);
                // check if a player tank is available
                if (!playerTank)
                {
                    playerTank = moveTank.Instance();
                }
                // fire the bullet if it is
                if (playerTank && playerTank.activeTurret)
                {
                    playerTank.FireTurret();
                }
                // press virtual buttons as well
                crosshair.VirtualButtonPress();
            }
        }
        if (input == 2)
        {
            Debug.Log("green button");
            //transform.position += Vector3.right * 100;
        }

             
    }
예제 #2
0
 public static moveTank Instance()
 {
     if (instance != null)
         return instance;
     lock (instance_lock)
     {
         instance = (moveTank)FindObjectOfType(typeof(moveTank));
         if (FindObjectsOfType(typeof(moveTank)).Length > 1)
         {
             Debug.LogError("There can only be one instance!");
             return instance;
         }
         if (instance != null)
             return instance;
         Debug.LogError("Could not find a instance!");
         return null;
     }
 }