// Use this for initialization
 void Start()
 {
     playfield = FindObjectOfType<PlayField>();
     phys = this.gameObject.GetComponent<Rigidbody2D>();
     phys.AddForce(InitVel);
     Debug.Log("starting");
     addedSpeed = 1;
 }
Example #2
0
 protected override void LoadContent()
 {
     spriteBatch = new SpriteBatch(GraphicsDevice);
     level.LoadMap(Content);
     playField = level.GetPlayField();
     player    = new Cat(level.GetPlayerPosition(), Direction.Right);
     player.Load(Content, playField);
     enemyController = new GhostController(level.GetGhostCoordinates());
     enemyController.LoadAll(Content, playField);
     camera = new Camera(GraphicsDevice.Viewport);
 }
Example #3
0
        public void TestMovePlayerOnCorrectPosition()
        {
            IPlayField playField = new PlayField(new PlayFldGen(new Position(1, 1)), new Position(1, 1));

            playField.InitializePlayFieldCells(RandomNumberGenerator.Instance);
            IPlayer player = new Player("Test", playField.GetCell(new Position(1, 1)));

            playField.RemovePlayer(player);
            playField.AddPlayer(player, new Position(1, 2));

            Assert.AreEqual(player.CurentCell.Position.Row, playField.PlayerPosition.Row);
            Assert.AreEqual(player.CurentCell.Position.Column, playField.PlayerPosition.Column);
        }
Example #4
0
    public void OnPointerEnter(PointerEventData eventData)
    {
        playField = GetComponentInParent <PlayField>(); // Getting the field where the card is currently placed

        if (!cardDrop.inField && playField.fieldTipe != FieldTipe.ENEMY_HAND && playField.fieldTipe != FieldTipe.ENEMY_FIELD)
        {
            DefaultPosition = transform.position; // Getting the initial position of the card in the player's hand

            moveUp = true;

            cardAnimator.SetBool("IsMouseOver", true); // Starting a map view animation
        }
    }
Example #5
0
        public void TestMovePlayerOnIncorrectPositionShouldThrow()
        {
            PlayFldGen generator = new PlayFldGen(new Position(1, 1));

            IPlayField playField = new PlayField(generator, new Position(1, 1));

            playField.InitializePlayFieldCells(RandomNumberGenerator.Instance);

            generator.ChangeCellAtPosition(new Position(1, 2), Constants.StandardGameCellWallValue);

            IPlayer player = new Player("Test", playField.GetCell(new Position(1, 1)));

            playField.RemovePlayer(player);
            playField.AddPlayer(player, new Position(1, 2));
        }
Example #6
0
        } // constructor

        public void Launch()
        {
            WriteLine($"Thank you for choosing to play, {Player.Name}.\n" +
                      $"You have paid your buy-in and received 50 chips.\n");
            do
            {
                if (!PlayField.TimeForShowdown())
                {
                    PlayRound();
                }
                else
                {
                    PlayField.ShowDown();
                } // if (!PlayField.TimeForShowdown())
            } while (Continue);
        }         // method Launch
Example #7
0
 void OnSceneLoaded(Scene scene, LoadSceneMode mode)
 {
     if (scene.buildIndex == GameConstants.SCENE_INDEX_GAME_COMMANDERS)
     {
         BuildDeck();
         ShuffleDeck(player1Deck);
         if (!GlobalObject.storyEnabled)
         {
             ShuffleDeck(player2Deck);
         }
         globalObject = GameObject.FindObjectOfType <GlobalObject>();
         playField    = GameObject.FindObjectOfType <PlayField>();
         aiManager    = GameObject.FindObjectOfType <AiManager>();
         if (GlobalObject.instance.useCommanders)
         {
             //TODO - may need to load specific assets here - DECK START BATTLE
         }
     }
 }
Example #8
0
 public override void EventUnitSummoned(object sender, EventArgs e, int playerId, Hero summonedHero)
 {
     //if summoned unit has the same owning player as this soldier
     if (this.playerId == playerId)
     {
         //Then check if it was summoned in a cardinal direction to this hero (adjacent)
         PlayField        playField      = FindObjectOfType <PlayField>();
         List <Transform> adjacentAllies = playField.AdjacencyCheckCardinalDirections(this.GetComponent <Transform>(), "ally");
         foreach (Transform t in adjacentAllies)
         {
             if (t == summonedHero.GetComponent <Transform>())
             {
                 this.power += 1;
                 //TODO: Replace this with other particle
                 GameObject spawnedParticle = Instantiate(dodgeParticleGameObject, this.GetComponent <Transform>().position, Quaternion.identity);
                 break;
             }
         }
     }
 }
Example #9
0
        public void TestScoreCommandCorrect()
        {
            IPlayFieldGenerator pg      = new PlayFieldGenerator();
            IPlayField          playFld = new PlayField(pg, new Position(1, 1), 3, 3);

            playFld.InitializePlayFieldCells(RandomNumberGenerator.Instance);
            Mock <IRenderer>    mockRenderer   = new Mock <IRenderer>();
            IMementoCaretaker   mockMemento    = new MementoCaretaker(new List <IMemento>());
            Mock <IScoreLadder> mockScoreLader = new Mock <IScoreLadder>();
            IPlayer             player         = new Player("Test", new Cell(new Position(1, 1), Constants.StandardGamePlayerChar));

            ICommandContext cmdContext = new CommandContext(playFld, mockRenderer.Object, mockMemento, mockScoreLader.Object, player);

            ICommandFactory factory = new SimpleCommandFactory();
            ICommand        command = factory.CreateCommand("top");

            command.Execute(cmdContext);

            mockRenderer.Verify(x => x.ShowScoreLadder(It.IsAny <IScoreLadderContentProvider>()), Times.Once);
        }
Example #10
0
    //When summoned, this soldier will grant the player 1 Magic per adjacent unit
    public override void OnSpawnEffects()
    {
        //Check to see how many allies are adjacent to the grid square that this soldier was summoned
        PlayField        playField      = FindObjectOfType <PlayField>();
        List <Transform> adjacentAllies = playField.AdjacencyCheckCardinalDirections(this.GetComponent <Transform>(), "ally");
        int magicIncrease = 0;

        foreach (Transform t in adjacentAllies)
        {
            magicIncrease++;
        }

        if (magicIncrease > 0)
        {
            //Adjacent allies were present so call method on playField to update the summoner's magic and UI
            playField.ModifyMana(magicIncrease, this.playerId);
            //TODO: Add specific particle here. Should also do some kind of visual flourish on magic number increasing
            GameObject spawnedParticle = Instantiate(dodgeParticleGameObject, this.GetComponent <Transform>().position, Quaternion.identity);
        }
    }
Example #11
0
    bool isValidGridPos()
    {
        foreach (Transform child in transform)
        {
            Vector2 v = PlayField.roundVec2(child.position);


            if (!PlayField.insideBorder(v))
            {
                return(false);
            }


            if (PlayField.grid[(int)v.x, (int)v.y] != null &&
                PlayField.grid[(int)v.x, (int)v.y].parent != transform)
            {
                return(false);
            }
        }
        return(true);
    }
Example #12
0
        public void TestMoveRightCommandCorrect()
        {
            IPlayFieldGenerator pg      = new PlayFieldGenerator();
            IPlayField          playFld = new PlayField(pg, new Position(1, 1), 3, 3);

            playFld.InitializePlayFieldCells(RandomNumberGenerator.Instance);
            Mock <IRenderer>    mockRenderer   = new Mock <IRenderer>();
            IMementoCaretaker   mockMemento    = new MementoCaretaker(new List <IMemento>());
            Mock <IScoreLadder> mockScoreLader = new Mock <IScoreLadder>();
            IPlayer             player         = new Player("Test", new Cell(new Position(1, 1), Constants.StandardGamePlayerChar));

            ICommandContext cmdContext = new CommandContext(playFld, mockRenderer.Object, mockMemento, mockScoreLader.Object, player);

            ICommandFactory factory = new SimpleCommandFactory();
            ICommand        command = factory.CreateCommand("r");

            command.Execute(cmdContext);

            Assert.AreEqual(1, player.CurentCell.Position.Row);
            Assert.AreEqual(2, player.CurentCell.Position.Column);
        }
Example #13
0
        public Singleplayer()
        {
            playfield  = new PlayField();
            ball       = new Ball();
            paddle     = new Paddle();
            scoreboard = new ScoreBoard();

            timer           = new DispatcherTimer();
            timer.Interval  = new TimeSpan(0, 0, 0, 0, 10);
            timer.IsEnabled = false;
            timer.Tick     += timer_Tick;

            StartCommand      = new StartCommand(this);
            StopCommand       = new StopCommand(this);
            PlayCommand       = new PlayCommand(this);
            PauseCommand      = new PauseCommand(this);
            MoveLeftCommand   = new MoveLeftCommand(this);
            MoveRightCommand  = new MoveRightCommand(this);
            StopMovingCommand = new StopMovingCommand(this);

            InitializeGame();
        }
Example #14
0
    //public string prefabPath = "";

    void Awake()
    {
        deck        = FindObjectOfType <Deck>();
        buffManager = FindObjectOfType <BuffManager>();
        player1     = GameObject.Find("player1");
        player2     = GameObject.Find("player2");
        //Debug.Log("Running Awake() function for: " + cardName);
        playField = FindObjectOfType <PlayField>();

        //Need to set all of this in Awake() and NOT Start() or else on the NPC's first turn the stats don't get set in time before the NPC spawns their first hero for some reason
        ManaCost.text        = manaCost.ToString();
        NameText.text        = cardName.ToString();
        DescriptionText.text = cardDescription.ToString();
        if (type == "hero" || type == "heroStationary")
        {
            //Set text values on the card
            PowerText.text  = power.ToString();
            HealthText.text = maxHealth.ToString();
            SpeedText.text  = speed.ToString();
            RangeText.text  = range.ToString();
        }
    }
Example #15
0
    public Decision Decide(Vector2 position, float heading, PlayField playField, float energy, float age, float foodBearing, float foodDistance, float foodEnergy, List <Peer> peers)
    {
//		StandardInputNeurons[0].SubmitInput(HTan.getHTan(position.x));
//		StandardInputNeurons[1].SubmitInput(HTan.getHTan(position.y));
//		StandardInputNeurons[2].SubmitInput(HTan.getHTan(heading));
//		StandardInputNeurons[3].SubmitInput(HTan.getHTan(playField.NorthBorder));
//		StandardInputNeurons[4].SubmitInput(HTan.getHTan(playField.SouthBorder));
//		StandardInputNeurons[5].SubmitInput(HTan.getHTan(playField.EastBorder));
//		StandardInputNeurons[6].SubmitInput(HTan.getHTan(playField.WestBorder));
//		StandardInputNeurons[7].SubmitInput(HTan.getHTan(energy));
//		StandardInputNeurons[8].SubmitInput(HTan.getHTan(age));
        StandardInputNeurons[0].SubmitInput(HTan.getHTan(foodBearing));
        StandardInputNeurons[1].SubmitInput(HTan.getHTan(foodDistance));
//		StandardInputNeurons[5].SubmitInput(HTan.getHTan(foodEnergy));

//		for(int i = 0; i < PeerInputNeurons.Count; i++)
//		{
//			PeerInputNeurons[1].HeadingInputNeuron.SubmitInput(HTan.getHTan(peers[i].Heading));
//			PeerInputNeurons[1].BearingInputNeuron.SubmitInput(HTan.getHTan(peers[i].Bearing));
//			PeerInputNeurons[1].DistanceInputNeuron.SubmitInput(HTan.getHTan(peers[i].Distance));
//			PeerInputNeurons[1].EnergyInputNeuron.SubmitInput(HTan.getHTan(peers[i].Energy));
//		}

        foreach (Neuron neuron in StandardInputNeurons)
        {
            neuron.SendOutput();
        }

//		foreach(PeerInputNeuronSet neuronSet in PeerInputNeurons)
//		{
//			neuronSet.HeadingInputNeuron.SendOutput();
//			neuronSet.BearingInputNeuron.SendOutput();
//			neuronSet.DistanceInputNeuron.SendOutput();
//			neuronSet.EnergyInputNeuron.SendOutput();
//		}

        return(new Decision(HTan.getHTan(TurnEffortOutputNeuron.ExtractOutput()), HTan.getHTan(MoveEffortOutputNeuron.ExtractOutput())));
    }
Example #16
0
    void updateGrid()
    {
        for (int y = 0; y < PlayField.h; ++y)
        {
            for (int x = 0; x < PlayField.w; ++x)
            {
                if (PlayField.grid[x, y] != null)
                {
                    if (PlayField.grid[x, y].parent == transform)
                    {
                        PlayField.grid[x, y] = null;
                    }
                }
            }
        }


        foreach (Transform child in transform)
        {
            Vector2 v = PlayField.roundVec2(child.position);
            PlayField.grid[(int)v.x, (int)v.y] = child;
        }
    }
Example #17
0
        } // method DeclareWinner

        private void PlayRound()
        {
            Player outOfChips = PlayField.AnyPlayerOutOfChips();

            if (outOfChips == null)
            {
                PlayField.DealRound();
                PlayField.ShowTable();
                PokerAction chosenAction = ChooseAction();
                switch (chosenAction)
                {
                case PokerAction.Quit:
                    Continue = false;
                    break;

                case PokerAction.Bet:
                    TakePlayerBet();
                    break;

                case PokerAction.Check:
                    WriteLine("Checking this round, got it!");
                    break;

                case PokerAction.Fold:
                    WriteLine("Folding, Dealer wins");
                    PlayField.GivePotToWinner(ref PlayField.Dealer);
                    ResetHand();
                    break;
                } // switch (chosenAction)
                TakeDealerAction();
            }     // if (outOfChips == null)
            else
            {
                DeclareLoser(outOfChips);
            } // if (outOfChips == null)
        }     // method PlayRound
Example #18
0
        public void RemoveFromDB()
        {
            SqlWrapper Sql = new SqlWrapper();

            Sql.SqlDelete("DELETE FROM " + getSQLTablefromDynelType() + " WHERE ID=" + ID.ToString() + " AND playfield=" + PlayField.ToString());
            Sql.SqlDelete("DELETE FROM " + getSQLTablefromDynelType() + "inventory WHERE ID=" + ID.ToString() + " AND playfield=" + PlayField.ToString());
            Sql.SqlDelete("DELETE FROM " + getSQLTablefromDynelType() + "activenanos WHERE ID=" + ID.ToString() + " AND playfield=" + PlayField.ToString());
            Sql.SqlDelete("DELETE FROM " + getSQLTablefromDynelType() + "meshs WHERE ID=" + ID.ToString() + " AND playfield=" + PlayField.ToString());
            Sql.SqlDelete("DELETE FROM " + getSQLTablefromDynelType() + "timers WHERE ID=" + ID.ToString() + " AND playfield=" + PlayField.ToString());
            Sql.SqlDelete("DELETE FROM " + getSQLTablefromDynelType() + "waypoints WHERE ID=" + ID.ToString() + " AND playfield=" + PlayField.ToString());
            Sql.SqlDelete("DELETE FROM " + getSQLTablefromDynelType() + "weaponpairs WHERE ID=" + ID.ToString() + " AND playfield=" + PlayField.ToString());
            Sql.SqlDelete("DELETE FROM " + getSQLTablefromDynelType() + "_stats WHERE ID=" + ID.ToString() + " AND playfield=" + PlayField.ToString());
        }
Example #19
0
        public new void writeCoordinatestoSQL()
        {
            SqlWrapper Sql = new SqlWrapper();

            Sql.SqlUpdate("UPDATE " + getSQLTablefromDynelType() + " SET playfield=" + PlayField.ToString() + ", X=" +
                          String.Format(System.Globalization.CultureInfo.InvariantCulture, "'{0}'", Coordinates.x) + ", Y=" +
                          String.Format(System.Globalization.CultureInfo.InvariantCulture, "'{0}'", Coordinates.y) + ", Z=" +
                          String.Format(System.Globalization.CultureInfo.InvariantCulture, "'{0}'", Coordinates.z) + " WHERE ID=" + ID.ToString() + ";");
        }
Example #20
0
        public void readMeshsfromSQL()
        {
            SqlWrapper Sql = new SqlWrapper();

            Meshs.Clear();
            AOMeshs   m_m;
            DataTable dt = Sql.ReadDT("SELECT * from " + getSQLTablefromDynelType() + "meshs WHERE ID=" + ID.ToString() + " AND playfield=" + PlayField.ToString());

            foreach (DataRow row in dt.Rows)
            {
                m_m                 = new AOMeshs();
                m_m.Position        = (Int32)row["meshvalue1"];
                m_m.Mesh            = (Int32)row["meshvalue2"];
                m_m.OverrideTexture = (Int32)row["meshvalue3"];
            }
        }
Example #21
0
        public void AddToDB()
        {
            SqlWrapper Sql = new SqlWrapper();

            Sql.SqlInsert("INSERT INTO " + getSQLTablefromDynelType() + " (ID, Playfield) VALUES (" + ID.ToString() + "," + PlayField.ToString() + ")");
            writeCoordinatestoSQL();
            writeHeadingtoSQL();
            writeMainStatstoSQL();

            WriteStats();
            writeInventorytoSQL();
            writeNanostoSQL();
            writeWaypointstoSQL();
            writeWeaponpairstoSQL();
            writeMeshstoSQL();
        }
Example #22
0
        public void readWeaponpairsfromSQL()
        {
            AOWeaponpairs m_wp;
            SqlWrapper    Sql = new SqlWrapper();

            Weaponpairs.Clear();
            DataTable dt = Sql.ReadDT("SELECT * FROM " + getSQLTablefromDynelType() + "weaponpairs WHERE ID=" + ID.ToString() + " AND playfield=" + PlayField.ToString());

            foreach (DataRow row in dt.Rows)
            {
                m_wp        = new AOWeaponpairs();
                m_wp.value1 = (Int32)row["value1"];
                m_wp.value2 = (Int32)row["value2"];
                m_wp.value3 = (Int32)row["value3"];
                m_wp.value4 = (Int32)row["value4"];
                Weaponpairs.Add(m_wp);
            }
        }
Example #23
0
        public void writeMeshstoSQL()
        {
            SqlWrapper Sql = new SqlWrapper();

            Sql.SqlDelete("DELETE FROM " + getSQLTablefromDynelType() + "meshs WHERE ID=" + ID.ToString() + " AND playfield=" + PlayField.ToString());
            int c;

            for (c = 0; c < Meshs.Count; c++)
            {
                Sql.SqlInsert("INSERT INTO " + getSQLTablefromDynelType() + "meshs VALUES (" + ID.ToString() + "," + PlayField.ToString() + "," + Meshs[c].Position.ToString() + "," + Meshs[c].Mesh.ToString() + "," + Meshs[c].OverrideTexture.ToString() + ")");
            }
        }
Example #24
0
		private PlayField(PlayField playField)
		{
			cell = (FieldCell[,]) playField.cell.Clone();
		}
Example #25
0
 void Start()
 {
     playField = GetComponent <PlayField>();
 }
Example #26
0
        // New one with id AND playfield as filter
        public new void readTexturesfromSQL()
        {
            SqlWrapper ms = new SqlWrapper();
            AOTextures m_tex;

            Textures.Clear();

            DataTable dt = ms.ReadDT("SELECT textures0, textures1, textures2, textures3, textures4 from " + getSQLTablefromDynelType() + " WHERE ID=" + ID.ToString() + " AND playfield=" + PlayField.ToString());

            if (dt.Rows.Count > 0)
            {
                m_tex = new AOTextures(0, (Int32)dt.Rows[0]["textures0"]);
                Textures.Add(m_tex);

                m_tex = new AOTextures(1, (Int32)dt.Rows[0]["textures1"]);
                Textures.Add(m_tex);

                m_tex = new AOTextures(2, (Int32)dt.Rows[0]["textures2"]);
                Textures.Add(m_tex);

                m_tex = new AOTextures(3, (Int32)dt.Rows[0]["textures3"]);
                Textures.Add(m_tex);

                m_tex = new AOTextures(4, (Int32)dt.Rows[0]["textures4"]);
                Textures.Add(m_tex);
            }
        }
Example #27
0
    void OnMouseOver()
    {
        if (!PlayField.gameOver)
        {
            if (Input.GetMouseButtonDown(0) && GetComponent <SpriteRenderer>().sprite.texture.name == "default")
            {
                // It's a mine
                if (mine)
                {
                    PlayField.status = "Boom!";
                    // uncover all mines
                    PlayField.uncoverMines();

                    // game over
                    PlayField.gameOver = true;
                    print("you lose");
                }
                // It's not a mine
                else
                {
                    PlayField.status = "Empty";
                    // show adjacent mine number
                    int x = (int)transform.position.x;
                    int y = (int)transform.position.y;

                    // TODO: uncover area without mines
                    PlayField.FFuncover(x, y, new bool[PlayField.w, PlayField.h]);

                    // find out if the game was won now
                    if (PlayField.isFinished() && !(PlayField.isOpened))
                    {
                        print("you win");
                        PlayField.score   += 1;
                        PlayField.status   = "Clear!";
                        PlayField.isOpened = true;
                    }
                }
            }
            else if (Input.GetMouseButtonDown(0) && GetComponent <SpriteRenderer>().sprite.texture.name == "flag")
            {
                // Do nothing
            }
            else if (Input.GetMouseButtonDown(0))
            {
                // Logic for left clicking number
                int x = (int)transform.position.x;
                int y = (int)transform.position.y;
                PlayField.Chord(x, y);

                if (PlayField.isFinished() && !(PlayField.isOpened))
                {
                    print("you win");
                    PlayField.score   += 1;
                    PlayField.status   = "Clear!";
                    PlayField.isOpened = true;
                }
            }
            if (Input.GetMouseButtonDown(1))
            {
                ToggleFlag();
            }
        }
    }
 // Use this for initialization
 void Start()
 {
     playfield = FindObjectOfType<PlayField>();
     text = GetComponent<Text>();
 }
        //The Main Menu of the Game
        private static void Menu()
        {
            Methods.Settings(PLAYFIELDWIDTH, PLAYFIELDHIGHT);
            Methods.DrawMenu(player.Name, gameoverFlag);
            bool isCommand = false;

            while (!isCommand)
            {
                ConsoleKeyInfo keyPressed = Console.ReadKey(true);
                switch (keyPressed.Key)
                {
                //Load a new game
                case ConsoleKey.N:
                {
                    gameoverFlag = false;
                    player       = new Player(Methods.LoadPlayer(), 0);
                    Console.Clear();
                    Console.SetWindowSize(PLAYFIELDWIDTH + 7, PLAYFIELDHIGHT);
                    Console.SetBufferSize(PLAYFIELDWIDTH + 7, PLAYFIELDHIGHT);
                    playField = new PlayField();
                    playField.InitPlayField(CHARBASE);
                    playField.DrawPlayField();
                    Methods.Settings(PLAYFIELDWIDTH, PLAYFIELDHIGHT);
                    Methods.VisualizeSound(soundflag);
                    FallDownAndGenerateNewJewels();
                    Methods.ScoreField(SCOREFIELDWIDTH, SCOREFIELDHIGHT, player);

                    //Draw a progress bar showing how near is the maximum score
                    Methods.DrawProgress(player.Score, MAXSCORE, PROGRESSBARWIDTH, PROGRESSBARHIGHT);

                    escapeFlag = 0;
                    Engine();
                    isCommand = true;
                } break;

                //Return to the game or go to the Menu
                case ConsoleKey.Escape:
                {
                    if ((player.Name != "") && !gameoverFlag)
                    {
                        if (escapeFlag == 0)
                        {
                            Console.Clear();
                            Console.SetWindowSize(PLAYFIELDWIDTH + 7, PLAYFIELDHIGHT);
                            Console.SetBufferSize(PLAYFIELDWIDTH + 7, PLAYFIELDHIGHT);
                            playField.DrawPlayField();
                            Methods.Settings(PLAYFIELDWIDTH, PLAYFIELDHIGHT);
                            Methods.ScoreField(SCOREFIELDWIDTH, SCOREFIELDHIGHT, player);

                            //Draw a progress bar showing how near is the maximum score
                            Methods.DrawProgress(player.Score, MAXSCORE, PROGRESSBARWIDTH, PROGRESSBARHIGHT);

                            Engine();
                            escapeFlag = 1;
                        }
                        else
                        {
                            escapeFlag = 0;
                            Menu();
                        }
                        isCommand = true;
                    }
                }; break;

                //Save the game in a file
                case ConsoleKey.S:
                {
                    if ((player.Name != "") && !gameoverFlag)
                    {
                        Methods.SaveHighestScores(HIGHSCOREFILEPATH, player, TOPSCORECOUNT);
                        Methods.SaveGame(GAMEFILEPATH, playField, player);

                        string saveMessage = "The Game has been saved!";
                        Console.SetCursorPosition((Console.WindowWidth - saveMessage.Length) / 2, Console.WindowHeight - 2);
                        Console.ForegroundColor = ConsoleColor.DarkRed;
                        Console.WriteLine(saveMessage);
                    }
                    isCommand = false;
                }; break;

                //Load a game from a file
                case ConsoleKey.L:
                {
                    gameoverFlag = false;
                    Console.Clear();
                    Console.SetWindowSize(PLAYFIELDWIDTH + 7, PLAYFIELDHIGHT);
                    Console.SetBufferSize(PLAYFIELDWIDTH + 7, PLAYFIELDHIGHT);
                    playField = new PlayField();
                    Methods.LoadGame(GAMEFILEPATH, playField, player);
                    playField.DrawPlayField();
                    Methods.Settings(PLAYFIELDWIDTH, PLAYFIELDHIGHT);
                    Methods.ScoreField(SCOREFIELDWIDTH, SCOREFIELDHIGHT, player);
                    Methods.VisualizeSound(soundflag);

                    //Draw a progress bar showing how near is the maximum score
                    Methods.DrawProgress(player.Score, MAXSCORE, PROGRESSBARWIDTH, PROGRESSBARHIGHT);

                    escapeFlag = 0;
                    Engine();
                    isCommand = true;
                }; break;

                case ConsoleKey.T:
                {
                    topscoreFlag = true;
                    Methods.ShowTopScores(HIGHSCOREFILEPATH);
                    Engine();
                    //MessageBox.Show(message, "TOP SCORES!!!", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly);
                }; break;

                //Quit the game
                case ConsoleKey.Q:
                {
                    Environment.Exit(0);
                    isCommand = true;
                }; break;

                default:
                {
                    isCommand = false;
                };
                    break;
                }
            }
        }
Example #30
0
 void Awake()
 {
     instance = this;
 }
Example #31
0
        public void writeWaypointstoSQL()
        {
            SqlWrapper ms = new SqlWrapper();
            int        count;

            ms.SqlDelete("DELETE FROM " + getSQLTablefromDynelType() + "waypoints WHERE ID=" + ID.ToString());

            for (count = 0; count < Waypoints.Count; count++)
            {
                ms.SqlInsert("INSERT INTO " + getSQLTablefromDynelType() + "waypoints VALUES (" + ID.ToString() + "," + PlayField.ToString() + ","
                             + String.Format(System.Globalization.CultureInfo.InvariantCulture, "'{0}'", Waypoints[count].x) + ","
                             + String.Format(System.Globalization.CultureInfo.InvariantCulture, "'{0}'", Waypoints[count].y) + ","
                             + String.Format(System.Globalization.CultureInfo.InvariantCulture, "'{0}'", Waypoints[count].z) + ")");
            }
            if (Waypoints.Count > 0)
            {
            }
        }
Example #32
0
        public new void AddToDB()
        {
            SqlWrapper Sql = new SqlWrapper();

            Sql.SqlInsert("INSERT INTO " + getSQLTablefromDynelType() + " (ID, Playfield) VALUES (" + ID.ToString() + "," + PlayField.ToString() + ")");
            writeCoordinatestoSQL();
            writeHeadingtoSQL();
            Sql.SqlUpdate("UPDATE " + getSQLTablefromDynelType() + " SET TemplateID=" + TemplateID.ToString() + ", Hash='" + HASH + "' WHERE ID=" + ID.ToString() + " AND playfield=" + PlayField.ToString());
        }
Example #33
0
        public void writeWeaponpairstoSQL()
        {
            SqlWrapper Sql = new SqlWrapper();

            Sql.SqlDelete("DELETE FROM " + getSQLTablefromDynelType() + "weaponpairs WHERE ID=" + ID.ToString() + " AND playfield=" + PlayField.ToString() + ";");
            int c;

            for (c = 0; c < Weaponpairs.Count; c++)
            {
                Sql.SqlInsert("INSERT INTO " + getSQLTablefromDynelType() + "weaponpairs VALUES (" + ID.ToString() + "," + PlayField.ToString() + "," + Weaponpairs[c].value1.ToString() + "," + Weaponpairs[c].value2.ToString() + "," + Weaponpairs[c].value3.ToString() + "," + Weaponpairs[c].value4.ToString() + ");");
            }
        }
Example #34
0
 // Use this for initialization
 void Start()
 {
     playField = FindObjectOfType <PlayField>();
     deck      = FindObjectOfType <Deck>();
 }