void ExecuteState(JamSpace.EState _enemyState) { switch (_enemyState) { case JamSpace.EState.NONE: break; case JamSpace.EState.IDLE: moveSpeed = normalSpeed; TriggerAnimation(JamSpace.AnimationTags.ANIMATION_IDLE); InvestigatedTargetHealthSetter = null; myAnimator.speed = 1; break; case JamSpace.EState.MONITORING: StartCoroutine(CallMonitoring()); break; case JamSpace.EState.ATTACKING: Attack(); break; case JamSpace.EState.COOLDOWN: StartCoroutine(CallCooldown()); break; case JamSpace.EState.MAX: break; default: break; } }
private void OnTriggerStay2D(Collider2D collision) { if (CurrentState == JamSpace.EState.IDLE) { var collisionScript = collision.GetComponent <Player.Movement.PlayerCollision>(); if (collisionScript) { InvestigatedTargetHealthSetter = collisionScript.GetComponent <Common.HealthSetter>(); Vector2 _vec2 = this.gameObject.transform.position - InvestigatedTargetHealthSetter.transform.position; float _angle = Vector2.Angle(Vector2.right, _vec2); if (_angle <= thetaRange) { //_text.text = "monitoring"; CurrentState = JamSpace.EState.MONITORING; //ExecuteState(JamSpace.EState.MONITORING); } else { var _tempAngle = 180 - thetaRange; var _subAngle = _angle - _tempAngle; if (((_subAngle) <= thetaRange) && (_subAngle > 0)) { //_text.text = "monitoring"; CurrentState = JamSpace.EState.MONITORING; } //_text.text = "not in range"; } } } }
private void OnTriggerExit2D(Collider2D collision) { var collisionScript = collision.GetComponent <Player.Movement.PlayerCollision>(); if (collisionScript) { InvestigatedTargetHealthSetter = null; } }
private void OnTriggerEnter2D(Collider2D collision) { var collisionScript = collision.GetComponent <Player.Movement.PlayerCollision>(); if (collisionScript) { parentComponent.IsEnemyVisible = true; InvestigatedTargetHealthSetter = collisionScript.GetComponent <Common.HealthSetter>(); } }
private void OnTriggerEnter2D(Collider2D collision) { var collisionScript = collision.GetComponent <Player.Movement.PlayerCollision>(); if (collisionScript) { InvestigatedTargetHealthSetter = collisionScript.GetComponent <Common.HealthSetter>(); CurrentState = JamSpace.EState.MONITORING; } }
private void OnTriggerEnter2D(Collider2D collision) { var _validHealthSetter = collision.GetComponent <Common.HealthSetter>(); if (_validHealthSetter) { if (!playerHealthSetter) { playerHealthSetter = _validHealthSetter; } } }
private void OnTriggerStay2D(Collider2D collision) { if (!bIsInCooldown) { var collisionScript = collision.GetComponent <Player.Movement.PlayerCollision>(); if (collisionScript) { InvestigatedTargetHealthSetter = collisionScript.GetComponent <Common.HealthSetter>(); if (bCanStartCounter) { CurrentState = JamSpace.EState.MONITORING; bCanStartCounter = false; } } } }
public void DealDamage(ref Common.HealthSetter healthSetter, float _damage) { healthSetter.ReduceHealth(_damage); }
public virtual void PlayerInteractOnAttack(Common.HealthSetter _playerHealthSetter, float _damageValue) { _playerHealthSetter.ReduceHealth(_damageValue); }