Example #1
0
    // Use this for initialization
    void Start()
    {
        genderChar = ChooseGender();

        GameObject nameBox = (GameObject)Instantiate(nameBoxType, new Vector3(this.transform.position.x, this.transform.position.y - 1, this.transform.position.z), Quaternion.identity);
        nameBox.GetComponent<TextMesh>().text = NameScript.GetName(this.tag, genderChar);
        nameBox.transform.parent = this.transform;

        spriteHolder = GameObject.Find("SpritesHolder").GetComponent<Sprites>();

        SpriteRenderer thisSprite = this.transform.GetChild(0).GetComponent<SpriteRenderer>();
        thisSprite.sprite = spriteHolder.GetZombieSprite(genderChar);

        // Determine type of zombie, and set stats accordingly
        // Female Zombie Brute
        if (thisSprite.sprite == spriteHolder.spriteZombiesF[0]){
            this.transform.GetComponent<AIMovement>().moveSpeed = Random.Range(2.0f, 2.6f);
            health = 4;
            damage = 2;
            score = 10;
            dropChance = 35.0f;
        }
        // Crawling Zombie
        else if (thisSprite.sprite == spriteHolder.spriteZombiesF[0] || thisSprite.sprite == spriteHolder.spriteZombiesM[2] )
        {
            this.transform.GetComponent<AIMovement>().moveSpeed = Random.Range(0.5f, 1.6f);
            health = 2;
            damage = 1;
            score = 5;
            dropChance = 15.0f;
        }
        // Male Zombie Brute
        else if (thisSprite.sprite == spriteHolder.spriteZombiesM[0]){
            this.transform.GetComponent<AIMovement>().moveSpeed = Random.Range(2.5f, 2.9f);
            health = 2;
            damage = 2;
            score = 10;
            dropChance = 35.0f;
        }
        // Fast Zombie
        else if (thisSprite.sprite == spriteHolder.spriteZombiesM[1]){
            this.transform.GetComponent<AIMovement>().moveSpeed = Random.Range(2.8f, 3.5f);
            health = 3;
            damage = 1;
            score = 8;
            dropChance = 15.0f;
        }

        thisSprite.color = new Color(Random.Range(0.8f, 1f), Random.Range(0.8f, 1f), Random.Range(0.8f, 1f));
    }