public MotorStateBase(PlayerTopDown3DController player, PlayerFeedbacks feedback)
 {
     this.player   = player;
     this.feedback = feedback;
     motorStatus   = player.Status;
     raycaster     = player.Raycaster;
     settings      = CharacterSettings.instance;
 }
Ejemplo n.º 2
0
 public MotorStateBase(Player2DMotor motor, Player2DFeedbacks feedback)
 {
     this.motor    = motor;
     this.feedback = feedback;
     motorStatus   = motor.status;
     raycaster     = motor.raycaster;
     settings      = GameSettings.instance;
 }
Ejemplo n.º 3
0
    void Awake()
    {
        //Reference
        rb        = GetComponent <Rigidbody2D>();
        raycaster = GetComponent <MotorRaycaster>();
        Feedbacks = GetComponentInChildren <Player2DFeedbacks>();

        //Initialize various variables
        status           = new MotorStatus();
        stateClassLookup = new Dictionary <MotorStates, MotorStateBase> //Store all the FSM classes using their common base class
        {
            { MotorStates.OnGround, new MotorState_MoveOnGround(this, Feedbacks) },
            { MotorStates.Aerial, new MotorState_Aerial(this, Feedbacks) },
            { MotorStates.WallClimb, new MotorState_WallClimb(this, Feedbacks) },
            { MotorStates.Hurt, new MotorState_Hurt(this, Feedbacks) },
        };

        currentStateType  = MotorStates.OnGround;
        currentStateClass = stateClassLookup[currentStateType];
    }