public static Sprite GetPokeBallSprite(int pokeBallId, PokeBall.SpriteType spriteType) { string resourceName = PokeBall.GetPokeBallById(pokeBallId).resourceName + '_' + PokeBall.spriteTypeResourceNames[spriteType]; return(GetSprite(SpriteType.PokeBall, resourceName)); }
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); } }
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 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) )); }