/// <summary> /// Base method for start grabbing. /// </summary> /// <param name="grabber">The current grabber.</param> public virtual void StartGrabbing(Grabber grabber) { Grabber = grabber; State = GrabbingState.SimpleGrab; AttachGrabber(grabber); if (OnGrabbed != null) { OnGrabbed(this); } SetColor(_grabbedColor); }
private void Awake() { MovementManager = new BjjMovementManager(this); InputBinding = new KeyboardInputBinding(PlayerNumber); IdleState idle = new IdleState(this, null); GrabbingState grab = new GrabbingState(this, null); PullGuardState pullingGuard = new PullGuardState(this, null); EnterGuardState enteringGuard = new EnterGuardState(this, null); States = new Dictionary <BjjState, IState> { { BjjState.Null, null }, { BjjState.Idle, idle }, { BjjState.Grab, grab }, { BjjState.PullingGuard, pullingGuard }, { BjjState.EnteringGuard, enteringGuard } }; }
/// <summary> /// Called on grabbing stopped /// </summary> /// <param name="grabber"></param> public virtual void StopGrabbing(Grabber grabber) { grabber.StopGrabbing(); State = GrabbingState.Normal; Grabber = null; DetachGrabber(grabber); if (OnReleased != null) { OnReleased(this); } if (Rigidbody != null) { Rigidbody.isKinematic = false; } if (InputInstance.FocusedObject.GameObject != gameObject) { SetColor(_normalColor); } }