movement and dialogue system
This commit is contained in:
parent
977e666577
commit
1590b5faa6
123 changed files with 62825 additions and 355 deletions
32
Assets/Scripts/Entity/CombatEntity.cs
Normal file
32
Assets/Scripts/Entity/CombatEntity.cs
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
using UnityEngine;
|
||||
|
||||
public class CombatEntity : Entity
|
||||
{
|
||||
[Header("Health")]
|
||||
public float maxHealth;
|
||||
public float health;
|
||||
public bool invulnerable;
|
||||
|
||||
public void TakeDamage(float damage)
|
||||
{
|
||||
if (!invulnerable)
|
||||
{
|
||||
health -= damage;
|
||||
if (health <= 0)
|
||||
{
|
||||
OnDeath();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void OnDeath()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void Heal(float healing)
|
||||
{
|
||||
health += healing;
|
||||
health = Mathf.Clamp(health, 0, maxHealth);
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/Entity/CombatEntity.cs.meta
Normal file
2
Assets/Scripts/Entity/CombatEntity.cs.meta
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
fileFormatVersion: 2
|
||||
guid: c45670385a48a3b59bed49dfec987a32
|
||||
5
Assets/Scripts/Entity/Enemy.cs
Normal file
5
Assets/Scripts/Entity/Enemy.cs
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
using UnityEngine;
|
||||
|
||||
public class Enemy : CombatEntity
|
||||
{
|
||||
}
|
||||
2
Assets/Scripts/Entity/Enemy.cs.meta
Normal file
2
Assets/Scripts/Entity/Enemy.cs.meta
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
fileFormatVersion: 2
|
||||
guid: f58572e837a31d71b911561d242ca9a5
|
||||
24
Assets/Scripts/Entity/Entity.cs
Normal file
24
Assets/Scripts/Entity/Entity.cs
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
public class Entity : MonoBehaviour
|
||||
{
|
||||
[Header("Movement")]
|
||||
public float speed;
|
||||
[SerializeField] protected Rigidbody2D rb;
|
||||
public Vector3 moveDirection;
|
||||
public bool noMovement;
|
||||
protected virtual void Movement()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void FixedUpdate()
|
||||
{
|
||||
if (!noMovement)
|
||||
{
|
||||
Movement();
|
||||
rb.linearVelocity = moveDirection * speed;
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/Entity/Entity.cs.meta
Normal file
2
Assets/Scripts/Entity/Entity.cs.meta
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
fileFormatVersion: 2
|
||||
guid: c6adc30fe056ad940a67442392bffb78
|
||||
6
Assets/Scripts/Entity/NPC.cs
Normal file
6
Assets/Scripts/Entity/NPC.cs
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
using UnityEngine;
|
||||
|
||||
public class NPC : Entity
|
||||
{
|
||||
|
||||
}
|
||||
2
Assets/Scripts/Entity/NPC.cs.meta
Normal file
2
Assets/Scripts/Entity/NPC.cs.meta
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 508d8a9251397eec7bc574ba38c482c9
|
||||
22
Assets/Scripts/Entity/Player.cs
Normal file
22
Assets/Scripts/Entity/Player.cs
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
using System;
|
||||
using UnityEngine;
|
||||
using UnityEngine.InputSystem;
|
||||
|
||||
public class Player : CombatEntity
|
||||
{
|
||||
//[Header("Input")]
|
||||
//private InputAction moveAction;
|
||||
|
||||
/*private void Start()
|
||||
{
|
||||
//moveAction = InputSystem.actions.FindAction("Move");
|
||||
}*/
|
||||
|
||||
protected override void Movement()
|
||||
{
|
||||
base.Movement();
|
||||
//Debug.Log(moveAction.actionMap);
|
||||
//moveDirection = moveAction.ReadValue<Vector2>();
|
||||
moveDirection = new Vector3(Input.GetAxis("Horizontal"), Input.GetAxis("Vertical"), 0);
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/Entity/Player.cs.meta
Normal file
2
Assets/Scripts/Entity/Player.cs.meta
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 49c22a60b2d3a5d0bbd4c02c922abfe8
|
||||
Loading…
Add table
Add a link
Reference in a new issue