Пример #1
0
    public BaseObject.Type BuildBuilding(BuyableBuilding typeToBuy)
    {
        switch (typeToBuy)
        {
        case BuyableBuilding.Sam:
            return(BaseObject.Type.Sam);

        case BuyableBuilding.Nuke:
            return(BaseObject.Type.NukeLauncher);

        case BuyableBuilding.Shield:
            return(BaseObject.Type.ShieldGenerator);
        }
        return(BaseObject.Type.Building);
    }
Пример #2
0
    public bool BuyBuilding(BuyableBuilding typeToBuy)
    {
        return(objManager.spawnManager.city.BuildNewBuilding(BuildBuilding(typeToBuy)));

        /*
         * if(objManager.spawnManager.city.availableSlots > 0)
         * {
         *  Debug.Log(objManager.spawnManager.city.availableSlots);
         *  SpawnManager.CitySlot slot = objManager.spawnManager.city.PopSlot();
         *
         *  if(slot.slotID != -1)
         *  {
         *      ((BO_Static)objManager.SpawnObjectFromPool(BuildBuilding(typeToBuy), slot.position)).AssignCitySlot(slot);
         *      return true;
         *  }
         *  else
         *  {
         *      Debug.LogError("Pop Returned an empty city slot... full? Count: " + objManager.spawnManager.city.availableSlots);
         *      return false;
         *  }
         *
         * }
         * else
         * {
         *  Building toReplace = objManager.GetRandomBuilding();
         *  if (toReplace == null)
         *      return false;
         *  else
         *  {
         *      if(toReplace.citySlot.slotID == -1)
         *      {
         *          Debug.LogError("??!?");
         *          return false;
         *      }
         *      else
         *      {
         *          SpawnManager.CitySlot slot = new SpawnManager.CitySlot(toReplace.citySlot.slotID, toReplace.citySlot.position);
         *          toReplace.ExternalDeath();
         *          //toReplace.gameObject.SetActive(false);
         *          ((BO_Static)objManager.SpawnObjectFromPool(BuildBuilding(typeToBuy), slot.position)).AssignCitySlot(slot);
         *          return true;
         *      }
         *  }
         * } */
    }