public void DoUpdate(FsmFrameInfo state, ControlManager c, ref EnemyFrameInfo frameInfo) { this.frameInfo = frameInfo; if (frameInfo.damageInfo != null) { Damage(frameInfo.damageInfo); } if (state.hasChanged) { if (state.curr == AnimStates.ATTACK1) { frameInfo.isAttacking = true; if (c.isMoved) { Face(c.move); } } else if (state.curr == AnimStates.ATTACK2) { frameInfo.isAttacking = true; if (c.isMoved) { Face(c.move); } } else if (state.curr == AnimStates.ATTACK3) { frameInfo.isAttacking = true; if (c.isMoved) { Face(c.move); } } else if (state.curr == AnimStates.CHARGEATTACK) { frameInfo.isChargeAttacking = true; if (c.isMoved) { Face(c.move); } } } if (state.curr == AnimStates.IDLE) { if (c.isMoved) { Walk(c.move); } } else if (state.curr == AnimStates.WALK) { if (c.isMoved) { Walk(c.move); } } }
public void DoUpdate(Enemy enemy, ref EnemyFrameInfo frameInfo) { //animator.SetFloat(AnimParams.FACEDIRX, enemy.FaceDir.x); //animator.SetFloat(AnimParams.FACEDIRY, enemy.FaceDir.y); spriteRenderer.sortingOrder = Mathf.RoundToInt(enemy.transform.position.y * 100f) * -1; if (frameInfo.damageInfo != null) { flasherDamage.Restart(); } }
public void DoUpdate(Enemy enemy, ref EnemyFrameInfo frameInfo) { if (frameInfo.damageInfo != null) { PlaySfxEvent ev = new PlaySfxEvent(owSounds[Random.Range(0, owSounds.Length)]); eventManager.Publish(Events.PLAY_SFX, ev); } if (enemy.currentHp <= 0) { PlaySfxEvent ev = new PlaySfxEvent(deathSounds[Random.Range(0, deathSounds.Length)]); eventManager.Publish(Events.PLAY_SFX, ev); } }
private void Awake() { moverController = GetComponent <MoverController>(); hitbox = transform.Find("Hitbox").GetComponent <BoxCollider2D>(); poolManager = Toolbox.GetOrAddComponent <PoolManager>(); poolManager.CreatePool(bloodSplatter, 150); damageInfo = new DamageInfo(); damageInfo.damage = 10; fsm = GetComponent <Animator>(); enemy = GetComponent <Enemy>(); enemyAnimator = GetComponent <EnemyAnimator>(); enemyAudio = GetComponent <EnemyAudio>(); frameInfo = new EnemyFrameInfo(); }