private void SetOpDeath() { OpDeath(); OpponentDeadAnimation(); opAIState = OpponentAI.OpponentAIState.OpDeath; }
private void AIJump() { if (IsGrounded() == true) { enemyRB.AddForce(new Vector2(0, js), ForceMode2D.Impulse); EnemyJump(true); _opponentAIState = OpponentAIState.AIDown; } }
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; }
private void WaitForHitAnimation() { if (opAnim.IsPlaying(opHitAnim.name)) { return; } if (opAnim.IsPlaying(opHardHitAnim.name)) { return; } opAIState = OpponentAI.OpponentAIState.OpIdle; }
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; } }
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); }
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; } }
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; } }
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; }
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; }
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; } }
private void AILightAttack() { EnemyLightAttack(); _opponentAIState = OpponentAIState.WaitForAttackAni; }
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; } }
private void AIDown() { EnemyJump(false); _opponentAIState = OpponentAIState.AIIdle; }
private void AIHeavyAttack() { EnemyHeavyAttack(); _opponentAIState = OpponentAIState.WaitForAttackAni; }
private void AISpecialAttack() { EnemySpecialAttack(); _opponentAIState = OpponentAIState.WaitForAttackAni; }
private void Initialise() { opAIState = OpponentAI.OpponentAIState.OpIdle; }