本文整理汇总了C#中MonoBehaviour.SendMessage方法的典型用法代码示例。如果您正苦于以下问题:C# MonoBehaviour.SendMessage方法的具体用法?C# MonoBehaviour.SendMessage怎么用?C# MonoBehaviour.SendMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MonoBehaviour
的用法示例。
在下文中一共展示了MonoBehaviour.SendMessage方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AttackAnim
public IEnumerator AttackAnim(MonoBehaviour target)
{
_attacking = true;
// Anticipation
yield return StartCoroutine(GoThereInTime(-transform.forward, 0.1f, 5));
// Rush forward
yield return StartCoroutine(GoThereInTime(transform.forward, 0.1f, 30));
if(target != null)
target.SendMessage("Hit", Damage);
// Push back
yield return StartCoroutine(GoThereInTime(-transform.forward, 0.2f, 15));
_attacking = false;
}
示例2: Start
public override void Start(MonoBehaviour behaviour, Sequencer.StateInstance _state)
{
behaviour.SendMessage("SequenceChangeState", state, SendMessageOptions.RequireReceiver);
}
示例3: SendMessage
public static void SendMessage( MonoBehaviour sender, string methodName, object parameter )
{
#if DEBUG
Debug.Log(
string.Format(
@"{0}{1}.BroadcastMessage( ""{2}"", {3} );",
LiveConsoleLogAttribute.Get( LiveConsoleLogAttribute.Attribute.Message ),
sender.gameObject.name,
methodName,
parameter.ToString()
),
sender
);
#endif
sender.SendMessage( methodName, parameter, SendMessageOptions.DontRequireReceiver );
}
示例4: PauseableInvoke
public static IEnumerator PauseableInvoke(string func, MonoBehaviour comp, float waitDur)
{
float timer = 0;
while (timer < waitDur)
{
if (gamePaused)
yield break;
timer += Time.deltaTime;
}
comp.SendMessage(func);
yield return null;
}
示例5: Launch
public void Launch(MonoBehaviour owner, Pad pad)
{
owner.SendMessage ("OnPadPressed", pad.id);
}