logic was supposed to allow placing object on farms, which it didn't now it does. + changed ObjectPlaceholder's name so it follows the TilePlaceholder's convention
18 lines
640 B
C#
18 lines
640 B
C#
using UnityEngine;
|
|
|
|
public class ObjectPlaceholder : DraggablePlaceholder
|
|
{
|
|
public GameObject Prefab { get; set; }
|
|
public override void Place()
|
|
{
|
|
Prefab.Create(transform.position);
|
|
}
|
|
public override bool CanBePlacedHere()
|
|
{
|
|
var objsOnPosition = LevelManager.Instance.GetAll<ILevelObject>(obj => obj.Position.IsContainedIn(transform.position));
|
|
var positionContainsFarm = objsOnPosition.Exists(obj => obj.Name.ToLower().Contains("farm"));
|
|
|
|
//either no object, or object is farm
|
|
return objsOnPosition.Count == 0 || (objsOnPosition.Count == 1 && positionContainsFarm);
|
|
}
|
|
} |