public override void SetPokemon(PokemonInstance pokemon)
        {
            if (pokemon != null)
            {
                textSpeciesName.text   = pokemon.species.name;
                textSpeciesNumber.text = pokemon.species.id.ToString();

                textAbilityName.text = ""; //TODO - once abilities made, set ability name text to ability's name

                imageFront2.enabled = true;
                imageFront2.sprite  = pokemon.LoadSprite(PokemonSpecies.SpriteType.Front2);

                imageBack.enabled = true;
                imageBack.sprite  = pokemon.LoadSprite(PokemonSpecies.SpriteType.Back);
            }
            else
            {
                textSpeciesName.text   = "";
                textSpeciesNumber.text = "";

                textAbilityName.text = "";

                imageFront2.enabled = false;
                imageBack.enabled   = false;
            }
        }
        public void UpdateValues(PokemonInstance pokemon)
        {
            imageIcon.sprite = pokemon.LoadSprite(PokemonSpecies.SpriteType.Icon);
            textName.text    = pokemon.GetDisplayName();
            healthBar.UpdateBar(pokemon.HealthProportion);

            if (pokemon.nonVolatileStatusCondition == PokemonInstance.NonVolatileStatusCondition.None)
            {
                imageStatusCondition.gameObject.SetActive(false);
            }
            else
            {
                imageStatusCondition.gameObject.SetActive(true);
                imageStatusCondition.sprite = SpriteStorage.GetNonVolatileStatusConditionSprite(pokemon.nonVolatileStatusCondition);
            }

            if (pokemon.heldItem == null)
            {
                imageHeldItem.enabled = false;
            }
            else
            {
                imageHeldItem.enabled = true;
            }
        }
예제 #3
0
        public override void SetPokemon(PokemonInstance pokemon)
        {
            if (pokemon != null)
            {
                imagePokeBall.gameObject.SetActive(true);
                imagePokeBall.sprite = SpriteStorage.GetItemSprite(
                    PokeBall.GetPokeBallById(pokemon.pokeBallId)
                    .resourceName
                    );

                textName.text = pokemon.GetDisplayName();
                imageGender.gameObject.SetActive(true);
                imageGender.sprite = SpriteStorage.GetGenderSprite(pokemon.gender);

                imageFront.gameObject.SetActive(true);
                imageFront.sprite = pokemon.LoadSprite(PokemonSpecies.SpriteType.Front1);

                imageType1.gameObject.SetActive(true);
                imageType2.gameObject.SetActive(true);
                imageType1.sprite = SpriteStorage.GetTypeSymbolSprite(pokemon.species.type1);

                Type?pokemonType2 = pokemon.species.type2;
                if (pokemonType2 == null)
                {
                    imageType2.gameObject.SetActive(false);
                }
                else
                {
                    imageType2.gameObject.SetActive(true);
                    imageType2.sprite = SpriteStorage.GetTypeSymbolSprite((Type)pokemonType2);
                }

                imageCheatPokemon.gameObject.SetActive(pokemon.cheatPokemon);
                imageShinyPokemon.gameObject.SetActive(pokemon.IsShiny);
            }
            else
            {
                imageFront.gameObject.SetActive(false);

                imageType1.gameObject.SetActive(false);
                imageType2.gameObject.SetActive(false);

                imagePokeBall.gameObject.SetActive(false);

                textName.text = noPokemonPromptMessage;
                imageGender.gameObject.SetActive(false);

                imageCheatPokemon.gameObject.SetActive(false);
                imageShinyPokemon.gameObject.SetActive(false);
            }
        }
예제 #4
0
        public void SetPokemon(PokemonInstance pokemon)
        {
            if (pokemon != null)
            {
                iconImage.enabled = true;
                iconImage.sprite  = pokemon.LoadSprite(PokemonSpecies.SpriteType.Icon);

                if (pokemon.heldItem != null)
                {
                    heldItemIcon.enabled = true;
                }
                else
                {
                    heldItemIcon.enabled = false;
                }
            }
            else
            {
                iconImage.enabled    = false;
                heldItemIcon.enabled = false;
            }
        }
예제 #5
0
        public override void RefreshDetails(PokemonInstance pokemon)
        {
            imagePokeBall.sprite = SpriteStorage.GetItemSprite(
                PokeBall.GetPokeBallById(pokemon.pokeBallId)
                .resourceName
                );

            textName.text      = pokemon.GetDisplayName();
            imageGender.sprite = SpriteStorage.GetGenderSprite(pokemon.gender);

            textSpeciesName.text   = pokemon.species.name;
            textSpeciesNumber.text = pokemon.species.id.ToString();
            imageType1.sprite      = SpriteStorage.GetTypeSymbolSprite(pokemon.species.type1);

            imageFront.sprite = pokemon.LoadSprite(PokemonSpecies.SpriteType.Front1);

            Type?pokemonType2 = pokemon.species.type2;

            if (pokemonType2 == null)
            {
                imageType2.gameObject.SetActive(false);
            }
            else
            {
                imageType2.gameObject.SetActive(true);
                imageType2.sprite = SpriteStorage.GetTypeSymbolSprite((Type)pokemonType2);
            }

            textLevel.text = pokemon.GetLevel().ToString();

            textOriginalTrainer.text = pokemon.originalTrainerName;

            //TODO - once abilities made, set ability Text texts
            textAbilityName.text        = "";
            textAbilityDescription.text = "";

            imageCheatPokemon.gameObject.SetActive(pokemon.cheatPokemon);
            imageShinyPokemon.gameObject.SetActive(pokemon.IsShiny);
        }
        public void SetPokemon(PokemonInstance pokemon)
        {
            if (pokemon == null)
            {
                SetInteractable(false);
                return;
            }
            else
            {
                SetInteractable(true);
            }

            textName.text    = pokemon.GetDisplayName();
            textLevel.text   = levelTextPrefix + pokemon.GetLevel().ToString();
            imageIcon.sprite = pokemon.LoadSprite(PokemonSpecies.SpriteType.Icon);

            if (pokemon.nonVolatileStatusCondition == PokemonInstance.NonVolatileStatusCondition.None)
            {
                nvscImage.enabled = false;
            }
            else
            {
                nvscImage.enabled = true;
                nvscImage.sprite  = SpriteStorage.GetNonVolatileStatusConditionSprite(pokemon.nonVolatileStatusCondition);
            }

            if (pokemon.heldItem == null)
            {
                imageHeldItem.enabled = false;
            }
            else
            {
                imageHeldItem.enabled = true;
            }

            healthBar.UpdateBar(pokemon.HealthProportion);
        }
예제 #7
0
        public void SetPokemonDetails(PokemonInstance pokemon)
        {
            #region Images

            imageIcon.sprite  = pokemon.LoadSprite(PokemonSpecies.SpriteType.Icon);
            imageFront.sprite = pokemon.LoadSprite(PokemonSpecies.SpriteType.Front1);
            imageBack.sprite  = pokemon.LoadSprite(PokemonSpecies.SpriteType.Back);

            #endregion

            #region General Details

            imageType1.sprite = SpriteStorage.GetTypeSymbolSprite(pokemon.species.type1);

            Pokemon.Type?pokemonType2 = pokemon.species.type2;
            if (pokemonType2 == null)
            {
                imageType2.gameObject.SetActive(false);
            }
            else
            {
                imageType2.gameObject.SetActive(true);
                imageType2.sprite = SpriteStorage.GetTypeSymbolSprite((Pokemon.Type)pokemon.species.type2);
            }

            textName.text = pokemon.GetDisplayName();

            imageGender.sprite = pokemon.LoadGenderSprite();

            textLevelValue.text = pokemon.GetLevel().ToString();

            if (pokemon.heldItem != null)
            {
                textItemName.text     = pokemon.heldItem.itemName;
                imageItemIcon.enabled = true;
                imageItemIcon.sprite  = pokemon.heldItem.LoadSprite();
            }
            else
            {
                textItemName.text     = "No held item";
                imageItemIcon.enabled = false;
            }

            //TODO - set values for ability when and if implemented
            textAbilityName.text        = "";
            textAbilityDescription.text = "";

            if (pokemon.nonVolatileStatusCondition != PokemonInstance.NonVolatileStatusCondition.None)
            {
                imageStatusCondition.gameObject.SetActive(true);

                Sprite statusConditionSprite = SpriteStorage.GetNonVolatileStatusConditionSprite(pokemon.nonVolatileStatusCondition);
                if (statusConditionSprite != null)
                {
                    imageStatusCondition.gameObject.SetActive(true);
                    imageStatusCondition.sprite = statusConditionSprite;
                }
                else
                {
                    imageStatusCondition.gameObject.SetActive(false);
                }
            }
            else
            {
                imageStatusCondition.gameObject.SetActive(false);
            }

            imageCheatPokemon.gameObject.SetActive(pokemon.cheatPokemon);
            imageShinyPokemon.gameObject.SetActive(pokemon.IsShiny);

            #endregion

            #region Stats

            Pokemon.Stats <int> stats = pokemon.GetStats();

            textAttackValue.text         = stats.attack.ToString();
            textDefenseValue.text        = stats.defense.ToString();
            textSpecialAttackValue.text  = stats.specialAttack.ToString();
            textSpecialDefenseValue.text = stats.specialDefense.ToString();
            textSpeedValue.text          = stats.speed.ToString();
            healthBar.UpdateBar(pokemon.HealthProportion);

            #endregion
        }
예제 #8
0
        public void SetPokemon(PokemonInstance pokemon)
        {
            if (pokemon == null)
            {
                SetPokemonShownState(false);
            }
            else
            {
                SetPokemonShownState(true);

                textDisplayName.text = pokemon.GetDisplayName();
                imageGender.sprite   = pokemon.LoadGenderSprite();
                textLevel.text       = levelPrefix + pokemon.GetLevel().ToString();
                imageSprite.sprite   = pokemon.LoadSprite(PokemonSpecies.SpriteType.Front1);

                textSpeciesName.text   = pokemon.species.name;
                textSpeciesNumber.text = pokemon.species.id.ToString();
                imageType1.sprite      = SpriteStorage.GetTypeSymbolSprite(pokemon.species.type1);
                if (pokemon.species.type2 != null)
                {
                    imageType2.sprite = SpriteStorage.GetTypeSymbolSprite((Type)pokemon.species.type2);
                }
                else
                {
                    imageType2.enabled = false;
                }

                //This capitalises first letter of the nature's name
                textNature.text   = pokemon.nature.name[0].ToString().ToUpper() + pokemon.nature.name.Substring(1);
                textItemName.text = pokemon.heldItem != null ? pokemon.heldItem.itemName : "";

                textStatAttackValue.text         = pokemon.GetStats().attack.ToString();
                textStatDefenseValue.text        = pokemon.GetStats().defense.ToString();
                textStatSpecialAttackValue.text  = pokemon.GetStats().specialAttack.ToString();
                textStatSpecialDefenseValue.text = pokemon.GetStats().specialDefense.ToString();
                textStatSpeedValue.text          = pokemon.GetStats().speed.ToString();
                textStatHealthValue.text         = pokemon.GetStats().health.ToString();

                statHexEV.values = new float[]
                {
                    (float)pokemon.effortValues.attack / PokemonInstance.maximumEffortValue,
                    (float)pokemon.effortValues.defense / PokemonInstance.maximumEffortValue,
                    (float)pokemon.effortValues.specialAttack / PokemonInstance.maximumEffortValue,
                    (float)pokemon.effortValues.specialDefense / PokemonInstance.maximumEffortValue,
                    (float)pokemon.effortValues.speed / PokemonInstance.maximumEffortValue,
                    (float)pokemon.effortValues.health / PokemonInstance.maximumEffortValue
                };

                statHexIV.values = new float[]
                {
                    (float)pokemon.individualValues.attack / PokemonInstance.maximumIndividualValue,
                    (float)pokemon.individualValues.defense / PokemonInstance.maximumIndividualValue,
                    (float)pokemon.individualValues.specialAttack / PokemonInstance.maximumIndividualValue,
                    (float)pokemon.individualValues.specialDefense / PokemonInstance.maximumIndividualValue,
                    (float)pokemon.individualValues.speed / PokemonInstance.maximumIndividualValue,
                    (float)pokemon.individualValues.health / PokemonInstance.maximumIndividualValue
                };

                imageCheatPokemon.enabled = pokemon.cheatPokemon;
            }
        }
        public IEnumerator RunAnimation(PokemonInstance sendPmon,
                                        PokemonInstance recvPmon)
        {
            textBoxController = TextBoxController.GetTextBoxController(gameObject.scene);

            PokeBall sendPokeBall = PokeBall.GetPokeBallById(sendPmon.pokeBallId);
            PokeBall recvPokeBall = PokeBall.GetPokeBallById(recvPmon.pokeBallId);

            Vector3 pokemonInitialScale = PokemonTransform.localScale;

            //Initialise visibilities
            pokemonImage.enabled  = true;
            pokeBallImage.enabled = false;

            //Initialise sprites
            pokemonImage.sprite  = sendPmon.LoadSprite(PokemonSpecies.SpriteType.Front1);
            pokeBallImage.sprite = sendPokeBall.GetSprite(PokeBall.SpriteType.Neutral);

            //Initialise positions
            PokemonTransform.position  = mainRootTransform.position;
            PokeBallTransform.position = mainRootTransform.position;

            //Goodbye message
            yield return(StartCoroutine(
                             textBoxController.RevealText(goodbyeMessagePrefix + sendPmon.GetDisplayName() + goodbyeMessageSuffix, true)
                             ));

            //Send pokemon cry
            SoundFXController.PlayPokemonCry(sendPmon.speciesId);

            //Send pokemon bouncing
            for (byte i = 0; i < sendPmonBonuceCount; i++)
            {
                yield return(StartCoroutine(Animation_Bounce(PokemonTransform)));
            }

            //Delay
            yield return(new WaitForSeconds(jumpScaleDelay));

            //Open and show poke ball
            pokeBallImage.enabled = true;
            pokeBallImage.sprite  = sendPokeBall.GetSprite(PokeBall.SpriteType.Open);

            //Shrink and hide pokemon
            yield return(StartCoroutine(GradualEffect(
                                            t =>
            {
                PokemonTransform.localScale = pokemonInitialScale * (1 - t);
            },
                                            shrinkGrowTime)));

            pokemonImage.enabled = false;

            //Close poke ball
            pokeBallImage.sprite = sendPokeBall.GetSprite(PokeBall.SpriteType.Neutral);

            //Delay
            yield return(new WaitForSeconds(pokeBallCloseSendDelay));

            //Send away poke ball
            yield return(StartCoroutine(Animation_GradualLinearFunctionMovement(PokeBallTransform,
                                                                                pokeBallOffScreenTransform.position,
                                                                                t => Vector2.up * pokeBallFactorDisplacementCurve_y.Evaluate(t),
                                                                                t => Vector2.right * pokeBallAddedDisplacementCurve_x.Evaluate(t) * addedDisplacementFactor,
                                                                                pokeBallSendReturnTime)));

            //Wait
            yield return(new WaitForSeconds(pokeBallReturnDelay));

            //Switch pokemon and poke ball sprites
            pokemonImage.sprite  = recvPmon.LoadSprite(PokemonSpecies.SpriteType.Front1);
            pokeBallImage.sprite = recvPokeBall.GetSprite(PokeBall.SpriteType.Neutral);

            //Return poke ball
            yield return(StartCoroutine(Animation_GradualLinearFunctionMovement(PokeBallTransform,
                                                                                mainRootTransform.position,
                                                                                t => Vector2.up * pokeBallFactorDisplacementCurve_y.Evaluate(t),
                                                                                t => Vector2.right * pokeBallAddedDisplacementCurve_x.Evaluate(t) * addedDisplacementFactor,
                                                                                pokeBallSendReturnTime)));

            //Delay
            yield return(new WaitForSeconds(pokeBallRecvOpenDelay));

            //Open poke ball
            pokeBallImage.sprite = recvPokeBall.GetSprite(PokeBall.SpriteType.Open);

            //Show and grow pokemon
            pokemonImage.enabled = true;
            yield return(StartCoroutine(GradualEffect(
                                            t =>
            {
                PokemonTransform.localScale = pokemonInitialScale * t;
            },
                                            shrinkGrowTime)));

            //Delay
            yield return(new WaitForSeconds(jumpScaleDelay));

            //Recv pokemon cry
            SoundFXController.PlayPokemonCry(recvPmon.speciesId);

            //Receive pokemon bouncing
            for (byte i = 0; i < recvPmonBounceCount; i++)
            {
                yield return(StartCoroutine(Animation_Bounce(PokemonTransform)));
            }

            //Delay
            yield return(new WaitForSeconds(endDelayTime));

            //Receiving message
            yield return(StartCoroutine(
                             textBoxController.RevealText(receiveMessagePrefix + recvPmon.GetDisplayName() + receiveMessageSuffix, true)
                             ));
        }
예제 #10
0
 protected virtual void DisplayPokemon(PokemonInstance pokemon)
 {
     iconImage.enabled = true;
     iconImage.sprite  = pokemon.LoadSprite(PokemonSpecies.SpriteType.Icon);
 }