Ok so when i auto attack everything works except for when the Float Attack is changed to 4.0 the character does not revert back to the idle animation like its rigged to in the animator
additionally when the attack is changed to 9 the animation for the attack does not play again even though 4 seconds is way more than enough time for this to happen
i checked the animator and float is changing when its suppose to to but the animation does not play.
at this point i cant figure out what is stopping that from happening
the animations them selfs are not configured to loop but to my understanding every time a animation transition is triggered it should repeat?
using UnityEngine;
using System.Collections;
using System;
public class Player1 : Creature
{
bool combatstate;
public int waittime;
public static Player1 player;
public static bool isAttacking;
public static Transform opponent;
public Animator attackanimaton;
// Use this for initialization
void Awake()
{
player = this;
isAttacking = false;
combatstate = false;
}
// Update is called once per frame
void Update()
{
attackanimaton = GetComponent<Animator>();
isAttacking = false;
attacksuccess();
}
IEnumerator AutoAction()
{
if (combatstate == true)
{
if (opponent != null && Vector3.Distance(opponent.position, transform.position) < range)
{
Debug.Log("is attacking");
attackanimaton.SetBool("isAttacking", true);
attackanimaton.SetFloat("Attack", 9.0f);
opponent.GetComponent<Enemy>().GetHit(damage);
yield return new WaitForSecondsRealtime(4.0f);
attackanimaton.SetFloat("Attack", 4.0f);
Debug.Log("waiting");
yield return new WaitForSecondsRealtime(4.0f);
StartCoroutine(AutoAction());
}
}
}
void attacksuccess()
{
if (Input.GetKeyDown(KeyCode.X))
{
Debug.Log("combatstate is D");
combatstate = !combatstate;
StartCoroutine(AutoAction());
}
}
protected override void Attack()
{
throw new NotImplementedException();
}
}