Exemple #1
0
        public void AppendEffect(UnityEngine.Vector3Int position, Appearances.AppearanceInstance effect)
        {
            UnityEngine.Vector3Int?mapPosition = ToMapInternal(position);

            int   index = -1;
            Field field = null;

            if (mapPosition != null)
            {
                index = ToIndexInternal(mapPosition.Value);
                field = m_Fields[index];
            }

            if (!!field && effect is Appearances.TextualEffectInstance)
            {
                Appearances.TextualEffectInstance textualEffect = (Appearances.TextualEffectInstance)effect;
                for (int i = field.EffectsCount - 1; i > 0; i--)
                {
                    var otherEffect = field.Effects[i];
                    if (otherEffect is Appearances.TextualEffectInstance && textualEffect.Merge(otherEffect))
                    {
                        return;
                    }
                }
            }

            if (m_EffectsCount < Constants.NumEffects)
            {
                effect.MapField = index;
                if (!!field)
                {
                    field.AppendEffect(effect);
                }
                else
                {
                    effect.MapData = 0;
                }

                m_Effects[m_EffectsCount] = effect;
                m_EffectsCount++;
            }
        }
Exemple #2
0
        public void AppendEffect(UnityEngine.Vector3Int absolutePosition, Appearances.AppearanceInstance effect)
        {
            UnityEngine.Vector3Int?mapPosition = ToMappublic(absolutePosition);

            int   index = -1;
            Field field = null;

            if (mapPosition != null)
            {
                index = ToIndexpublic(mapPosition.Value);
                field = _fields[index];
            }

            if (!!field && effect is Appearances.TextualEffectInstance textualEffect)
            {
                for (int i = field.EffectsCount - 1; i > 0; i--)
                {
                    var otherEffect = field.Effects[i];
                    if (otherEffect is Appearances.TextualEffectInstance && textualEffect.Merge(otherEffect))
                    {
                        return;
                    }
                }
            }

            if (_effectsCount < Constants.NumEffects)
            {
                effect.MapField = index;
                effect.MapData  = 0;
                if (!!field)
                {
                    field.AppendEffect(effect);
                }

                _effects[_effectsCount] = effect;
                _effectsCount++;
            }
        }