Ejemplo n.º 1
0
    public void AddGoodie()
    {
        string theWord = GetRandomWord(cleans, true);

        if (theWord != null)
        {
            var rnd = new System.Random();
            Word.CharacterClass characterClass = (Word.CharacterClass)rnd.Next(3);

            Word word = new GoodieWord(theWord, wordSpawner.SpawnGoodie(), characterClass);
            words.Add(word);
        }
    }
Ejemplo n.º 2
0
    public void SetSprite(Word.CharacterClass characterClass)
    {
        var rnd = new System.Random();

        switch (characterClass)
        {
        case Word.CharacterClass.Fighter:
            spriteRenderer.sprite = (new Sprite[] { fighter1, fighter2, fighter3 })[rnd.Next(0, 3)];
            break;

        case Word.CharacterClass.Thief:
            spriteRenderer.sprite = (new Sprite[] { thief1, thief2, thief3 })[rnd.Next(0, 3)];
            break;

        case Word.CharacterClass.Wizard:
            spriteRenderer.sprite = (new Sprite[] { wizard1, wizard2, wizard3 })[rnd.Next(0, 3)];
            break;

        case Word.CharacterClass.Monster:
            spriteRenderer.sprite = (new Sprite[] { monster1, monster2, monster3, monster4, monster5, monster6, monster7, monster8 })[rnd.Next(0, 8)];
            //spriteRenderer.transform.position = new Vector3(spriteRenderer.transform.position.x - 2f, spriteRenderer.transform.position.y + 0.5f);
            break;

        case Word.CharacterClass.TreasureCoin:
            spriteRenderer.sprite = treasureCoin;
            break;

        case Word.CharacterClass.TreasureSword:
            spriteRenderer.sprite = treasureSword;
            break;

        case Word.CharacterClass.Spell:
            spriteRenderer.sprite             = treasureSword;
            spriteRenderer.transform.position = new Vector3(spriteRenderer.transform.position.x - 4f, spriteRenderer.transform.position.y + 0.5f);
            GetComponent <RectTransform>().SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, 400);
            GetComponent <RectTransform>().SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, 200);
            break;
        }
    }