-
Notifications
You must be signed in to change notification settings - Fork 0
/
Game_Character.cs
85 lines (74 loc) · 1.54 KB
/
Game_Character.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Game_Character : MonoBehaviour
{
[SerializeField]
protected float _move_speed;
[SerializeField]
protected float _hp = 10, attack_rate = 1, attack_window = 0;
[SerializeField]
protected float _defense, _damage, force, _attack_range;
[SerializeField]
protected Rigidbody2D ai_rigidbody;
protected SpriteRenderer _sprtrenderer;
protected virtual void Awake()
{
_sprtrenderer = GetComponent<SpriteRenderer>();
}
// Start is called before the first frame update
protected virtual void Start()
{
ai_rigidbody = gameObject.GetComponent<Rigidbody2D>();
}
// Update is called once per frame
protected virtual void Update()
{
if (_hp <= 0)
{
die();
}
}
protected virtual void FixedUpdate()
{
move();
}
public float Get_Hp()
{
return _hp;
}
public float Get_Damage()
{
return _damage;
}
public float Get_Force()
{
return force;
}
public float Get_Speed()
{
return _move_speed;
}
public void set_hp(float hp)
{
_hp = hp;
}
public void set_damage(float hp)
{
_damage = hp;
}
public void set_force(float hp)
{
force = hp;
}
public void set_speed(float hp)
{
_move_speed = hp;
}
protected virtual void move()
{
}
protected virtual void die()
{
}
}