void SendRPC() { proxy.RPC(rpc.name, RpcTarget.All, rpc.@params); rpc = null; if (pauseWhenDone) { Debug.LogError("Done: " + GetType().Name); } ExecPostAction(); }
// Note: in general, an action such as attacking, grabbing, etc... has a // duration which can be affected by a number of factors. Here the // implementation is taking a shortcut by directly calling into an ad-hoc // animation handler, and matching the action length to the animation // length. For dependencies to be well formed: // - message an event to indicate that the activity is starting. // - retrieve the action duration from a dedicated delegate, which usually // is (but needn't be) the animation handler. protected void RPC(string m, params object[] p) { if (rpc != null) { return; } var activity = m.Substring(2).ToLower(); var handler = this.Get <BasicAnimationHandler>(); float duration = 0; if (handler) { duration = this.Get <BasicAnimationHandler>().Play(activity); } if (duration <= 0) { duration = defaultDuration; } rpc = new RPCParams(m, p); Invoke("SendRPC", duration); }
void OnDisable() { rpc = null; CancelInvoke(); postAction = null; }