/// <summary> Summons a queued party member. </summary> /// <param name="_pokeSpawner"> The parent of the pokemon. Will be positioned and oriented properly </param> public IEnumerator Summon(Transform _pokeSpawner) { /* Throw Error At User If NO Move Queued */ if (QueuedPokemon == null) { Debug.LogError("No party member queued on " + name); yield break; } /* Save The Position */ pokeSpawner = _pokeSpawner; if (Ball != null) { Destroy(Ball.gameObject); } /* Instantiate and Fix Position of Pokeball Instance Found in Designated Pokemon's Ball Slot */ Ball = Instantiate(QueuedPokemon.state.ball, pokeBallContainer); Ball.transform.localPosition = Vector3.zero; /* Start Throw Animation, Which Gives Control To The Animation */ Anim.ThrowBall(); /* Wait Unity The Pokemon is Outside The Pokeball */ yield return(new WaitUntil(() => Ball.ReadyToInstance == true)); /* Get Instanced Pokemon From Pokeball and Parent It To Spawner */ CurrentPokemon = Instantiate(QueuedPokemon.pokemon, Ball.SummonPosition, pokeSpawner.rotation, pokeSpawner); /* Apply The Pokestate To This New Pokemon */ CurrentPokemon.ApplyState(QueuedPokemon); /* Shape Pokemon */ StartCoroutine(SummonShape()); /* Destroy the Pokeball after some time. */ Destroy(Ball.gameObject, 3f); }
/// <summary> Instantly summons a pokemon at designated slot. </summary> /// <param name="slot"> The slot number of the pokemon to summon. </param> /// <param name="_pokeSpawner"> The parent of the pokemon. Will be positioned and oriented properly </param> public void SummonInstant(int slot, Transform _pokeSpawner) { pokeSpawner = _pokeSpawner; CurrentPokemon = Instantiate(party[slot].pokemon, _pokeSpawner); CurrentPokemon.ApplyState(party[slot]); }