protected void detect(float move, float cRange, float aRange, attack atk) { //If current animation is not attacking if (currentBaseState.fullPathHash != attackState) { attacking = false; if (dNagi < cRange && health > 0) { //Set player to in combat StartCoroutine(SideChar.combat()); if (dNagi > aRange) { //This enables the walk animation anim.SetFloat("Speed", 1); //Set speed and walk towards palyer float step = movespeed * Time.deltaTime; transform.position = Vector3.MoveTowards(transform.position, target.transform.position, step); } else { //Do attack animation, trigger axe collider etc. atk(); } } else if (dDetect >= cRange && health > 0) { attacking = false; StartCoroutine("Back"); } } }
// Use this for initialization void Start() { health = 1; attacking = false; anim = gameObject.GetComponent <Animator>(); fallSound = GameObject.Find("OniFallSound").GetComponent <AudioSource>(); c = SideChar.Get(); }
void Start() { anim = GetComponent <Animator>(); forward = Camera.main.transform.forward; forward.y = 0; forward = Vector3.Normalize(forward); right = Quaternion.Euler(new Vector3(0, 90, 0)) * forward; s_RigidBody = GetComponent <Rigidbody>(); c = SideChar.Get(); grounded = true; dead = false; }
void Start() { anim = GetComponent <Animator>(); forward = Camera.main.transform.forward; forward.y = 0; forward = Vector3.Normalize(forward); right = Quaternion.Euler(new Vector3(0, 90, 0)) * forward; s_RigidBody = GetComponent <Rigidbody>(); c = SideChar.Get(); grounded = true; jumpSound = GameObject.Find("JumpSound").GetComponent <AudioSource>(); walkSound = GameObject.Find("WalkSound").GetComponent <AudioSource>(); //rollSound = GameObject.Find("RollSound").GetComponent<AudioSource>(); revive(); dead = false; }
public void die() { //Set layer to corpse layer StartCoroutine(SideChar.outCombat()); this.gameObject.layer = 10; //Disable collision with corpse this.GetComponent <CapsuleCollider>().isTrigger = true; this.GetComponent <SphereCollider>().enabled = false; //this.GetComponent<Rigidbody>().isKinematic = true; //Start death animation anim.SetTrigger("die"); StartCoroutine("playFalling"); //Disable weapon collider if (weapon != null) { weapon.GetComponent <BoxCollider>().enabled = false; } this.enabled = false; }
void Start() { c = SideChar.Get(); m_izanagi = Movement.Get().gameObject; m_izanami = Nami.Get(); }
SideChar() { c = this; }