public CollisionDetector(IProjectileManager projectileManager, LegendOfZelda game)
 {
     this.game              = game;
     collisions             = new List <ICollision>();
     this.projectileManager = projectileManager;
     this.game              = game;
 }
 public DoorProjectileCollision(IList <IRoom> rooms, int roomIndex,
                                KeyValuePair <string, IDoor> door, IProjectileManager projectiles,
                                IProjectile projectile)
 {
     this.rooms       = rooms;
     this.roomIndex   = roomIndex;
     this.door        = door;
     this.projectiles = projectiles;
     this.projectile  = projectile;
 }
Esempio n. 3
0
 public PlacedBomb(IProjectileManager projectiles, int x = 0, int y = 0)
     : base(x, y, 0, 0, Team.Link)
 {
     sprite           = ItemSpriteFactory.GetBomb();
     X                = x;
     Y                = y;
     timer            = 60;
     this.projectiles = projectiles;
     Hitbox           = new Rectangle(X, Y, 0, 0);
 }
Esempio n. 4
0
 public WallProjectileCollision(IProjectileManager manager,
                                IProjectile projectile, in Rectangle collision)
 public PlayerUseBlueCandleCommand(IPlayer player, IProjectileManager projectiles)
 {
     this.player      = player;
     this.projectiles = projectiles;
 }
        public EnemyProjectileCollision(IProjectileManager manager,

                                        ICollection <IEnemy> enemies, IEnemy enemy, IProjectile projectile,
                                        in Rectangle collision)
        public override void Dispose()
        {
            ProjectileManager = null;

            base.Dispose();
        }
        public override void Initialize()
        {
            ProjectileManager = GameServiceManager.GetService<IProjectileManager>();

            base.Initialize();
        }
Esempio n. 9
0
 public PlayerUseCurrentItemCommand(IPlayer player, IProjectileManager projectiles)
 {
     this.player      = player;
     this.projectiles = projectiles;
 }
Esempio n. 10
0
        public virtual void StructureFired(ICanFire firingStructure, float rotation, List <int> projectileIDs, IProjectileManager pm, byte percentCharge, byte weaponSlot)
        {
            foreach (var id in projectileIDs)
            {
                pm.CreateProjectile(firingStructure, id);
            }

            var messageData = new MessageObjectFired {
                ObjectType = FiringObjectTypes.Structure, FiringObjectID = firingStructure.Id, PercentCharge = percentCharge, Rotation = rotation, WeaponSlot = weaponSlot, ProjectileIDs = projectileIDs
            };

            BroadcastMessage(new NetworkMessageContainer(messageData, MessageTypes.ObjectFired), null);
        }
Esempio n. 11
0
        /// <summary>
        /// Checks if a structure exists and can fire, fires and returns true if possible, false otherwise
        /// </summary>
        /// <param name="firingStructure"></param>
        /// <returns></returns>
        public virtual bool TryFireStructure(int firingStructureID, float rotationOfIncoming, List <int> projectileIDs, IProjectileManager pm, byte pctCharge, byte weaponSlot)
        {
            if (!_structures.ContainsKey(firingStructureID))
            {
                return(false);
            }

            IStructure tempStructure = _structures[firingStructureID];

            if (tempStructure.StructureType == StructureTypes.DefensiveMine)
            {
                var mine = tempStructure as DefensiveMine;

                // Check if the mine was already triggered.
                if (mine == null || mine.WasTriggered)
                {
                    return(false);
                }

                // Mine is removed automatically on the client when fired, no message is sent
                mine.WasTriggered = true;
                _structures.Remove(firingStructureID);
            }

            if (!tempStructure.Weapon.CanFire(tempStructure))
            {
                return(false);
            }

            // if tempStructure is not ICanFire, we f****d up somewhere...
            tempStructure.Weapon.Fire(tempStructure);
            StructureFired((ICanFire)tempStructure, rotationOfIncoming, projectileIDs, pm, pctCharge, weaponSlot);
            return(true);
        }
Esempio n. 12
0
        /// <summary>
        /// Creates projectiles and notifies other clients of firing ship
        /// </summary>
        /// <param name="firingPlayer"></param>
        /// <param name="weaponSlot"></param>
        public virtual void ShipFired(IShip firingShip, float rotation, byte weaponSlot, List <int> projectileIDs, IProjectileManager pm, byte percentCharge = 0)
        {
            foreach (var id in projectileIDs)
            {
                pm.CreateProjectile(firingShip, id);
            }

            MessageObjectFired messageData = new MessageObjectFired {
                FiringObjectID = firingShip.Id, ObjectType = FiringObjectTypes.Ship, PercentCharge = percentCharge, Rotation = rotation, WeaponSlot = weaponSlot, ProjectileIDs = projectileIDs
            };

            BroadcastMessage(new NetworkMessageContainer(messageData, MessageTypes.ObjectFired), firingShip.Id, firingShip.PilotType == PilotTypes.NPC);//If NPC, simulator doesn't need to get spammed with ship fired notifications
        }
Esempio n. 13
0
        public override void Dispose()
        {
            ProjectileManager = null;

            base.Dispose();
        }
Esempio n. 14
0
        public override void Initialize()
        {
            ProjectileManager = GameServiceManager.GetService <IProjectileManager>();

            base.Initialize();
        }
 public CharacterProjectileCollision(IProjectileManager manager,
                                     ICharacter character, IProjectile projectile, in Rectangle collision)
Esempio n. 16
0
 public PlayerProjectileCollision(IProjectileManager manager, IPlayer player,
                                  IProjectile projectile, in Rectangle collision)
Esempio n. 17
0
 public override void ShipFired(IShip firingShip, float rotation, byte weaponSlot, List <int> projectileIDs, IProjectileManager pm, byte pctCharge = 0)
 {
 }