//public GameObject HitboxShoot; public override IEnumerator attack() { if (!canAttack()) { yield break; } owner.GetComponent <Controller>()._Animator.SetInteger("Attack", 2); yield return(new WaitForSeconds(0.25f)); Hitbox clone = Instantiate(Hitbox, transform.position, owner.transform.rotation) as Hitbox; clone.Owner = this.owner; clone.Damage = DamageRanged; clone.Duration = Range; clone.name = "Hitbox (" + this.name + " - " + this.owner.name + ")"; clone.Properties = this.Property.ToList(); clone.rigidbody.velocity = owner.transform.forward * VelocityRanged; clone.gameObject.SetActive(true); StartCoroutine(clone.Begin()); AudioSource.PlayClipAtPoint(audio, transform.position); yield return(new WaitForSeconds(0.5f)); }
public void CreateHitbox(Transform origin, float radius, int damage, float duration, string nameOfHitbox = null) { GameObject _obj = Instantiate(HitboxPrefab, origin.position, Quaternion.identity) as GameObject; Hitbox _hitbox = _obj.GetComponent <Hitbox>(); _hitbox.Owner = null; _hitbox.Radius = radius; _hitbox.Damage = damage; _hitbox.Duration = duration; _hitbox.name = nameOfHitbox ?? "Hitbox"; StartCoroutine(_hitbox.Begin()); }
public void CreateHitbox(Creature owner, float radius, int damage, Vector3 velocity, float duration, string nameOfHitbox = null) { GameObject _obj = Instantiate(HitboxPrefab, owner.transform.position + (owner.transform.forward * 0.5f), Quaternion.identity) as GameObject; Hitbox _hitbox = _obj.GetComponent <Hitbox>(); _hitbox.Owner = owner; _hitbox.Radius = radius; _hitbox.Damage = damage; _hitbox.Duration = duration; _hitbox.name = nameOfHitbox ?? "Hitbox (" + owner.name + ")"; _hitbox.SetVelocity(velocity); StartCoroutine(_hitbox.Begin()); }