void Start() { attacking = false; InputModule = GetComponent <InputModule>(); SpellCaster = GetComponent <SpellCaster_Struggler>(); InputModule.OnMouseButtonPressed += Attack; AnimationEvents.OnSetAttackingToFalse += SetAttackingToFalse; AnimationEvents.OnSetAttackingToTrue += SetAttackingToTrue; }
private void Hit(HealthController x) { if (x.Health <= 0 || x.health <= x.MaxHealth / 3) { x.DoDamage(100f, null, null); GameObject casterGameObject = SpellInstance.caster.gameObject; Instantiate(shadowTeleportOriginParticle, casterGameObject.transform.position, Quaternion.Euler(new Vector3(0f, 0f, 0f))); casterGameObject.GetComponent <Rigidbody>().MovePosition(x.gameObject.transform.position); Instantiate(shadowTeleportDestinyParticle, x.gameObject.transform.position, Quaternion.Euler(new Vector3(0f, 0f, 0f))); if (SpellInstance.spellCaster is SpellCaster_Struggler) { SpellCaster_Struggler struggler = SpellInstance.spellCaster as SpellCaster_Struggler; struggler.ResetCooldown(spell); } } }
private void Start() { MovementModule = GetComponent <MovementModule>(); MovementModule.OnMove += Walking; MovementModule.OnStill += Idle; MovementModule.OnDodge += Dodge; SpellCaster = GetComponent <SpellCaster_Struggler>(); SpellCaster.OnTriggerCastTargetAnimation += CastTargetSpell; AttackModule = GetComponent <AttackModule>(); AttackModule.OnAttack += Attack; HealthController = GetComponent <HealthController>(); HealthController.OnDie += TriggerDie; Rigidbody = GetComponent <Rigidbody>(); }