private void UninformHead(PushPull whoToInform, PushPull subject) { InformPullMessage.Send(whoToInform, subject, null); if (IsPullingSomething) { PulledObject.UninformHead(whoToInform, PulledObject); } }
///inform new master puller about who's pulling who in the train public void InformHead(PushPull whoToInform, PushPull subject = null) { if (subject == null) { subject = this; } InformPullMessage.Send(whoToInform, subject, subject.PulledBy); if (IsPullingSomething) { PulledObject.InformHead(whoToInform, PulledObject); } }
public void CmdPullObject(GameObject pullableObject) { PushPull pullable = pullableObject.GetComponent <PushPull>(); if (!pullable) { return; } if (IsPullingSomething) { var alreadyPulling = PulledObject; ReleaseControl(); //Kill ex-pullable's impulses if we stop pulling it ourselves //todo: make it accept puller's impulse on release if he's flying alreadyPulling.Stop(); //Just stopping pulling of object if we ctrl+click it again if (alreadyPulling == pullable) { return; } } ConnectedPlayer clientWhoAsked = PlayerList.Instance.Get(gameObject); if (clientWhoAsked.Script.canNotInteract()) { return; } if (PlayerScript.IsInReach(pullable.registerTile, this.registerTile) && !pullable.isNotPushable && pullable != this && !IsBeingPulled) { if (pullable.StartFollowing(this)) { SoundManager.PlayNetworkedAtPos("Rustle0" + Random.Range(1, 4), pullable.transform.position); PulledObject = pullable; //Kill its impulses if we grabbed it PulledObject.Stop(); // Update the UI UpdatePullingUI(this); } } }
private void Awake() { pulled_object = gameObject.GetComponent <PulledObject>(); }