44 lines
1.0 KiB
C#
44 lines
1.0 KiB
C#
using AsteroidGame.Interfaces;
|
|
using UnityEngine;
|
|
using UnityEngine.Serialization;
|
|
|
|
namespace AsteroidGame.Entities.Structures.Scripts
|
|
{
|
|
public class StructureBase : EntityBase, IBuildable
|
|
{
|
|
[Header("BuildParameters")]
|
|
[SerializeField]
|
|
protected int cost;
|
|
|
|
[SerializeField] private bool buildPlacementBlocked;
|
|
[SerializeField] protected float buildTimer;
|
|
|
|
#region Private
|
|
|
|
|
|
#endregion
|
|
|
|
#region Publics
|
|
public bool BuildPlacementBlocked => buildPlacementBlocked;
|
|
public string Name { get; set; }
|
|
public int Cost { get; set; }
|
|
|
|
#endregion
|
|
|
|
private void OnTriggerStay(Collider other)
|
|
{
|
|
if(other.name == "BuildCollider")
|
|
{
|
|
buildPlacementBlocked = true;
|
|
}
|
|
}
|
|
|
|
private void OnTriggerExit(Collider other)
|
|
{
|
|
if(other.name == "BuildCollider")
|
|
{
|
|
buildPlacementBlocked = false;
|
|
}
|
|
}
|
|
}
|
|
} |