Esempio n. 1
0
    private void OnDisable()
    {
        OnEnemyStun     -= HandleEnemyStun;
        OnEnemyEndStun  -= HandleEnemyEndStun;
        OnEnemyDeath    -= HandleEnemyDeath;
        OnEnemyEndDeath -= HandleEnemyEndDeath;

        LevelManager.OnPlayerDeath -= HandlePlayerDeath;
    }
Esempio n. 2
0
 private void Awake()
 {
     current = this;
     player  = new PlayerEvents();
     ui      = new UIEvents();
     spawn   = new SpawnEvents();
     level   = new LevelEvents();
     enemy   = new EnemyEvents();
     combat  = new CombatEvents();
 }
Esempio n. 3
0
        public void die() // Called only if the enemy is supposed to be destroyed by being killed, not when it's destroyed for other reasons.
        {
            life_state = LifeState.dying;
            Destroy(gameObject, diying_duration);
            launch_destruction_animation();

            if (this.gameObject.CompareTag(Wave.ENEMY_TAG))
            {
                EnemyEvents.InvokeOnKilled(this);
            }
        }
Esempio n. 4
0
 private void Awake()
 {
     instance         = this;
     playerEvents     = new PlayerEvents();
     evilPlayerEvents = new EvilPlayerEvents();
     enemyEvents      = new EnemyEvents();
     levelEvents      = new LevelEvents();
     enviromentEvents = new EnviromentEvents();
     weaponEvents     = new WeaponEvents();
     itemEvents       = new ItemEvents();
 }
Esempio n. 5
0
        private void SetupEnemyEvents()
        {
            EnemyEvents = LevelManager.Instance.SelectedLevel.GetCurrentStar().Events;
            if (EnemyEvents == null)
            {
                return;
            }

            foreach (var e in EnemyEvents.RageEvents)
            {
                e.Start(enemy);
            }
        }
Esempio n. 6
0
 void TakeDamage(int dmg)
 {
     HP -= dmg;
     print(robotName + " has: " + HP + " remaining HP");
     if (HP <= nearDeath)
     {
         roboAnim.SetBool("isHurt", true);
     }
     if (HP <= 0)
     {
         EnemyEvents.EnemyKilled();
         Destroy(gameObject);
     }
 }
Esempio n. 7
0
    public void Init()
    {
        enemiesLayerValue = LayerMaskToLayer(enemiesLayerMask);

        enemyList      = new List <IEnemy>();
        stunnedEnemies = new List <IEnemy>();
        deadEnemies    = new List <IEnemy>();

        enemyList = (FindObjectsOfType <EnemyBase>() as IEnemy[]).ToList();

        enemyList.AddRange((FindObjectsOfType <Turret>() as IEnemy[]).ToList());

        OnEnemyStun     += HandleEnemyStun;
        OnEnemyEndStun  += HandleEnemyEndStun;
        OnEnemyDeath    += HandleEnemyDeath;
        OnEnemyEndDeath += HandleEnemyEndDeath;

        LevelManager.OnPlayerDeath += HandlePlayerDeath;

        canAddTolleranceDefaultBehaviour = canAddTollerance = true;
    }
        public static EnemyEvents GetLevelEvents(LevelEvents.EventTrigger[] levelEvent)
        {
            var events = new EnemyEvents();

            if (levelEvent == null)
            {
                return(events);
            }

            foreach (var e in levelEvent)
            {
                var result = GetEnemyEvent(e);
                if (result == null)
                {
                    continue;
                }

                events.RageEvents.Add(result);
            }
            return(events);
        }
Esempio n. 9
0
 private void Awake()
 {
     instance = this;
 }
Esempio n. 10
0
 private void Awake()
 {
     enemyEvents = gameObject.AddComponent <EnemyEvents>();
 }