private void OnTriggerEnter(Collider other) { player = other.GetComponent <PlayerController>(); swimming = player.GetSwimmingMovement(); if (swimming == null) { return; //if you didn't get a component then it will be null so don't continue } playerInWater = true; swimming.AddWaterHelper(this); }
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); }
public override void SetPlayerComponents(PlayerMovement move, PlayerInput input) { base.SetPlayerComponents(move, input); swimming = GetComponent <SurfaceSwimmingMovement>(); }