Example #1
0
    private void SetOpDeath()
    {
        OpDeath();
        OpponentDeadAnimation();

        opAIState = OpponentAI.OpponentAIState.OpDeath;
    }
Example #2
0
 private void AIJump()
 {
     if (IsGrounded() == true)
     {
         enemyRB.AddForce(new Vector2(0, js), ForceMode2D.Impulse);
         EnemyJump(true);
         _opponentAIState = OpponentAIState.AIDown;
     }
 }
Example #3
0
    private void OpHit()
    {
        OpponentHitAnimation();

        opAIAudioSauce.PlayOneShot(opLightHitAudio);
        Vector3    contactPoint = OpponentLightHit.opContactPoint;
        GameObject hit          = Instantiate(hitEffect, new Vector3(contactPoint.x, contactPoint.y + tempVar2, contactPoint.z + -0.3f), Quaternion.identity) as GameObject;

        opAIState = OpponentAI.OpponentAIState.WaitForHitAnimation;
    }
Example #4
0
 private void WaitForHitAnimation()
 {
     if (opAnim.IsPlaying(opHitAnim.name))
     {
         return;
     }
     if (opAnim.IsPlaying(opHardHitAnim.name))
     {
         return;
     }
     opAIState = OpponentAI.OpponentAIState.OpIdle;
 }
Example #5
0
    private void AIMoveAway()
    {
        float   distance        = Vector3.Distance(transform.position, PlayerControl.instance.transform.position);
        Vector3 currentPosition = transform.position;

        currentPosition.x += ms * Time.deltaTime;
        transform.position = currentPosition;
        EnemyMove(true);
        if (distance >= retreatpoint)
        {
            _opponentAIState = OpponentAIState.Initialise;
        }
    }
Example #6
0
    private void AIMoveToward()
    {
        if (Mathf.Abs(transform.position.x - PlayerControl.instance.transform.position.x) <= attack_Distance)
        {
            _opponentAIState = OpponentAIState.ChooseAttackState;
        }
        float   distance        = Vector3.Distance(transform.position, PlayerControl.instance.transform.position);
        Vector3 currentPosition = transform.position;

        currentPosition.x -= ms * Time.deltaTime;
        transform.position = currentPosition;
        EnemyMove(true);
    }
Example #7
0
 private void AIRetreat()
 {
     moveBackward = Random.Range(1, 10);
     Debug.Log("qq");
     if (moveBackward >= minDecision && moveBackward <= attackpoint)
     {
         _opponentAIState = OpponentAIState.AIMoveAway;
     }
     if (moveBackward <= maxDecision && moveBackward > attackpoint)
     {
         _opponentAIState = OpponentAIState.AIMoveAway;
     }
 }
Example #8
0
    private void AIAttack()
    {
        moveForward = Random.Range(1, 10);
        float distance = Vector3.Distance(transform.position, PlayerControl.instance.transform.position);

        if (moveForward >= minDecision && moveForward <= attackpoint)
        {
            _opponentAIState = OpponentAIState.AIMoveToward;
        }
        if (moveForward <= maxDecision && moveForward > attackpoint)
        {
            _opponentAIState = OpponentAIState.AIMoveToward;
        }
    }
Example #9
0
    private void WaitForAttackAni()
    {
        if (enemyAnim.GetCurrentAnimatorStateInfo(0).IsName("LightAttack"))
        {
            return;
        }
        if (enemyAnim.GetCurrentAnimatorStateInfo(0).IsName("MediumAttack"))
        {
            return;
        }
        if (enemyAnim.GetCurrentAnimatorStateInfo(0).IsName("SpecialAttack"))
        {
            return;
        }

        _opponentAIState = OpponentAIState.AIIdle;
    }
Example #10
0
    private void Initialise()
    {
        decideMovePriority = Random.Range(1, 6);
        attackP            = 0;
        nextAttack         = 0;
        if (attackDecision == 0)
        {
            attackDecision = 3;
        }

        if (minLightAttackRange != 0)
        {
            minLightAttackRange = 0;
        }

        if (maxLightAttackRange == 0)
        {
            maxLightAttackRange = 1;
        }

        if (minHeavyAttackRange == 0)
        {
            minHeavyAttackRange = 2;
        }

        if (maxHeavyAttackRange == 0)
        {
            maxHeavyAttackRange = 3;
        }

        if (minSpecialAttackRange == 0)
        {
            minSpecialAttackRange = 4;
        }

        if (maxSpecialAttackRange == 0)
        {
            maxSpecialAttackRange = 5;
        }
        _opponentAIState = EnemyControl.OpponentAIState.AIIdle;
    }
Example #11
0
    private void AIIdle()
    {
        if (decideMovePriority < _defensivePriority.start)
        {
            _opponentAIState = OpponentAIState.AIAttack;
        }

        //if(decideMovePriority > _offensivePriority.end && decideMovePriority < _defensivePriority.start)
        //{
        //    if (assessPlayer == true)
        //        return;

        //    assessPlayer = true;
        //    StartCoroutine("AssessThePlayer");
        //}

        if (decideMovePriority > _offensivePriority.start)
        {
            _opponentAIState = OpponentAIState.AIRetreat;
        }
    }
Example #12
0
 private void AILightAttack()
 {
     EnemyLightAttack();
     _opponentAIState = OpponentAIState.WaitForAttackAni;
 }
Example #13
0
    private void ChooseAttackState()
    {
        switchAttack = Random.Range(0, 5);

        if (switchAttack >= minLightAttackRange && switchAttack <= maxLightAttackRange)
        {
            switchAttackState = 0;
        }

        if (switchAttack >= minHeavyAttackRange && switchAttack <= maxHeavyAttackRange)
        {
            switchAttackState = 1;
        }

        if (switchAttack >= minSpecialAttackRange && switchAttack <= maxSpecialAttackRange)
        {
            switchAttackState = 2;
        }

        switch (switchAttackState)
        {
        case 0:
            chooseAttack = ChooseAttack.lightAttack;
            break;

        case 1:
            chooseAttack = ChooseAttack.heavyAttack;
            break;

        case 2:
            chooseAttack = ChooseAttack.specialAttack;
            break;
        }
        if (nextAttack > 0)
        {
            nextAttack -= Time.deltaTime;
        }
        else if (nextAttack <= 0)
        {
            if (chooseAttack == ChooseAttack.lightAttack)
            {
                _opponentAIState = OpponentAIState.AILightAttack;
            }

            if (chooseAttack == ChooseAttack.heavyAttack)
            {
                _opponentAIState = OpponentAIState.AIHeavyAttack;
            }

            if (chooseAttack == ChooseAttack.specialAttack)
            {
                _opponentAIState = OpponentAIState.AISpecialAttack;
            }
            nextAttack = cooldown;
            attackP++;
        }
        if (attackP > attackPeriod)
        {
            _opponentAIState = OpponentAIState.Initialise;
        }
    }
Example #14
0
 private void AIDown()
 {
     EnemyJump(false);
     _opponentAIState = OpponentAIState.AIIdle;
 }
Example #15
0
 private void AIHeavyAttack()
 {
     EnemyHeavyAttack();
     _opponentAIState = OpponentAIState.WaitForAttackAni;
 }
Example #16
0
 private void AISpecialAttack()
 {
     EnemySpecialAttack();
     _opponentAIState = OpponentAIState.WaitForAttackAni;
 }
Example #17
0
 private void Initialise()
 {
     opAIState = OpponentAI.OpponentAIState.OpIdle;
 }