Exemplo n.º 1
0
        public void ApplyModifierChangeToDownward(string targetPlayerName, IModifier m, bool isRemoving, bool isFromSaveData)
        {
            if (targetPlayerName.ToLower() != "global" && targetPlayerName != OwnPlayer.PlayerName)
            {
                TileMap.ApplyModifierChangeToTileObjects(targetPlayerName, m, isRemoving, isFromSaveData, null);
                return;
            }

            // Tiled modifier cannot affect the target type itself.
            if (m is TiledModifier && m.TargetType == TypeName)
            {
                TileMap.ApplyModifierChangeToTileObjects(targetPlayerName, m, isRemoving, isFromSaveData, null);
                return;
            }

            if (isRemoving)
            {
                m.OnRemoved(this);

                RemoveTriggerEvent(m.Name);
            }
            else
            {
                if (!isFromSaveData)
                {
                    m.OnAdded(this);
                }

                RegisterTriggerEvent(m.Name, m.GetTriggerEvent(this));
            }

            TileMap.ApplyModifierChangeToTileObjects(targetPlayerName, m, isRemoving, isFromSaveData, null);
        }