Exemplo n.º 1
0
        public void ResetField(UnityEngine.Vector3Int mapPosition, bool resetCreatures = true, bool resetEffects = true)
        {
            int   index = ToIndexInternal(mapPosition);
            Field field = _fields[index];

            _cacheObjectsCount[(_origin.z + mapPosition.z) % Constants.MapSizeZ] =
                _cacheObjectsCount[(_origin.z + mapPosition.z) % Constants.MapSizeZ] - field.ObjectsCount;
            CacheFullbank = false;

            if (resetCreatures)
            {
                var creatureStorage = OpenTibiaUnity.CreatureStorage;
                for (int i = field.ObjectsCount - 1; i > 0; i--)
                {
                    var @object = field.ObjectsNetwork[i];
                    if (@object.IsCreature)
                    {
                        creatureStorage.MarkOpponentVisible(@object, false);
                    }
                }
            }

            field.ResetObjects();

            if (resetEffects)
            {
                for (int i = field.EffectsCount - 1; i > 0; i--)
                {
                    var effect = field.Effects[i];
                    if (effect.MapData == index)
                    {
                        DeleteEffect(i);
                    }
                }

                field.ResetEffects();
            }
        }
Exemplo n.º 2
0
        public void ResetField(UnityEngine.Vector3Int position, bool resetCreatures = true, bool resetEffects = true)
        {
            int   index = ToIndexInternal(position);
            Field field = m_Fields[index];

            m_CacheObjectsCount[(m_Origin.z + position.z) % Constants.MapSizeZ] =
                m_CacheObjectsCount[(m_Origin.z + position.z) % Constants.MapSizeZ] - field.ObjectsCount;
            CacheFullbank = false;

            if (resetCreatures)
            {
                var creatureStorage = OpenTibiaUnity.CreatureStorage;
                for (int i = field.ObjectsCount - 1; i > 0; i--)
                {
                    var obj = field.ObjectsNetwork[i];
                    if (obj.ID == Appearances.AppearanceInstance.Creature)
                    {
                        creatureStorage.MarkOpponentVisible(obj, false);
                    }
                }
            }

            field.ResetObjects();

            if (resetEffects)
            {
                for (int i = field.EffectsCount - 1; i > 0; i--)
                {
                    var effect = field.Effects[i];
                    if (effect.MapData == index)
                    {
                        DeleteEffect(i);
                    }
                }

                field.ResetEffects();
            }
        }