Пример #1
0
 public void RegisterBuildBalloon()
 {
     Debug.Log("Register build balloon and selected tile is " + selectedTile);
     if (actionPointsThisTurn - apToBuildBalloon < 0)
     {
         Debug.Log("Not enough AP");
         return;
     }
     if (selectedTile.PlaceObjectOnThisTile(balloonPrefab, tc.GetActivePlayer()) == false)
     {
         // Don't do the stuff
     }
     else
     {
         PlayerController p       = tc.GetActivePlayer();
         List <GameTile>  newLand = selectedTile.CalculateOwnership(p);
         p.AddLandToList(newLand);
         if (p.GetName() == "First")
         {
             selectedTile.transform.GetChild(0).GetComponent <SpriteRenderer>().color = Color.red;
         }
         else
         {
             selectedTile.transform.GetChild(0).GetComponent <SpriteRenderer>().color = Color.blue;
         }
         SubtractAP(apToBuildBalloon);
         am.Play("placeSFX");
     }
 }
Пример #2
0
    /// <summary>
    /// Checks if the position is valid for a bridge and places it.
    /// Returns true if it succeeded.
    /// </summary>
    /// <param name="pos"></param>
    public bool PlaceBridgeAtPosition(Vector3 pos)
    {
        // Debug.Log("Register build bridge");
        if (CheckValidBridgePosition(pos) == false)
        {
            return(false);
        }
        else
        {
            // Debug.Log("Valid bridge position check succeeded");
            GameObject newBridge = (GameObject)Instantiate(bridgePrefab);
            newBridge.transform.position = pos;
            newBridge.transform.SetParent(this.transform);

            PlayerController p = turnController.GetActivePlayer();
            newBridge.GetComponent <GameTile>().CalculateOwnership(p);

            return(true);
        }
    }