summaryrefslogtreecommitdiff
path: root/Assets/Scripts/Avatar/Avatar.cs
blob: 47d8c4b74f00316b89aa9f08fcf4b2785aac062a (plain)
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
using System.Collections;
using System.Collections.Generic;
using UnityEngine;


/// <summary>
/// 角色,包括player和opponents
/// </summary>
public class Avatar : MonoBehaviour, IInteractable
{


    public PhysicsBody m_Body;
    public PhysicsBox m_BodyCollider;
    public PhysicsBox[] m_Hitbox;
    public PhysicsBox[] m_Hurtbox;

    public PhysicsPrimitive[] GetAllPrimitive()
    {
        throw new System.NotImplementedException();
    }

    public PhysicsBox GetHitbox()
    {
        throw new System.NotImplementedException();
    }

    public PhysicsBox GetHurtbox()
    {
        throw new System.NotImplementedException();
    }

    public PhysicsPrimitive[] GetAllHit()
    {
        throw new System.NotImplementedException();
    }

    public bool IsHit()
    {
        for (int i = 0; i < m_Hitbox.Length; ++i)
        {
            if (PhysicsWorld.Instance.HasCollision(m_Hitbox[i]))
            {
                return true;
            }
        }
        return false;
    }

    public bool IsHurt()
    {
        for (int i = 0; i < m_Hitbox.Length; ++i)
        {
            if (PhysicsWorld.Instance.HasCollision(m_Hurtbox[i]))
            {
                return true;
            }
        }
        return false;
    }

}