コード例 #1
0
ファイル: Key.cs プロジェクト: TheThing/Shooter
        public void Interact(UnitPlayer player)
        {
            player.Inventory.Add(this);
            player.UpdateHeader();
            Console.SetCursorPosition(this.Index % Game.MainGame.Board.MaxWidth, this.Index / Game.MainGame.Board.MaxWidth);
            Console.Write(" ");

            Game.MainGame.Board.Tiles[this.Index] = -1;
            Game.MainGame.Board.SpecialTiles[Game.MainGame.Board.SpecialTiles.IndexOf(this)] = null;
            this.Index = -1;
        }
コード例 #2
0
ファイル: Door.cs プロジェクト: TheThing/Shooter
        public void Interact(UnitPlayer player)
        {
            if (_locked)
            {
                for (int i = 0; i < player.Inventory.Count; i++)
                    if (player.Inventory[i] is Key)
                    {
                        player.Inventory.RemoveAt(i);
                        player.UpdateHeader();
                        this._locked = false;
                        this.Interact(player);
                        break;
                    }
                return;
            }
            int x = this.Index % Game.MainGame.Board.MaxWidth, y = this.Index / Game.MainGame.Board.MaxWidth;
            this.Clear();

            CheckForDoor(x - 1, y, player);
            CheckForDoor(x + 1, y, player);
            CheckForDoor(x, y - 1, player);
            CheckForDoor(x, y + 1, player);
        }
コード例 #3
0
ファイル: Gun.cs プロジェクト: TheThing/Shooter
        public void Interact(UnitPlayer player)
        {
            this.Clear();

            Console.SetCursorPosition(_lastX, _lastY);
            Console.Write(" ");
            _lastX = _lastY = -1;

            if (player.Guns.Count > 0)
                for (int i = 0; i < player.Guns.Count; i++)
                    if (player.Guns[i].Name == this.Name)
                    {
                        player.Guns[i].Ammo += this.Ammo;
                        player.UpdateHeader();
                        return;
                    }
            player.Guns.Add(this);
            this.Owner = player;
            player.UpdateHeader();
        }