blob: f208bf8710d6c899f23df9d8b558508ef5a54b05 (
plain) (
blame)
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
|
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;
namespace DamageVolumeSystem
{
[RequireComponent(typeof(Rigidbody))]
public class DamageHost : MonoBehaviour
{
// 组
[HideInInspector] public int group;
// 伤害生成器列表
[HideInInspector] public List<DamageGenerator> generators = new();
// 当伤害接收时
public UnityEvent<Damage> onDamageReceived;
// 刚体
private Rigidbody _rigidbody;
private void Start()
{
_rigidbody = GetComponent<Rigidbody>();
}
}
public struct Damage
{
// 伤害产生的组
public int Group;
// 伤害强度
public int Force;
// 伤害方向
public Vector3 Direction;
}
}
|