public void AddMovementType(MovementType move) { if (movements == null) { movements = new List <MovementType>(); } move.SetPlayerComponents(movement, playerInput); if ((move as WallrunMovement) != null) //If this move type is a Wallrunning { wallrun = (move as WallrunMovement); } else if ((move as SurfaceSwimmingMovement) != null) //If this move type is a Surface Swimming { swimming = (move as SurfaceSwimmingMovement); } movements.Add(move); }