Beispiel #1
0
 public void RemoveProjectile(Projectile en)
 {
     lock (GetMapLock())
     {
         MapProjectiles.Remove(en);
     }
 }
Beispiel #2
0
        public void DespawnProjectiles()
        {
            lock (GetMapLock())
            {
                //Clear Map Projectiles
                for (var i = 0; i < MapProjectiles.Count; i++)
                {
                    if (MapProjectiles[i] != null)
                    {
                        mEntities.TryRemove(MapProjectiles[i].Id, out var result);
                        MapProjectiles[i].Die();
                    }
                }

                MapProjectiles.Clear();
            }
        }
Beispiel #3
0
 //Spawn a projectile
 public void SpawnMapProjectile(
     Entity owner,
     ProjectileBase projectile,
     SpellBase parentSpell,
     ItemBase parentItem,
     Guid mapId,
     byte x,
     byte y,
     byte z,
     byte direction,
     Entity target
     )
 {
     lock (GetMapLock())
     {
         var proj = new Projectile(owner, parentSpell, parentItem, projectile, Id, x, y, z, direction, target);
         MapProjectiles.Add(proj);
         PacketSender.SendEntityDataToProximity(proj);
     }
 }
Beispiel #4
0
        public void Update()
        {
            _time = Game1.Time;

            if (_active == true)
            {
                foreach (ITriggers trgr in mapTriggers)
                {
                    trgr.Update();
                }

                foreach (IRectanglePhysics mvbl in MapMovables)
                {
                    mvbl.Update();
                }

                foreach (Inpc npc in MapNpcs.Reverse <Inpc>())
                {
                    npc.Update(MapNpcs);
                }

                foreach (IEffect lght in mapLightings.Reverse <IEffect>())
                {
                    lght.Update(mapLightings);
                }

                foreach (IProjectile prjctl in MapProjectiles.Reverse <IProjectile>())
                {
                    prjctl.Update(this);
                }

                foreach (IPickable pick in mapPickables.Reverse <IPickable>())
                {
                    pick.Update();
                }

                foreach (IParticle prtcl in mapParticles.Reverse <IParticle>())
                {
                    prtcl.Update();
                }
            }

            if (_transparencyArrive == true)
            {
                if (_transparency > 0)
                {
                    _transparency -= Game1.Delta / 500;
                }
            }
            else
            {
                if (_transparency < 1)
                {
                    _transparency += Game1.Delta / 500;
                }
                else
                {
                    _transparencyArrive = true;
                    _transparency       = 1;
                    _active             = true;
                    Game1.State         = GlobalState.inWorld;
                }
            }
        }