Exemple #1
0
 protected virtual void OnEnable()
 {
     controller = GetComponent <ZombieCtrl>();
     zombieData = controller.zombieData;
     behavior   = GetComponent <ZombieBehavior>();
     behavior.AddStateReceiver(StateChanged);
 }
    public void InactiveMob(GameObject mob)
    {
        mob.transform.position = spawnPoint[Random.Range(0, 3)].position;
        ZombieCtrl tempSet = mob.GetComponent <ZombieCtrl>();

        tempSet.target = player;
        tempSet.hp     = tempSet.saveHP;
        mob.SetActive(false);
        objectPool.Enqueue(mob);
    }
 private void Start()
 {
     if (GetComponent <ZombieCtrl>() == null)
     {
         return;
     }
     isZombie          = true;
     _zombieController = GetComponent <ZombieCtrl>();
     HP          = _zombieController.HP;
     useAsWeapon = true;
 }
    public void InitializeNewZombie(GameObject mob)
    {
        GameObject tmpMob = Instantiate(mob);

        tmpMob.transform.parent   = objectPoolList.transform;
        tmpMob.transform.position = spawnPoint[Random.Range(0, 3)].position;
        ZombieCtrl tempSet = tmpMob.GetComponent <ZombieCtrl>();

        tempSet.target = player;
        tempSet.hp     = tempSet.saveHP;
        tmpMob.SetActive(false);
        objectPool.Enqueue(tmpMob);
    }