// initializing diffrent dependancies. void Start() { rayElevatorPlatform = this.GetComponentInChildren <ElevatorPlatformTrigger>(); elevatorStopped = new StopElevator(); elevatorMovingUp = new ElevatorMoveUp(this); elevatorMovingDown = new ElevatorMovesDown(this); // Our elevator starts in the stopped state; curentState = elevatorStopped; }
// methods used to swap the elevator's state public void setElevatorState(IElevatorStates newElevatorState) { curentState = newElevatorState; }