private void Update() { var direction = (UtilsClass.GetMousePosition2D() - transform.position).normalized; var len = UtilsClass.HypotenuseLength(direction.x, direction.y); var factor = 1.0f / (len == 0 ? Mathf.Epsilon : len); direction = new Vector3(direction.x * factor, direction.y * factor, direction.z); transform.rotation = Quaternion.LookRotation(direction); lastConsumeTime += Time.deltaTime; if (lastConsumeTime > timeTillConsume) { lastConsumeTime = 0f; float cost = sustainManaCost; if ((name == "fire" || name == "flames") && st.effects.Contains("fire_charged")) { cost = 0.5f; } st.ConsumeMana(cost); if (st.GetMP() < 0) { Die(); } } //transform.rotation = Quaternion.Euler(direction); }
public void applyOnCast(StatsController stats) { if ((name == "fire" || name == "flames") && stats.effects.Contains("fire_charged")) { return; } stats.ConsumeMana(manaCost); }