Example #1
0
 public bool CheckMoneyForShip(int shiptype)
 {
     if (playerManager.CheckMoney(shipList.GetShipObject(shiptype).GetComponent <Ship>().cost) == true)
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
Example #2
0
    public void PlaceShip(Transform placeInRow)
    {
        //check if ship type selected avilable // default to raider

        //check for money
        if (CheckMoney(shipNumberSelected) == true)
        {
            //deduct money
            AddMoney(-shipNumberSelected);

            GameObject clone = Instantiate(shiplist.GetShipObject(shipNumberSelected), transform.position, placeInRow.transform.rotation);
            // clone.transform.parent = placeInRow;
            placeInRow.GetComponent <Rowspot>().myShip = clone.GetComponent <Ship>();
            clone.GetComponent <Ship>().myspot         = placeInRow.GetComponent <Rowspot>();
            clone.GetComponent <Ship>().shipManager    = shipManager;
            if (shipManager != null)
            {
                shipManager.AddShipToList(clone.GetComponent <Ship>());
            }
        }
        gameManager.shipPlacementControls.UpdateShipButtons(money);
        //spawn ship shipNumberSelected from ShipList
        //set new ship as child of placeInRow
    }