예제 #1
0
    public void AttemptToPlace()
    {
        if (!GameManager.instance.TryTakeMoney(attemptingToPlace.cost))
        {
            CleanCursor();
            return;
        }

        Placeable placeable = onCursor.GetComponent <Placeable>();
        TeamEnum  team      = GameManager.instance.currentTeam;

        if (placeable.GetType() == typeof(Building))
        {
            Building building = (Building)placeable;
            building.Place(team);
        }
        else
        {
            placeable.Place(team);
        }



        SetShader("Standard", onCursor.transform.GetChild(0).gameObject);
        attemptingToPlace = null;
    }
예제 #2
0
 public void SetPlaceableOnCursor(string name)
 {
     attemptingToPlace = Array.Find(buildingMenu, mapping => mapping.buildingName == name);
     onCursor          = Instantiate(attemptingToPlace.buildingPrefab);
     SetShader(highlightShader, onCursor.transform.GetChild(0).gameObject);
 }
예제 #3
0
 void CleanCursor()
 {
     Destroy(onCursor);
     attemptingToPlace = null;
 }