void DoAction(MovingPlatformActions action) { if (action == MovingPlatformActions.Nothing) { return; } //Debug.Log("MovingPlatformControllerTrigger.DoAction: " + action); foreach (MovingPlatform target in targets) { //Debug.Log("Do: " + action + " ON " + target.name); target.DoAction(action); } }
/// <summary> /// Perform an action over MovingPlatform like: Resume, stop, reverse.... /// </summary> public void DoAction(MovingPlatformActions action) { switch (action) { case MovingPlatformActions.Resume: Resume(); break; case MovingPlatformActions.ResumeAndStop: Resume(); StopOn(1); break; case MovingPlatformActions.ReverseAndResume: Reverse(); Resume(); break; case MovingPlatformActions.ReverseAndResumeAndStop: Reverse(); Resume(); StopOn(1); break; case MovingPlatformActions.Stop: Stop(); break; case MovingPlatformActions.StopOnNext: StopOn(1); break; case MovingPlatformActions.IfStoppedReverse: if (IsStopped()) { Resume(); StopOn(2); } break; } }