コード例 #1
0
 public PortalToObjective(PortalToObjective other)
     : base(other.Spawn)
 {
     Name       = other.Name;
     _target    = other._target;
     _targetPos = other._targetPos;
 }
        /// <summary>
        /// Invoked when the objective is locked, spawning the portal to warcamp.
        /// </summary>
        internal void ObjectiveLocked()
        {
            if (_objectivePortal != null)
            {
                return;
            }

            if (!Load()) // Useful when database has been updated at runtime
            {
                return;
            }

            if (_objectivePortal == null && _region.GetTier() < 2)
            {
                _objectivePortal = new PortalToWarcamp(_objectivePortalData, _orderPortalData, _destroPortalData);
                _region.AddObject(_objectivePortal, _objectivePortalData.ZoneId);
            }

            if (_orderPortal != null)
            {
                _orderPortal.Dispose();
                _destroPortal.Dispose();
                _orderPortal  = null;
                _destroPortal = null;
            }
        }
        /// <summary>
        /// Invoked when the objective is locked, initializing the portals in warcamps.
        /// They will be spawned depending on flag state.
        /// </summary>
        internal void ObjectiveUnlocked()
        {
            if (!Load()) // Useful when database has been updated at runtime
            {
                return;
            }

            if (_objectivePortal != null)
            {
                _region.RemoveObject(_objectivePortal);
                _objectivePortal = null;
            }

            if (_orderPortal == null)
            {
                _orderPortal  = new PortalToObjective(_orderPortalData, _objectivePortalData, _objective.Name);
                _destroPortal = new PortalToObjective(_destroPortalData, _objectivePortalData, _objective.Name);
            }
            int i = 0;
        }
 /// <summary>
 /// Spawns or despawns given portal.
 /// </summary>
 /// <param name="portal">Portal to spawn or despawn</param>
 /// <param name="portalData">Data bound to the portal</param>
 /// <param name="spawn">True to spawn the portal, false to despawn it</param>
 private void UpdatePortalSpawn(PortalToObjective portal, BattlefrontObject portalData, bool spawn)
 {
     if (portal.IsInWorld() != spawn)
     {
         if (spawn)
         {
             PortalToObjective clone = new PortalToObjective(portal);
             if (portalData.Realm == (ushort)Realms.REALMS_REALM_ORDER)
             {
                 _orderPortal = clone;
             }
             else
             {
                 _destroPortal = clone;
             }
             _region.AddObject(clone, portalData.ZoneId);
         }
         else
         {
             _region.RemoveObject(portal);
         }
     }
 }