Exemple #1
0
        public virtual void TryDetonate(object sender, EventArgs e)
        {
            BombsManager.CurrentBombObject = (e as BombDetonationEventArgs).BombObject;
            BombsManager.CurrentBomb       = BombsManager.GetBombByObject(BombsManager.CurrentBombObject);
            BombsManager.DetonatedShip     = (e as BombDetonationEventArgs).DetonatedShip;

            BombsManager.CallGetPermissionToDetonateTrigger(Detonate);
        }
Exemple #2
0
 private void CheckDamage(GenericShip ship)
 {
     if (ship.MinesHit.Count > 0)
     {
         foreach (var mine in ship.MinesHit)
         {
             Triggers.RegisterTrigger(new Trigger()
             {
                 Name         = "Damage from mine",
                 TriggerOwner = ship.Owner.PlayerNo,
                 TriggerType  = TriggerTypes.OnPositionFinish,
                 EventHandler = BombsManager.GetBombByObject(mine).TryDetonate,
                 EventArgs    = new BombDetonationEventArgs()
                 {
                     DetonatedShip = ship,
                     BombObject    = mine
                 }
             });
         }
     }
 }
            private static void ShowCollisionResults()
            {
                string title = "Results of collision detection";

                string description = "";

                if (MovementPrediction.AsteroidsHit.Count > 0)
                {
                    description += "Obstacles hit: ";
                    foreach (GenericObstacle obstacle in MovementPrediction.AsteroidsHit)
                    {
                        description += obstacle.Name + ", ";
                    }
                    description  = description.Remove(description.Length - 2, 2);
                    description += "\n";
                }

                if (MovementPrediction.IsLandedOnAsteroid)
                {
                    description += "Landed on obstacles: ";
                    foreach (GenericObstacle obstacle in MovementPrediction.LandedOnObstacles)
                    {
                        description += obstacle.Name + ", ";
                    }
                    description  = description.Remove(description.Length - 2, 2);
                    description += "\n";
                }

                if (MovementPrediction.MinesHit.Count > 0)
                {
                    description += "Mines hit: ";
                    foreach (GenericDeviceGameObject mine in MovementPrediction.MinesHit)
                    {
                        description += BombsManager.GetBombByObject(mine).UpgradeInfo.Name + ", ";
                    }
                    description  = description.Remove(description.Length - 2, 2);
                    description += "\n";
                }

                if (MovementPrediction.ShipsBumped.Count > 0)
                {
                    description += "Bumped into ships: ";
                    foreach (GenericShip ship in MovementPrediction.ShipsBumped)
                    {
                        description += ship.PilotInfo.PilotName + " (" + ship.ShipId + "), ";
                    }
                    description  = description.Remove(description.Length - 2, 2);
                    description += "\n";
                }

                if (MovementPrediction.RemotesMovedThrough.Count > 0)
                {
                    description += "Remotes hit: ";
                    foreach (GenericRemote remote in MovementPrediction.RemotesMovedThrough)
                    {
                        description += remote.PilotInfo.PilotName + ", ";
                    }
                    description  = description.Remove(description.Length - 3, 2);
                    description += "\n";
                }

                if (MovementPrediction.RemotesOverlapped.Count > 0)
                {
                    description += "Landed on remotes: ";
                    foreach (GenericRemote remote in MovementPrediction.RemotesOverlapped)
                    {
                        description += remote.PilotInfo.PilotName + ", ";
                    }
                    description  = description.Remove(description.Length - 2, 2);
                    description += "\n";
                }

                if (description != "")
                {
                    description = description.Remove(description.Length - 1, 1);
                }
                else
                {
                    description = "No collisions";
                }

                Phases.CurrentSubPhase.ShowSubphaseDescription(title, description);
            }