public override void LogicUpdate()
    {
        base.LogicUpdate();

        if (Time.time > startTime + data.detectStayTime)
        {
            DoChecks();

            if (detectPlayerInMinAgro)
            {
                // TODO:
                // if player attack => FLEE
                // else WILD MELEEATTACK

                stateMachine.SwitchState(enemy.heideAttackState);
            }
            else if (detectPlayerInMeleeRange)
            {
                // MELEEATTACK
                enemy.Flip();
                stateMachine.SwitchState(enemy.meleeAttackState);
            }
            else
            {
                enemy.Flip();
                stateMachine.SwitchState(enemy.fleeState);
            }
        }
    }
    public override void CompleteStun()
    {
        base.CompleteStun();

        // SHOULD BE LOOK FOR PLAYER STATE
        enemy.Flip();
        stateMachine.SwitchState(enemy.meleeAttackState);
    }
    public override void LogicUpdate()
    {
        base.LogicUpdate();

        if (!isAttacking && heideAttacktimes > 0)
        {
            heideAttacktimes--;
            isAttacking = true;
            enemy.Flip();
            enemy.anim.Play(animName);
        }
        else if (!isAttacking && heideAttacktimes <= 0)
        {
            stateMachine.SwitchState(enemy.fleeState);
        }
    }
    public override void LogicUpdate()
    {
        base.LogicUpdate();

        // a mess here, clean up in future
        if (Time.time > startTime + data.fleeTime || isEdgeDetected || isWallDetected)
        {
            enemy.Flip();
            stateMachine.SwitchState(enemy.walkState);
        }
        else if (detectPlayerInMinAgro)
        {
            stateMachine.SwitchState(enemy.meleeAttackState);
        }
        else
        {
            enemy.rb.velocity = new Vector2(entity.facingDirection * data.fleeSpeed, enemy.rb.velocity.y);
        }
    }
示例#5
0
    public override void LogicUpdate()
    {
        base.LogicUpdate();
        if (isEdgeDetected || isWallDetected)
        {
            enemy.Flip();
        }

        //vectorWorkspace.Set(data.walkSpeed * enemy.facingDirection, 0);
        //enemy.rb.velocity = vectorWorkspace;

        if (detectPlayerInMinAgro)
        {
            enemy.detectPlayerState.SetPlayerDetectedTrans(detectPlayerTrans);
            stateMachine.SwitchState(enemy.detectPlayerState);
        }

        if (Time.time > startTime + walkDurationTime)
        {
            enemy.idleState.SetFlipAfterIdle(true);
            stateMachine.SwitchState(enemy.idleState);
        }
    }