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 }); }