Exemplo n.º 1
0
    //When receiving a new message
    public override void onMessage(string message)
    {
        int dexNum;

        if (!int.TryParse(message, out dexNum))
        {
            dexNum = 0;
        }
        Debug.Log("We received message and got a dexnum: " + dexNum);
        PokemonBase pokemon = receivedPokemon.GetComponent <PokemonBase> ();

        Debug.Log("PokemonBase is set");
        pokemon = PokemonBase.RandomPokemon(dexNum);
        Debug.Log("Random Pokemon has been generated with dex number: " + dexNum + "\n It's name is " + pokemon.Name);
        TextMesh pokeText = receivedPokemon.GetComponentInChildren <TextMesh> ();

        pokeText.text = ("#" + pokemon.DexNum + " " + pokemon.Name);

        if (Resources.Load <Sprite> ("Sprites/Front/Normal/" + dexNum) != null)
        {
            receivedPokemon.GetComponent <SpriteRenderer> ().sprite = Resources.Load <Sprite> ("Sprites/Front/Normal/" + dexNum);
            Debug.Log("Sprite loaded from " + dexNum);
        }
        else
        {
            receivedPokemon.GetComponent <SpriteRenderer> ().sprite = Resources.Load <Sprite> ("Sprites/Front/Normal/NoEntry");
            Debug.Log("Sprite loaded, unfortuantely NoEntry");
        }

        addrCanvas.SetActive(false);
        pokemonTeam.AddPokemon(pokemon);
        //save game????
        //Play Animation
    }
Exemplo n.º 2
0
 public override void Awake()
 {
     pokeTeam = this.gameObject.GetComponent <OpponentTeam> ();
     Debug.Log(pokeTeam.gameObject.name);
     if (pokeTeam.pokeTeam.Count == 0)
     {
         PokemonBase pokepon = PokemonBase.RandomPokemon(DebugNumber());
         pokeTeam.pokeTeam.Add(pokepon);                //DEBUG//
     }
     //PokemonBase sentretje = PokemonBase.RandomPokemon (163);
     //pokeTeam.pokeTeam.Add(sentretje); //DEBUG//
     activeSprite        = gameObject.transform.GetChild(0).GetChild(0).GetComponent <SpriteRenderer> ();
     activePokemon       = pokeTeam.pokeTeam [0];
     activeSprite.sprite = Resources.Load <Sprite> ("Sprites/Front/Normal/" + activePokemon.DexNum);
 }
 public override void Awake()
 {
     if (TrainerTeam.pokeTeam.Count == 0)
     {
         PokemonBase pokepon = PokemonBase.RandomPokemon(163);
         TrainerTeam.pokeTeam.Add(pokepon);                //DEBUG//
     }
     activeSprite  = gameObject.transform.GetChild(0).GetChild(0).GetComponent <SpriteRenderer> ();
     activePokemon = TrainerTeam.pokeTeam [0];
     if (activePokemon.Type1 == null)
     {
         activeSprite.sprite = Resources.Load <Sprite> ("Sprites/Back/Normal/NoEntry");
     }
     else
     {
         activeSprite.sprite = Resources.Load <Sprite> ("Sprites/Back/Normal/" + activePokemon.DexNum);
     }
 }
Exemplo n.º 4
0
    public void EnablePokemonMenu()
    {
        MenuOptions [1].SetActive(!MenuOptions [1].activeInHierarchy);
        //get the players team and instantiate the correct pokemon
        ///Debug///
        ///
        if (TrainerTeam.pokeTeam.Count == 0)
        {
            pokemonTeam.AddPokemon(PokemonBase.RandomPokemon(158));
        }

        if (MenuOptions [1].GetComponentInChildren <UnityEngine.UI.ContentSizeFitter> ().GetComponentsInChildren <Transform>().Length < TrainerTeam.pokeTeam.Count + 1)
        {
            for (int i = 0; i < TrainerTeam.pokeTeam.Count; i++)
            {
                GameObject listPoke = Instantiate(pokemonObject, MenuOptions [1].GetComponentInChildren <UnityEngine.UI.ContentSizeFitter> ().gameObject.transform);
                Debug.Log(TrainerTeam.pokeTeam [0].Name);                      //printing name
                listPoke.GetComponentInChildren <UnityEngine.UI.Text> ().text = TrainerTeam.pokeTeam [i].Name;
            }
        }
    }