private void HandlePlayerEvent(PlayerEventInfo info) { switch (info.type) { case PlayerEventType.SetCheckpoint: SetCheckpoint(info.position); break; case PlayerEventType.SetCheckpointList: checkpoints = info.checkpoints; checkpoints = checkpoints.OrderBy(v => v.Y).ToList(); break; case PlayerEventType.MovableTileDie: AttachedTiles.Remove(info.movableTile); info.movableTile.Respawn(); break; case PlayerEventType.PickupMug: break; case PlayerEventType.CheckSouroundings: CheckAndProcessSurroundings(GetSurroundings(Transform3D.Translation)); break; } }
public void Detach() { foreach (AttachableTile tile in AttachedTiles) { ((BasicEffectParameters)tile.EffectParameters).Color = Color.Black; tile.IsAttached = false; } IsAttached = false; AttachedTiles.Clear(); EventManager.FireEvent(new SoundEventInfo { soundEventType = SoundEventType.PlaySfx, sfxType = SfxType.PlayerDetach }); }
/// <summary> /// Method to attach to the Attachables around the Player. /// </summary> public void Attach() { if (AttachCandidates.Count == 0 || IsMoving) { return; } AttachedTiles.Clear(); foreach (AttachableTile tile in AttachCandidates.SelectMany(shape => shape.AttachableTiles)) { if (tile.EffectParameters is BasicEffectParameters basicEffectParameters) { basicEffectParameters.Color = Color.Crimson; } AttachedTiles.Add(tile); tile.IsAttached = true; } IsAttached = true; EventManager.FireEvent(new SoundEventInfo { soundEventType = SoundEventType.PlaySfx, sfxType = SfxType.PlayerAttach }); }