public void Start() { isDash = false; velocity = 0.1f; animalState = eAnimalState.eIdle; GetComponent <AnimalAni>().OnAni(animalState); isProvoke = false; }
public void Death() { hp = 0; if (hp <= 0) { animalState = eAnimalState.eDeath; GetComponent <AnimalAni>().OnAni(animalState); } }
public void MinusHP() { hp -= 1; if (hp <= 0) { animalState = eAnimalState.eDeath; GetComponent <AnimalAni>().OnAni(animalState); } }
public bool GetOnAni(eAnimalState state) { switch (state) { case eAnimalState.eDeath: return(GetComponent <Animator>().GetBool("IsDeath")); case eAnimalState.eMove: return(GetComponent <Animator>().GetBool("IsMove")); } return(false); }
IEnumerator StartTrace() { while (exclamationMark.transform.localScale.x < 0.01f) { exclamationMark.transform.localScale = new Vector3(exclamationMark.transform.localScale.x + 0.001f, exclamationMark.transform.localScale.y + 0.001f, exclamationMark.transform.localScale.z + 0.001f); if (exclamationMark.transform.localScale.x >= 0.01f) { yield return(new WaitForSeconds(1f)); animalState = eAnimalState.eMove; GetComponent <AnimalAni>().OnAni(animalState); exclamationMark.transform.localScale = new Vector3(0, 0, 0); StopCoroutine("StartTrace"); } yield return(new WaitForSeconds(0.01f)); } }
public void OnAni(eAnimalState state) { GetComponent <Animator>().SetBool("IsMove", false); GetComponent <Animator>().SetBool("IsDeath", false); switch (state) { case eAnimalState.eDeath: GetComponent <Animator>().SetBool("IsDeath", true); break; case eAnimalState.eIdle: break; case eAnimalState.eMove: GetComponent <Animator>().SetBool("IsMove", true); break; } }
public void CheckPlayerPosition() { if (animalState == eAnimalState.eDeath) { return; } float distance = Vector3.Distance(playerPosition.transform.localPosition, centerOfMass.transform.position); if (distance <= 15 && animalState != eAnimalState.eMove) { StartCoroutine("StartTrace"); } if (distance >= 25) { animalState = eAnimalState.eIdle; GetComponent <AnimalAni>().OnAni(animalState); } }