public override void Launch() { UnitHealth enemyUnit; foreach (RaycastHit hit in Physics.BoxCastAll(spellIndicator.transform.position, new Vector3(spellRange, 2f, 2f), Vector3.up)) { if (hit.collider.tag != this.tag && (enemyUnit = hit.collider.GetComponent <UnitHealth>()) != null) { enemyUnit.TakeDamage(spellPower); } } Destroy(spellIndicator); unit.GetComponent <Rigidbody>().AddForce(-unit.transform.forward * 50f, ForceMode.VelocityChange); rootStatus = new RootStatus(); if (!rootStatus.Init(unit.GetComponent <Unit>())) { rootStatus = null; } phaseStatus = new PhaseStatus(); if (!phaseStatus.Init(unit.GetComponent <Unit>())) { phaseStatus = null; } jumpTimer = jumpLenght; }
public override void Launch() { unit.GetComponent <UnitHealthShield>().AddShield(spellPower, shieldDuration, Clean); phaseStatus = new PhaseStatus(); phaseStatus.duration = shieldDuration; if (!phaseStatus.Init(unit.GetComponent <Unit>())) { phaseStatus = null; } speedStatus = new SpeedStatus(); speedStatus.duration = 0f; speedStatus.speedModifier = speedModifier; if (!speedStatus.Init(unit.GetComponent <Unit>())) { speedStatus = null; } spellVisual = Instantiate(visualEffectRef, unit.GetComponent <ControllableUnit>().unitCenter); }
protected override void Update() { if (jumpTimer > 0f) { jumpTimer -= Time.deltaTime; if (jumpTimer < 0f) { if (rootStatus != null) { rootStatus.OnStatusEnd(unit.GetComponent <Unit>()); rootStatus = null; } if (phaseStatus != null) { phaseStatus.OnStatusEnd(unit.GetComponent <Unit>()); phaseStatus = null; } unit.GetComponent <Rigidbody>().velocity = new Vector3(0f, 0f, 0f); Clean(); } } }