Beispiel #1
0
    void CreateOneZombie(ZombieType type)
    {
        GameObject zombie;

        switch (type)
        {
        case ZombieType.Zombie1:
            zombie = Instantiate(Zombie1);
            break;

        case ZombieType.Zombie2:
            zombie = Instantiate(Zombie2);
            break;

        case ZombieType.FlagZombie:
            zombie = Instantiate(FlagZombie);
            break;

        case ZombieType.ConeheadZombie:
            zombie = Instantiate(ConeheadZombie);
            break;

        case ZombieType.BucketheadZombie:
            zombie = Instantiate(BucketheadZombie);
            break;

        case ZombieType.PoleVaultingZombie:
            zombie = Instantiate(PoleVaultingZombie);
            break;

        case ZombieType.NewspaperZombie:
            zombie = Instantiate(NewspaperZombie);
            break;

        default:
            throw new System.Exception("Wrong zombie type");
        }
        int row = Random.Range(0, StageMap.ROW_MAX - 1);

        zombie.transform.position              = StageMap.GetZombiePos(row);
        zombie.transform.localScale            = new Vector3(0.5f, 0.5f, 0.5f);
        zombie.GetComponent <ZombieMove>().row = row;
        zombie.GetComponent <SpriteDisplay>().SetOrderByRow(row);
        model.zombieList[row].Add(zombie);
    }