|
@@ -98,6 +98,7 @@ public class Character : MonoBehaviour
|
|
|
|
|
|
|
|
[Header("角色状态")]
|
|
[Header("角色状态")]
|
|
|
public bool canFly = false;
|
|
public bool canFly = false;
|
|
|
|
|
+ public bool canControlFly = false;
|
|
|
[HideInInspector] public bool nowCanFly; //当前是否能飞行
|
|
[HideInInspector] public bool nowCanFly; //当前是否能飞行
|
|
|
[LabelText("不会被击落,用于让不可飞行怪可以被击落")] public bool canNotShotDown = true;
|
|
[LabelText("不会被击落,用于让不可飞行怪可以被击落")] public bool canNotShotDown = true;
|
|
|
[LabelText("不会被击飞")] public bool canNotAddForce;
|
|
[LabelText("不会被击飞")] public bool canNotAddForce;
|
|
@@ -160,11 +161,16 @@ public class Character : MonoBehaviour
|
|
|
//血量重置
|
|
//血量重置
|
|
|
hp = totalHp;
|
|
hp = totalHp;
|
|
|
nowCanFly = canFly;
|
|
nowCanFly = canFly;
|
|
|
- if (canFly)
|
|
|
|
|
|
|
+ if (canFly && !canControlFly)
|
|
|
{
|
|
{
|
|
|
rb.useGravity = false;
|
|
rb.useGravity = false;
|
|
|
rb.constraints = RigidbodyConstraints.FreezeRotation | RigidbodyConstraints.FreezePositionY | RigidbodyConstraints.FreezePositionZ;
|
|
rb.constraints = RigidbodyConstraints.FreezeRotation | RigidbodyConstraints.FreezePositionY | RigidbodyConstraints.FreezePositionZ;
|
|
|
}
|
|
}
|
|
|
|
|
+ else if (canFly && canControlFly)
|
|
|
|
|
+ {
|
|
|
|
|
+ rb.useGravity = false;
|
|
|
|
|
+ rb.constraints = RigidbodyConstraints.FreezeRotation | RigidbodyConstraints.FreezePositionZ;
|
|
|
|
|
+ }
|
|
|
uiHp.Show(hp, totalHp);
|
|
uiHp.Show(hp, totalHp);
|
|
|
ChangeState(CharacterState.Idle);
|
|
ChangeState(CharacterState.Idle);
|
|
|
|
|
|
|
@@ -305,6 +311,10 @@ public class Character : MonoBehaviour
|
|
|
|
|
|
|
|
public void ChangeStateText(CharacterState state)
|
|
public void ChangeStateText(CharacterState state)
|
|
|
{
|
|
{
|
|
|
|
|
+ if (!statePre)
|
|
|
|
|
+ {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
GameObject obj = PoolManager.Instantiate(statePre);
|
|
GameObject obj = PoolManager.Instantiate(statePre);
|
|
|
stateText = obj.GetComponentInChildren<TextMeshProUGUI>();
|
|
stateText = obj.GetComponentInChildren<TextMeshProUGUI>();
|
|
|
obj.transform.position = transform.position + Vector3.up;
|
|
obj.transform.position = transform.position + Vector3.up;
|