mirror of
http://47.107.252.169:3000/Roguelite-Game-Developing-Team/Gen_Hack-and-Slash-Roguelite.git
synced 2025-11-20 10:27:13 +08:00
Co-authored-by: m0_75251201 <m0_75251201@noreply.gitcode.com> Reviewed-on: http://47.107.252.169:3000/Roguelite-Game-Developing-Team/Gen_Hack-and-Slash-Roguelite/pulls/58
63 lines
1.6 KiB
C#
63 lines
1.6 KiB
C#
using Data;
|
|
using Managers;
|
|
using UnityEngine;
|
|
|
|
namespace Entity
|
|
{
|
|
public class Building : CombatantEntity
|
|
{
|
|
private BuildingOutline buildingOutline;
|
|
private BuildingDef buildingDef;
|
|
|
|
public override void Init(EntityDef entityDefine)
|
|
{
|
|
base.Init(entityDefine);
|
|
buildingDef = entityDefine as BuildingDef;
|
|
buildingOutline = entityPrefab.outline as BuildingOutline;
|
|
}
|
|
|
|
public override void SetTarget(Vector3 pos)
|
|
{
|
|
}
|
|
|
|
public override void TryMove()
|
|
{
|
|
}
|
|
|
|
protected override void UpdatePlayerControls()
|
|
{
|
|
if (Input.GetKeyDown(KeyCode.W))
|
|
{
|
|
transform.position += Vector3.up;
|
|
}
|
|
|
|
if (Input.GetKeyDown(KeyCode.A))
|
|
{
|
|
transform.position += Vector3.left;
|
|
}
|
|
|
|
if (Input.GetKeyDown(KeyCode.S))
|
|
{
|
|
transform.position += Vector3.down;
|
|
}
|
|
|
|
if (Input.GetKeyDown(KeyCode.D))
|
|
{
|
|
transform.position += Vector3.right;
|
|
}
|
|
}
|
|
|
|
public override void Tick()
|
|
{
|
|
base.Tick();
|
|
if (buildingDef.triggerEvents != null && buildingOutline.PlayerOnGround &&
|
|
Input.GetKeyDown(buildingDef.activateKey))
|
|
{
|
|
foreach (var eventDef in buildingDef.triggerEvents)
|
|
{
|
|
EventManager.Instance.Action(eventDef, this);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} |