diff options
author | chai <chaifix@163.com> | 2022-03-10 14:07:40 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2022-03-10 14:07:40 +0800 |
commit | 22891bf59032ba88262824255a706d652031384b (patch) | |
tree | 7595439ba9966c9402d37e37cee5e8cf098757d5 /Assets/Scripts/Physics/PhysicsBody.cs | |
parent | 8b04ea73e540067f83870b61d89db4868fea5e8a (diff) |
* move folder
Diffstat (limited to 'Assets/Scripts/Physics/PhysicsBody.cs')
-rw-r--r-- | Assets/Scripts/Physics/PhysicsBody.cs | 167 |
1 files changed, 0 insertions, 167 deletions
diff --git a/Assets/Scripts/Physics/PhysicsBody.cs b/Assets/Scripts/Physics/PhysicsBody.cs deleted file mode 100644 index 80026962..00000000 --- a/Assets/Scripts/Physics/PhysicsBody.cs +++ /dev/null @@ -1,167 +0,0 @@ -using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-
-// 需要受物理系统托管的动作:
-// 跳跃上升
-// 跳跃下降
-// 空中受击
-//
-//
-// 不会受物理系统托管的动作:
-// 单个招式
-// 空中连击
-//
-//
-// 一般来说启用物理是被动的
-
-/// <summary>
-/// 刚体
-/// </summary>
-public sealed class PhysicsBody : MonoBehaviour
-{
-
- // 是否朝向右侧(正向)
- public bool IsFaceRight
- {
- get
- {
- float rotY = Quaternion.ToEulerAngles(transform.rotation).y;
- rotY = Mathf.Rad2Deg * rotY;
- bool right = rotY >= 0 && rotY <= 180;
- return right;
- }
- }
-
- // 全局速度,以世界为参考系
- [SerializeField]
- public Vector3 Velocity
- {
- get
- {
- Vector3 vel = m_LocalVelocity;
- if (!IsFaceRight)
- vel.x = -vel.x;
- return vel;
- }
- set
- {
- if (IsFaceRight)
- m_LocalVelocity = value;
- else
- m_LocalVelocity = new Vector3(-value.x, value.y, value.z);
- }
- }
-
- // 以自身为参考系的速度,x>0向前,x<0向后,y>0向上,y<0向下。默认情况下以右为正方向
- // 设置速度应该以local velocity为准
- [SerializeField]
- private Vector3 m_LocalVelocity;
-
- public Vector3 LocalVelocity
- {
- get
- {
- return m_LocalVelocity;
- }
- set
- {
- m_LocalVelocity = value;
- }
- }
-
- [SerializeField]
- private float m_Weight;
- public float Weight
- {
- get
- {
- return m_Weight;
- }
- }
-
- [Tooltip("ignore gravity?")]
- [SerializeField]
- private bool m_UseGravity;
- public bool UseGravity
- {
- get
- {
- return m_UseGravity;
- }
- set
- {
- m_UseGravity = value;
- }
- }
-
- [SerializeField]
- private Vector3 m_Accelaration;
- public Vector3 Accelaration
- {
- get
- {
- return m_Accelaration;
- }
- }
-
- [Tooltip("地面摩擦系数")]
- [SerializeField]
- private float m_Frication;
- public float GroundFriction
- {
- get { return m_Frication; }
- }
-
- [Tooltip("空气摩擦力")]
- [SerializeField]
- private float m_AirFriction;
- public float AirFriction
- {
- get { return m_AirFriction; }
- }
-
- [Tooltip("力")]
- [SerializeField]
- private Vector3 m_Force;
- public Vector3 Force
- {
- get
- {
- return m_Force;
- }
- }
-
- [SerializeField]
- private PhysicsPrimitive m_Primitive;
-
-
- public void AddForce(Vector3 force)
- {
- m_Force += force;
- }
-
- public void AddLocalForce(Vector3 localForce)
- {
- m_Force += localToWorldDir(localForce);
- }
-
- public void SetForce(Vector3 force)
- {
- m_Force = force;
- }
-
- public void SetLocalForce(Vector3 localForce)
- {
- m_Force = localToWorldDir(localForce);
- }
-
- public Vector3 localToWorldDir(Vector3 local)
- {
- if (IsFaceRight)
- return local;
- else
- return new Vector3(-local.x, local.y, local.z);
- }
-
-}
|