protected virtual void updateMountedState() { if (WatchedAttributes.HasAttribute("mountedOn")) { var mountable = World.ClassRegistry.CreateMountable(WatchedAttributes["mountedOn"] as TreeAttribute); this.MountedOn = mountable; controls.StopAllMovement(); if (mountable == null) { WatchedAttributes.RemoveAttribute("mountedOn"); return; } if (MountedOn?.SuggestedAnimation != null) { string anim = MountedOn.SuggestedAnimation.ToLowerInvariant(); AnimManager?.StartAnimation(anim); } mountable.DidMount(this); } else { TryUnmount(); } }
/// <summary> /// Attempts to mount the player on a target. /// </summary> /// <param name="onmount">The mount to mount</param> /// <returns>Whether it was mounted or not.</returns> public bool TryMount(IMountable onmount) { this.MountedOn = onmount; controls.StopAllMovement(); if (MountedOn?.SuggestedAnimation != null) { string anim = MountedOn.SuggestedAnimation.ToLowerInvariant(); AnimManager?.StartAnimation(anim); } onmount.DidMount(this); return(true); }