private IEnumerator aquireATK() { isATKing = true; Animator ani = GetComponent <Animator>(); ani.SetBool("Attack", true); yield return(new WaitForSeconds(atkStartSwing)); if (soundEffect) { Instantiate(soundEffect, transform.position, transform.localRotation); } if (!rangedATK) { if (target != null) { target.GetDamage(damage); Instantiate(meleeEffect, target.transform.position + (transform.up * 2), transform.localRotation); } else { } } else { ProjectieDummy proj = Instantiate(missile, projPoint.transform.position, transform.localRotation) as ProjectieDummy; if (target != null) { //proj.transform.LookAt(target.transform.position); Debug.Log("Throw to Target"); proj.StartProj(target.transform.position, stat.GetOwner(), damage); } else { //proj.transform.LookAt(transform.position + (transform.forward * atkRange)); Debug.Log("Throw to Point"); proj.StartProj(transform.position + (transform.forward * atkRange), stat.GetOwner(), damage); } } ani.SetBool("Attack", false); yield return(new WaitForSeconds(atkStopSwing)); UnitMove uni = GetComponent <UnitMove>(); uni.OrderMove(Vector3.one); isATKing = false; yield return(null); }
void OnTriggerEnter(Collider other) { UnitStatSystem uni = other.gameObject.GetComponent <UnitStatSystem>(); if ((uni != null && uni.GetOwner() != ownerNum && !AllianceSystem.CheckAlly(ownerNum, uni.GetOwner())) || other.gameObject.tag == "Terrain") { if (uni != null && uni.GetAlive()) { uni.GetDamage(damage); } if (soundEff) { Instantiate(soundEff, transform.position, transform.localRotation); } Destroy(this.gameObject); } }