summaryrefslogtreecommitdiff
path: root/Assets/Scripts/Physics/PhysicsPrimitive.cs
blob: 0d285fd35ea7c7af565ec0bf62b878467601c78a (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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

/// <summary>
/// 物理碰撞体基类
/// 只需要Box和Ball两种
/// </summary>
public abstract class PhysicsPrimitive : MonoBehaviour
{
    [SerializeField]
    /// <summary>
    /// 这个primitive是否参与物理计算,用来快速给物体取消和恢复重力影响
    /// </summary>
    protected bool m_IsActive;
    public bool IsActive
    {
        get
        {
            return m_IsActive;
        }
    }

    /// <summary>
    /// 这个primitive所属的物体
    /// </summary>
    protected Transform m_Parent;
    public Transform Parent
    {
        get
        {
            return m_Parent;
        }
    }

    /// <summary>
    /// 唯一ID
    /// </summary>
    protected int m_ID;
    public int ID
    {
        get
        {
            return m_ID;
        }
    }

    [SerializeField]
    protected PhysicsGroup m_Group; 
    public PhysicsGroup Group
    {
        get
        {
            return m_Group;
        }
    }

    [SerializeField]
    protected PhysicsTag m_Tag; 
    public PhysicsTag Tag
    {
        get
        {
            return m_Tag;
        }
    }


    [SerializeField]
    protected string m_Title;
    public string Title
    {
        get
        {
            return m_Title;
        }
    }

    [SerializeField]
    protected string m_Desc;
    public string Desc
    {
        get
        {
            return m_Desc;
        }
    }

    /// <summary>
    /// 初始化,设置一些公共数据
    /// </summary>
    protected void OnInit()
    {
        m_ID = UIDManager.Acquire();
        m_Parent = transform;
    }

    protected Color Color_Green = new Color(0,1, 0, 0.5f);

    [SerializeField]
    protected Color m_HintColor = new Color(0, 0, 0, 0.5f);
}