public void Start() { levitated = false; grabbed = false; rigidBody = GetComponent <Rigidbody>(); chemistryObject = GetComponent <ChemistryObject>(); }
private void Explode() { if (exploded) { return; } exploded = true; Collider[] objectsInRange = Physics.OverlapSphere(transform.position, ExplosionRadius); foreach (Collider objectHit in objectsInRange) { if (objectHit.isTrigger) //Ignores non-physical objects { continue; } if (objectHit.name == gameObject.name) //Ignore self { continue; } ChemistryObject chemistry = objectHit.GetComponent <ChemistryObject>(); if (chemistry != null) { chemistry.ChemistryInteraction(ExplosionDamage, Element.Fire); } } GameObject explosion = Instantiate(ExplosionEffect, transform.position, Quaternion.identity); explosion.GetComponent <Explosion>().Play(); }
void OnTriggerEnter(Collider collider) { ChemistryObject chemObj = collider.GetComponent <ChemistryObject>(); if (chemObj != null) { chemObj.ChemistryInteraction(damage, element); Trigger(); } }
protected virtual void Start() { frozen = false; currentFrostHealth = maxFrostHealth; currentFrozenTime = 0; meshRenderer = gameObject.GetComponentInChildren <MeshRenderer>(); normalMaterial = meshRenderer.material; frostHealthRegenRate = maxFrostHealth * .1f; chemObject = GetComponent <ChemistryObject>(); }
protected void OnCollisionEnter(Collision collision) { ChemistryObject otherObject = collision.gameObject.GetComponent <ChemistryObject>(); if (collision.rigidbody != null) { TakePhysicsDamage(collision.relativeVelocity, collision.rigidbody.mass); } if (otherObject != null) { ChemistryInteraction(0, otherObject.elementalState); } }