예제 #1
0
 public static void IssueOnEnemyDied()
 {
     if (OnEnemyDied != null)
     {
         OnEnemyDied.Invoke();
     }
 }
    public void Damage(float damage)
    {
        if (enemy.TakeDamage(damage))
        {
            OnEnemyDied?.Invoke(this);
            OnParticularEnemyDied?.Invoke(this);

            Destroy(gameObject);
        }
    }
예제 #3
0
 public override void Enter()
 {
     base.Enter();
     entity.isEnraged = false;
     entity.GetComponent <RespownAfterDeath>().isDead = true;
     entity.enabled       = false;
     entity.rb.useGravity = false;
     entity.GetComponentInChildren <Collider>().enabled = false;
     entity.playerStats.currentExp += entity.entityData.expReward;
     entity.playerStats.LevelUp();
     if (OnEnemyDied != null)
     {
         OnEnemyDied.Invoke(entity.entityData.mobID);
     }
     if (entity.lootTable != null)
     {
         entity.lootTable.RollLoot();
     }
 }
예제 #4
0
        protected override void Die()
        {
            Message <ReturnToPool <EnemyBehaviour> > .Raise(this);

            //invoke local event and clear the delegate.
            OnEnemyDied?.Invoke();
            OnEnemyDied = null;

            //this used to be ondisable, but Die works just as fine
            inStrafeDistance = false;
            Destroy(GetComponent <PolygonCollider2D>()); //weird fix
            //yeet
            var system = DeathParticlePool.GetPoolObject();

            system.transform.position = transform.position + new Vector3(0, 0, -1.5f); //position needs to be a little offset for it to render correctly.
            var main = system.Main;

            main.startColor = settings.tint;
            system.gameObject.SetActive(true);
        }
예제 #5
0
 public void EnemyDied(Enemy enemy) => OnEnemyDied?.Invoke(enemy);
예제 #6
0
파일: Enemy.cs 프로젝트: Szejp/TowerDefense
 private void OnDestroy()
 {
     OnEnemyDied?.Invoke(this);
 }
예제 #7
0
 public static void IDied(GameObject gameObject)
 {
     OnEnemyDied?.Invoke(gameObject);
 }
 public void NotifyObservers()
 {
     OnEnemyDied?.Invoke(this);
 }
 /// <summary>
 /// Call this method to notify the game manager that this unit is dead.
 /// </summary>
 /// <param name="enemyType">Enemy type</param>
 protected void OnDiedAction(EnemyType enemyType)
 {
     _isInit = false;
     OnDeductEnemy?.Invoke(enemyType);
     OnEnemyDied?.Invoke(enemyType);
 }
예제 #10
0
 public static void ReportEnemyDied(Enemy _enemy)
 {
     OnEnemyDied?.Invoke(_enemy);
     //Debug.Log(_enemy.name + " Died");
 }
예제 #11
0
 private void EnemyDied(float amount)
 {
     OnEnemyDied?.Invoke(amount);
 }