public IEnumerator LaneActor(Actor actor, Vector3 start, Vector3 end) { if ((end.x - start.x > 0 && Location == CoastLocation.RightCoast) || (end.x - start.x < 0 && Location == CoastLocation.LeftCoast)) { MainBoat.Passenger = null; ActorController controller = actor.GetComponent <ActorController>(); if (Location == CoastLocation.LeftCoast) { controller.RotateLeft(); } ActorCheckPoint jumpPoint = JumpPoints.Find((x) => x.ActorType == actor.ActorType); yield return(StartCoroutine(controller.JumpTo(jumpPoint))); ActorCheckPoint stopPoint = StopPoints.Find((x) => x.ActorType == actor.ActorType); yield return(StartCoroutine(controller.WalkTo(stopPoint))); actor.transform.parent = transform; if (Location == CoastLocation.LeftCoast) { controller.RotateRight(); } else { controller.RotateLeft(); } ExecuteEvents.ExecuteHierarchy <ITaskEventsHandler>(gameObject, null, (x, y) => x.OnCharacterMoved()); } }
private IEnumerator MoveActor(Actor actor) { if (MainBoat.CurrentDock == BoatDock && (MainBoat.HasPassenger == false)) { ActorController controller = actor.GetComponent <ActorController>(); ActorCheckPoint jumpPoint = JumpPoints.Find((x) => x.ActorType == actor.ActorType); yield return(StartCoroutine(controller.WalkTo(jumpPoint))); ActorCheckPoint boatPoint = MainBoat.ActorPoints.Find((x) => x.ActorType == actor.ActorType); yield return(StartCoroutine(controller.JumpTo(boatPoint))); MainBoat.Passenger = actor; actor.transform.parent = MainBoat.transform; if (Location == CoastLocation.RightCoast) { controller.RotateRight(); } ExecuteEvents.ExecuteHierarchy <ITaskEventsHandler>(gameObject, null, (x, y) => x.OnCharacterMoved()); } Level.IsBusy = false; }