Esempio n. 1
0
    void OnSpawn(Ruling.Virus v)
    {
        GameObject enemyBase = null;

        switch (v.VirusGrade)
        {
        case Ruling.Virus.Grade.Big:
            enemyBase = bigEnemy;
            break;

        case Ruling.Virus.Grade.Mid:
            enemyBase = midEnemy;
            break;

        case Ruling.Virus.Grade.Tiny:
            enemyBase = tinyEnemy;
            break;
        }
        var newVirus = Instantiate(enemyBase, new Vector3(0, 0, 50), Quaternion.identity);

        Virus.Attach(newVirus, crackedMesh);
        var virus = newVirus.GetComponent <Virus>();
        var pos   = v.VirusPosition;
        var to    = From(pos);

        virus.Apply(to, false);
        viruses.Add(v.VirusId, virus);
    }