private IEnumerator ShowAttackVisuals(EffectConnection effectsForType, float attackDuration) { var circlePrefab = effectsForType.effectCircle; var circle = GameObject.Instantiate(circlePrefab, transform.position, transform.rotation); circle.GetComponent <StickToTarget>().target = gameObject; yield return(new WaitForSeconds(attackDuration)); GameObject.Destroy(circle); }
void Start() { this.health = GetComponent <Health>(); this.attackHitbox = transform.Find("AttackHitbox").GetComponent <Collider2D>(); this.animator = GetComponent <Animator>(); this.faceMouseCursorBehaviour = GetComponent <FaceMouseCursor>(); this.knockbackBehaviour = GetComponent <Knockback>(); this.worldSpaceCanvas = GameObject.Find("WorldSpaceCanvas"); this.effectConnectionRed = this.effectConnectionRedPrefab.GetComponent <EffectConnection>(); this.effectConnectionGreen = this.effectConnectionGreenPrefab.GetComponent <EffectConnection>(); this.effectConnectionBlue = this.effectConnectionBluePrefab.GetComponent <EffectConnection>(); }