コード例 #1
0
ファイル: Game.cs プロジェクト: Yoann-Yarb/BombEISTIv2
        public void EmptyTheTrash(Map m)
        {
            foreach (var e in ToDelete)
            {
                if (e is Bomb)
                {
                    var theBomb = m.ListOfBomb.First(c => c.X == e.X && c.Y == e.Y);
                    m.ListOfBomb.Remove(theBomb);

                }
                else if (e is Player)
                {
                    var thePlayer = m.ListOfPlayer.First(c => c.X == e.X && c.Y == e.Y);
                    thePlayer.Die();
                    m.ListOfPlayer.Remove(thePlayer);
                }
                else if (e is SoftBlock)
                {
                    var theSoftBlock = m.ListOfSoftBlock.First(c => c.X == e.X && c.Y == e.Y);
                    theSoftBlock.Destroy(m);
                    m.ListOfSoftBlock.Remove(theSoftBlock);
                }
                else if (e is Upgrade)
                {
                    var theUpgrade = m.ListOfUpgrade.First(c => c.X == e.X && c.Y == e.Y);
                    theUpgrade.Burn();
                    m.ListOfUpgrade.Remove(theUpgrade);
                }
            }
            ToDelete.Clear();
        }
コード例 #2
0
ファイル: Player.cs プロジェクト: SsSanzo/BombEISTIv2
 public Player(int id, int skinid, int x, int y, Map map, Score score = null)
     : base(x, y)
 {
     _id = id;
     _skinid = skinid;
     _upgrades = new List<Upgrade>();
     _upgradesBomb = new List<UpgradeBomb>();
     _map = map;
     InitSkills();
 }
コード例 #3
0
ファイル: ClassicGame.cs プロジェクト: Yoann-Yarb/BombEISTIv2
 public ClassicGame()
 {
     GameParameters._.Type = GameType.Classic;
     Map = new Map();
     Map.SetHardBlockOnMap();
     Map.SetSoftBlockOnMap();
     InitPlayers(GameParameters._.PlayerCount);
     var timer = TimerManager._.GetNewTimer(false, GameParameters._.GameTime - 30000);
     TimerManager._.GetTimer(timer).Elapsed += HurryUp;
     Start();
 }
コード例 #4
0
ファイル: CrazyGame.cs プロジェクト: SsSanzo/BombEISTIv2
 public CrazyGame(GameScreen wiz = null)
 {
     w = wiz;
     theGameIsOver = false;
     GameParameters._.Type = GameType.Crazy;
     TheCurrentMap = new Map();
     TheCurrentMap.SetHardBlockOnMap();
     TheCurrentMap.SetSoftBlockOnMapCrazy();
     InitPlayersCrazy();
     TimerManager._.AddNewTimer(true, 1000, false, null, ChangeTime);
     TimerManager._.AddNewTimer(false, GameParameters._.GameTime * 1000, false, null, EndOfTheGame);
 }
コード例 #5
0
ファイル: Player.cs プロジェクト: Yoann-Yarb/BombEISTIv2
 public Player(int id, int x, int y, Map map, Score score = null)
     : base(x, y)
 {
     _id = id;
     if(score == null)
     {
         _score = new Score(id);
     }
     _upgrades = new List<Upgrade>();
     _map = map;
     InitSkills();
 }
コード例 #6
0
ファイル: ClassicGame.cs プロジェクト: SsSanzo/BombEISTIv2
 public ClassicGame(GameScreen wiz = null)
 {
     w = wiz;
     theGameIsOver = false;
     GameParameters._.Type = GameType.Classic;
     TheCurrentMap = new Map();
     TheCurrentMap.SetHardBlockOnMap();
     TheCurrentMap.SetSoftBlockOnMap();
     InitPlayers();
     TimerManager._.AddNewTimer(true, 1000, false, null, ChangeTime);
     TimerManager._.AddNewTimer(false, GameParameters._.GameTime * 1000 - 45000, false, null, HurryUp);
 }
コード例 #7
0
ファイル: SoftBlock.cs プロジェクト: SsSanzo/BombEISTIv2
 public void Destroy(Map m)
 {
     if(MyUpgrade != null)
     {
         m.ListOfUpgrade.Add(MyUpgrade);
         Texture._.InsertTextureEntity(MyUpgrade);
     }else if(MyBombSec != null)
     {
         m.ListOfUpgradeBomb.Add(MyBombSec);
         Texture._.InsertTextureEntity(MyBombSec);
     }
 }
コード例 #8
0
ファイル: Bomb.cs プロジェクト: Yoann-Yarb/BombEISTIv2
        public void Explode(Map m, Game g)
        {
            var toBeDestroyed = new List<Entity>();
            var thecompletelist = m.GetCompleteList();
            m.ListOfBomb.Remove(this);
            var l = thecompletelist.Where(c => c.X == this.X || c.Y == this.Y);
            var theRightDestroyed = this.GiveTheFirst(l, Direction.Right);
            if (theRightDestroyed != null && !g.ToDelete.Contains(theRightDestroyed))
            {
                toBeDestroyed.Add(theRightDestroyed);
            }
            var theLeftDestroyed = this.GiveTheFirst(l, Direction.Left);
            if (theLeftDestroyed != null && !g.ToDelete.Contains(theLeftDestroyed))
            {
                toBeDestroyed.Add(theLeftDestroyed);
            }
            var theUpDestroyed = this.GiveTheFirst(l, Direction.Up);
            if (theUpDestroyed != null && !g.ToDelete.Contains(theUpDestroyed))
            {
                toBeDestroyed.Add(theUpDestroyed);
            }
            var theDownDestroyed = this.GiveTheFirst(l, Direction.Down);
            if (theDownDestroyed != null && !g.ToDelete.Contains(theDownDestroyed))
            {
                toBeDestroyed.Add(theDownDestroyed);
            }

            foreach (var e in toBeDestroyed)
            {
                if (e is Bomb)
                {
                    var theBomb = m.ListOfBomb.First(c => c.X == e.X && c.Y == e.Y);
                    theBomb.Explode(m, g);
                }
            }
            g.ToDelete.AddRange(toBeDestroyed);
            if (!g.ToDelete.Contains(this))
            {
                g.ToDelete.Add(this);
            }
            Owner.BombExploded(this);
        }
コード例 #9
0
ファイル: Bomb.cs プロジェクト: SsSanzo/BombEISTIv2
        public bool Teleport(Map m)
        {
            if(itération < 3)
            {
                var list = m.GetCompleteList().ToList();
                var l = new List<HardBlock>();
                for (var i = 0; i < Game.Length; i++)
                {
                    for (var j = 0; j < Game.Length; j++)
                    {
                        if (list.FirstOrDefault(c => c != null && c.X == i && c.Y == j) == null)
                        {
                            Texture._.Mw.Dispatcher.Invoke(DispatcherPriority.Normal,
                                                       (Action)(() => l.Add(new HardBlock(i, j))));
                        }
                    }
                }

                if (l == null || l.Count() == 0) return true;
                var rand = new Random();
                var n = rand.Next(l.Count);
                this.X = l.ElementAt(n).X;
                this.Y = l.ElementAt(n).Y;
                Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, new Action((reloadTickLeft)));
                Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, new Action((reloadTickTop)));
                itération++;
                return true;
            }
            return false;
        }