Add project files.
This commit is contained in:
8
Assets/Scripts/Combat/CombatTarget.cs
Normal file
8
Assets/Scripts/Combat/CombatTarget.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
using UnityEngine;
|
||||
using RPG.Combat;
|
||||
|
||||
public class CombatTarget : MonoBehaviour
|
||||
{
|
||||
// This class is intentionally left empty.
|
||||
// It serves as a marker to identify combat targets in the game.
|
||||
}
|
||||
2
Assets/Scripts/Combat/CombatTarget.cs.meta
Normal file
2
Assets/Scripts/Combat/CombatTarget.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b8654c3b7c55a404fbedd3d1b66415f2
|
||||
22
Assets/Scripts/Combat/Fighter.cs
Normal file
22
Assets/Scripts/Combat/Fighter.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using UnityEngine;
|
||||
using RPG.Movement;
|
||||
|
||||
namespace RPG.Combat
|
||||
{
|
||||
public class Fighter : MonoBehaviour
|
||||
{
|
||||
Transform target;
|
||||
private void Update()
|
||||
{
|
||||
if(target != null)
|
||||
{
|
||||
GetComponent<Mover>().MoveTo(target.position);
|
||||
target = null;
|
||||
}
|
||||
}
|
||||
public void Attack(CombatTarget combatTarget)
|
||||
{
|
||||
target = combatTarget.transform;
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/Combat/Fighter.cs.meta
Normal file
2
Assets/Scripts/Combat/Fighter.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0dac85c6432a11746b07d2f6a021e2e4
|
||||
Reference in New Issue
Block a user