Exemplo n.º 1
0
        private void UpdateAttachCandidates(IEnumerable <MovableTile> detectedAttachableTiles)
        {
            AttachCandidates.Clear();

            foreach (MovableTile tile in detectedAttachableTiles)
            {
                AttachCandidates.Add(tile.Shape);
            }
        }
Exemplo n.º 2
0
        /// <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
            });
        }