Пример #1
0
    public void HandleTrainer()
    {
        //swap pokemon
        if (!click && !pokemonActive)
        {
            Pokemon oldPokemonSelection = pokemon;

            for (int i = 1; i <= trainer.party.Count(); i++)
            {
                if (Rebind.GetInputDown("SELECT_POKE_PARTY_" + i))
                {
                    trainer.party.Select(i - 1);
                }
            }

            if (Rebind.GetInputDown("SELECT_POKE_PREV"))
            {
                trainer.party.SelectPrev();
            }
            else if (Rebind.GetInputDown("SELECT_POKE_NEXT"))
            {
                trainer.party.SelectNext();
            }

            if (oldPokemonSelection != pokemon)
            {
                click = true;
                if (oldPokemonSelection.obj != null)
                {
                    oldPokemonSelection.obj.Return();
                    trainer.ThrowPokemon(pokemon);
                }
            }
        }

        var itemsCount = trainer.inventory.items.Count;

        //throw pokemon
        if (!click && Input.GetKey(KeyCode.Return))
        {
            if (pokemon != null && pokemon.obj == null)
            {
                trainer.ThrowPokemon(pokemon);
            }
            else
            {
                if (pokemonActive)
                {
                    pokemon.obj.Return();
                    pokemonActive = false;
                }
                else
                {
                    pokemonActive = true;
                }
            }
            click = true;
        }

        //activate menu
        if (Input.GetKeyDown(KeyCode.Escape) && !click)
        {
            if (pokemonActive)
            {
                pokemonActive = false;
            }
            else
            {
                GameGUI.menuActive = !GameGUI.menuActive;
            }
            click = true;
        }

        //hides or reveals the stats(Data) popup on press of k
        if (Input.GetKeyDown(KeyCode.K) && !GameGUI.menuActive)
        {
            if (!pokemonActive)
            {
                GameGUI.dataWindow = !GameGUI.dataWindow;
            }
        }

        //capture pokemon
        if (Input.GetKeyDown("c"))
        {
            GameGUI gamegui = GetComponent <GameGUI>();
            CapturePokemon();
            click = true;
        }

        //chat window
        if (Input.GetKeyDown("i"))
        {
            if (GameGUI.chatActive)
            {
                GameGUI.chatActive = false;
            }
            else
            {
                GameGUI.chatActive = true;
            }

            click = true;
        }

        if (Input.GetKeyDown("h"))
        {
            PokeCenter.HealPokemon();
        }

        /*
         * don't try using this right now, because it doesn't exist!
         * if (Input.GetKeyDown ("k")) {
         *      Populate okasf = new Populate();
         *      okasf.Test();
         * }
         */
        //anticlick
        bool anti = false;

        for (int i = 1; i <= 10 && !anti; i++)
        {
            if (Rebind.GetInput("SELECT_POKE_PARTY_" + i))
            {
                anti = true;
            }
        }
    }
Пример #2
0
    public void HandleTrainer()
    {
        //swap pokemon
        if (!click && !pokemonActive)
        {
            Pokemon oldPokemonSelection = pokemon;

            for (int i = 1; i <= trainer.party.Count(); i++)
            {
                if (Rebind.GetInputDown("SELECT_POKE_PARTY_" + i))
                {
                    trainer.party.Select(i - 1);
                }
            }

            if (Rebind.GetInputDown("SELECT_POKE_PREV"))
            {
                trainer.party.SelectPrev();
            }
            else if (Rebind.GetInputDown("SELECT_POKE_NEXT"))
            {
                trainer.party.SelectNext();
            }

            if (oldPokemonSelection != pokemon)
            {
                click = true;
                if (oldPokemonSelection.obj != null)
                {
                    oldPokemonSelection.obj.Return();
                    trainer.ThrowPokemon(pokemon);
                }
            }
        }

        var itemsCount = trainer.inventory.items.Count;

        //throw pokemon
        if (!click && Input.GetKey(KeyCode.Return))
        {
            //Swap above line for this one if you need to break the code to work without RebindInspector.
            //Suspect errors with Player.click, but haven't really investigated.
            //if (Input.GetKey(KeyCode.Return)){
            if (pokemon != null && pokemon.obj == null)
            {
                trainer.ThrowPokemon(pokemon);
            }
            else
            {
                if (pokemonActive)
                {
                    pokemon.obj.Return();
                    pokemonActive = false;
                }
                else
                {
                    pokemonActive = true;
                }
            }
            click = true;
        }

        //activate menu
        if (Input.GetKeyDown(KeyCode.Escape) && !click)
        {
            if (pokemonActive)
            {
                pokemonActive = false;
            }
            else
            {
                GameGUI.menuActive = !GameGUI.menuActive;
            }
            click = true;
        }

        //hides or reveals the stats(Data) popup on press of k
        if (Input.GetKeyDown(KeyCode.K) && !GameGUI.menuActive)
        {
            if (!pokemonActive)
            {
                GameGUI.dataWindow = !GameGUI.dataWindow;
            }
        }

        /*
         * don't try using this right now, because it doesn't exist!
         * if (Input.GetKeyDown ("k")) {
         *      Populate okasf = new Populate();
         *      okasf.Test();
         * }
         */
        //anticlick
        bool anti = false;

        for (int i = 1; i <= 10 && !anti; i++)
        {
            if (Rebind.GetInput("SELECT_POKE_PARTY_" + i))
            {
                anti = true;
            }
        }
    }