52 lines
1.2 KiB
C#
52 lines
1.2 KiB
C#
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class PlayerEntity : Entity
|
|
{
|
|
public bool hasMoved = false;
|
|
public bool hasAttacked = false;
|
|
private List<TileObject> moveableTiles = new();
|
|
[SerializeField] private Weapon[] weapons;
|
|
private List<Weapon> weaponInstances = new();
|
|
public Weapon currentWeapon;
|
|
void Start()
|
|
{
|
|
foreach (Weapon weapon in weapons)
|
|
{
|
|
Weapon newWeapon = Instantiate(weapon, transform);
|
|
newWeapon.thisEntity = this;
|
|
newWeapon.tag = tag;
|
|
weaponInstances.Add(newWeapon);
|
|
}
|
|
currentWeapon = weaponInstances[0];
|
|
}
|
|
|
|
// Update is called once per frame
|
|
void Update()
|
|
{
|
|
|
|
}
|
|
|
|
public void SkipTurn()
|
|
{
|
|
hasMoved = true;
|
|
hasAttacked = true;
|
|
TurnHandler.instance.UpdateTurns();
|
|
}
|
|
public void Attack()
|
|
{
|
|
currentWeapon.TryAttack();
|
|
}
|
|
|
|
public void SwitchWeapon()
|
|
{
|
|
|
|
}
|
|
private void OnMouseDown()
|
|
{
|
|
if ((!hasMoved) && !PlayerEntityMovement.instance.isMoving)
|
|
{
|
|
ActionUIHandler.instance.ShowUI(this);
|
|
}
|
|
}
|
|
}
|