Пример #1
0
    public void ConstructionSelected(SpawnableType type, string id)
    {
        Vector3    loc = Vector3.zero;
        Quaternion rot = Quaternion.identity;

        if (player.GetSpawnLocationAndRotation(out loc, out rot))
        {
            if (gameObject.activeSelf)
            {
                player.ToggleConstructionMenu();
            }
            Spawnable tSpawn = gameManager.GetBlueprint(type, id);
            if (tSpawn.constructionEnergyRequired < player.playerEnergy.GetEnergy())
            {
                player.playerEnergy.SpendEnergy(tSpawn.constructionEnergyRequired);
                gameManager.SpawnSpawnable(type, id, loc, rot, player);
            }
            else
            {
                player.playerUI.DisplayAlertMessage("You don't have enough energy");
            }
        }
    }