// Use this for initialization
    void Start()
    {
        //Originals
        UnknownEnemy unknownEnemy = new UnknownEnemy("0", AbstractEnemy.EnemyRace.elf);
        GoblinEnemy  goblinEnemy  = new GoblinEnemy("1", 10, "bob", AbstractEnemy.EnemyRace.goblin);
        GoblinEnemy  goblinHero   = new GoblinEnemy("2", 20, "Goblin Hero", AbstractEnemy.EnemyRace.goblin);


        //Clones
        UnknownEnemy unknownEnemy2 = unknownEnemy.Clone() as UnknownEnemy;
        GoblinEnemy  goblinEnemy2  = goblinEnemy.Clone() as GoblinEnemy;

        unknownEnemy.Interact();
        unknownEnemy2.Interact();
        goblinEnemy.Interact();
        goblinEnemy.Interact();
        goblinHero.Interact();

        //Adding them to a list so I can manipulate them more easily
        enemies.Add(goblinEnemy2);
        enemies.Add(unknownEnemy);
        enemies.Add(unknownEnemy2);
        enemies.Add(goblinEnemy);
        enemies.Add(goblinHero);

        Debug.LogFormat(" I have {0} enemies", enemies.Count);
        Debug.Log(enemies[enemies.Count - 1].Name);

        UnknownEnemy trooperBase = new UnknownEnemy("0", AbstractEnemy.EnemyRace.humanoid);

        AttackOfTheClones(trooperBase, 50);
    }
Exemple #2
0
    void Fire()
    {
        playSingleleSound(shootSnd);
        MuzzleFlash.Play();
        clipAmmo--;
        RaycastHit hit;

        if (Physics.Raycast(fpsCam.transform.position, fpsCam.transform.forward, out hit, range))
        {
            Debug.Log(hit.transform.name);

            Enemy enemy = hit.transform.GetComponent <Enemy>();

            GoblinEnemy GoblinEnemy = hit.transform.GetComponent <GoblinEnemy>();

            BompEnemy BompEnemy = hit.transform.GetComponent <BompEnemy>();

            BossEnemy BossEnemy = hit.transform.GetComponent <BossEnemy>();

            if (GameManager.player == true)
            {
                Character1 Player2 = hit.transform.GetComponent <Character1>();
                if (Player2 != null)
                {
                    Player2.TakeDamage(Damage);
                }
            }


            if (BossEnemy != null)
            {
                BossEnemy.TakeDamage(Damage);
            }

            if (BompEnemy != null)
            {
                BompEnemy.TakeDamage(Damage);
            }

            if (GoblinEnemy != null)
            {
                GoblinEnemy.TakeDamage(Damage);
            }

            if (enemy != null)
            {
                enemy.TakeDamage(Damage);
            }

            GameObject ImplactGameObejct = Instantiate(ImplactEfect, hit.point, Quaternion.LookRotation(hit.normal));
            Destroy(ImplactGameObejct, 0.5f);
        }
        anim.SetTrigger("Shoot");
    }