Пример #1
0
    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;
        }
    }
Пример #2
0
    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";
                }
            }
        }
    }
Пример #3
0
    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>();
        }
    }
Пример #5
0
    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;
            }
        }
    }
Пример #7
0
    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;
                }
            }
        }
    }
Пример #8
0
 public void DealDamage(ref Common.HealthSetter healthSetter, float _damage)
 {
     healthSetter.ReduceHealth(_damage);
 }
Пример #9
0
 public virtual void PlayerInteractOnAttack(Common.HealthSetter _playerHealthSetter, float _damageValue)
 {
     _playerHealthSetter.ReduceHealth(_damageValue);
 }