gather-and-defend/Assets/Scripts/Drag&Drop/TilePlacementButton.cs
Felix Boucher b54627196c population mechanic with art
- added art for house and UI
- put population in ResourceManager
- create house prefab
- added code for adding and removing pop depending on entity
- refactor harvesters so they inherit from ally
- modify placeholders and buttons so that only units cost population
- add events for population and resources changing
- add population relative configs to global config
- add start resources values to Levels
- add debug feature for generating resources for free
2023-10-29 19:12:32 -04:00

28 lines
814 B
C#

using Codice.CM.Client.Differences;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class TilePlacementButton : UnitPlacementButton
{
public LevelTile tile;
protected override bool CanPlace()
{
return ResourceManager.Instance.EnoughFor(_rock, _wood, _food, 0) && _button.enabled && _canSpawn;
}
protected override DraggablePlaceholder Place()
{
var instance = new GameObject(tile.name);
var placeholder = instance.AddComponent<TilePlaceholder>();
placeholder.Tile = tile;
var rend = instance.AddComponent<SpriteRenderer>();
rend.sprite = tile.Sprite;
rend.sortingLayerName = "Character";
rend.material = _outlineMaterial;
rend.sortingOrder = 2;
return placeholder;
}
}