浏览代码

rename rb to m_Rigidbody

/main
Laurent 5 年前
当前提交
1f9bb4e6
共有 1 个文件被更改,包括 9 次插入12 次删除
  1. 21
      Runtime/LevelScripting/Actions/RigidbodyAction.cs

21
Runtime/LevelScripting/Actions/RigidbodyAction.cs


[ExecuteAlways]
public class RigidbodyAction : ActionBase
{
public Rigidbody rb;
public Rigidbody m_Rigidbody;
[OnValueChanged("OnParameterTypeChanged")]
public RigidbodyActionType actionType;

public override void Execute(GameObject instigator = null)
{
if (rb == null)
if (m_Rigidbody == null)
return;
switch (actionType)

{
rb.AddForce(direction, forceMode);
m_Rigidbody.AddForce(direction, forceMode);
rb.AddRelativeForce(direction, forceMode);
m_Rigidbody.AddRelativeForce(direction, forceMode);
rb.AddTorque(direction, forceMode);
m_Rigidbody.AddTorque(direction, forceMode);
rb.AddRelativeTorque(direction, forceMode);
m_Rigidbody.AddRelativeTorque(direction, forceMode);
rb.AddExplosionForce(explosionForce, explositonPosition, explosionRadius, 0, forceMode);
m_Rigidbody.AddExplosionForce(explosionForce, explositonPosition, explosionRadius, 0, forceMode);
rb.Sleep();
m_Rigidbody.Sleep();
break;
}
}

force = false;
explosion = false;
explosion = (actionType == RigidbodyActionType.ExplosionForce);
switch (actionType)
{

case RigidbodyActionType.Torque:
force = true;
break;
case RigidbodyActionType.ExplosionForce:
explosion = true;
break;
}
}
正在加载...
取消
保存