- 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
19 lines
733 B
C#
19 lines
733 B
C#
using UnityEngine;
|
|
|
|
public class ObjectPlaceholder : DraggablePlaceholder
|
|
{
|
|
public GameObject Prefab { get; set; }
|
|
public override void Place()
|
|
{
|
|
Prefab.Create(transform.position, parent : LevelManager.Instance.LevelTransform);
|
|
}
|
|
public override bool CanBePlacedHere()
|
|
{
|
|
var objsOnPosition = LevelManager.Instance.GetAll<ILevelObject>(obj => obj.Position.IsContainedIn(transform.position));
|
|
var positionIsCollidable = objsOnPosition.Exists(obj => obj.IsCollidable);
|
|
|
|
return !positionIsCollidable
|
|
&& _lvlBoundsCache.Contains(transform.position)
|
|
&& ResourceManager.Instance.EnoughFor(Rock, Wood, Food, Prefab.GetComponent<Building>() ? 0 : 1);
|
|
}
|
|
} |