public override void UpdateCaster() { base.UpdateCaster(); if (firing) { foreach (Collider collider in Physics.OverlapCapsule(spellCaster.ragdollHand.transform.position + (-spellCaster.ragdollHand.transform.forward * 0.7f), spellCaster.ragdollHand.transform.position + (-spellCaster.ragdollHand.transform.forward * 10f), 0.65f)) { if (collider.attachedRigidbody) { Rigidbody rb = collider.attachedRigidbody; rb.AddForce(-(spellCaster.magic.position - rb.transform.position).normalized * currentCharge * 3 * rb.mass, ForceMode.Acceleration); if (rb.GetComponentInParent <Creature>() && rb.GetComponentInParent <Creature>() != Player.currentCreature) { Creature x = rb.gameObject.GetComponentInParent <Creature>(); if (x.gameObject.GetComponent <Frozen>()) { x.gameObject.GetComponent <Frozen>().Lower(0.02f * Time.deltaTime); } else { Frozen frozen = x.gameObject.AddComponent <Frozen>(); frozen.Lower(0.02f * Time.deltaTime); } } } } } }
void Update() { if (Vector3.Dot(hand.rb.velocity.normalized, hand.transform.right) <= -0.9f && hand.rb.velocity.sqrMagnitude > (Player.local.locomotion.velocity.sqrMagnitude - 10)) { foreach (Collider collider in Physics.OverlapCapsule(hand.transform.position + (-hand.transform.right * 0.7f), hand.transform.position + (-hand.transform.right * 1f), 0.65f)) { if (collider.attachedRigidbody) { Rigidbody rb = collider.attachedRigidbody; rb.AddForce(-(hand.transform.position - rb.transform.position).normalized * hand.rb.velocity.sqrMagnitude, ForceMode.Acceleration); if (rb.GetComponentInParent <Creature>() && rb.GetComponentInParent <Creature>() != Player.currentCreature) { Creature x = rb.gameObject.GetComponentInParent <Creature>(); if (x.gameObject.GetComponent <Frozen>()) { x.gameObject.GetComponent <Frozen>().Lower(0.07f * Time.deltaTime); } else { Frozen frozen = x.gameObject.AddComponent <Frozen>(); frozen.Lower(0.07f * Time.deltaTime); } } } } } }
public override void UpdateImbue() { base.UpdateImbue(); foreach (Creature creature in Creature.list) { if (Vector3.Distance(creature.transform.position, imbue.transform.position) < 4 && creature != Player.currentCreature) { if (!creature.gameObject.GetComponent <Frozen>()) { creature.gameObject.AddComponent <Frozen>(); } Frozen frozen = creature.gameObject.GetComponent <Frozen>(); frozen.Lower(0.05f * Time.deltaTime); } } }
public override void OnImbueCollisionStart(ref CollisionStruct collisionInstance) { base.OnImbueCollisionStart(ref collisionInstance); if (collisionInstance.damageStruct.hitRagdollPart?.ragdoll.creature) { Creature x = collisionInstance.damageStruct.hitRagdollPart.ragdoll.creature; if (x.gameObject.GetComponent <Frozen>()) { x.gameObject.GetComponent <Frozen>().Lower(Mathf.Clamp(collisionInstance.damageStruct.damage / 10, 0.01f, .25f)); } else { Frozen frozen = x.gameObject.AddComponent <Frozen>(); frozen.Lower(Mathf.Clamp(collisionInstance.damageStruct.damage / 10, 0.01f, .25f)); } } }