movement and dialogue system

This commit is contained in:
Sylvia 2026-07-25 02:23:50 -07:00
parent 977e666577
commit 1590b5faa6
123 changed files with 62825 additions and 355 deletions

View 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);
}
}

View file

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: c45670385a48a3b59bed49dfec987a32

View file

@ -0,0 +1,5 @@
using UnityEngine;
public class Enemy : CombatEntity
{
}

View file

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: f58572e837a31d71b911561d242ca9a5

View 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;
}
}
}

View file

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: c6adc30fe056ad940a67442392bffb78

View file

@ -0,0 +1,6 @@
using UnityEngine;
public class NPC : Entity
{
}

View file

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 508d8a9251397eec7bc574ba38c482c9

View 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);
}
}

View file

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 49c22a60b2d3a5d0bbd4c02c922abfe8