private void OnCollisionEnter(Collision collision) { if (exposion != null && detonateOnImpact) { poolSystem.Spawn(exposion, collision.GetContact(0).point, Quaternion.LookRotation(collision.GetContact(0).normal)); StaticHelperClass.DamageArea(collision.GetContact(0).point, exposionRadius, damage); ResetVelocity(); poolSystem.poolDictionary["grenade-mk2"].Enqueue(gameObject); gameObject.SetActive(false); } }
public GameObject InstantiateSceneObject(string prefabId, Vector3 position, Quaternion rotation) { GameObject go = PoolSystem.Spawn(prefabId); go.transform.position = position; go.transform.rotation = rotation; return(go); }
private void OnCollisionEnter(Collision other) { if (hitEffect != null) { if (other.gameObject.GetComponent <Enemy>() != null) { hitEffect.transform.GetChild(1).GetComponent <ParticleSystemRenderer>().sharedMaterial.color = Color.red; } else { hitEffect.transform.GetChild(1).GetComponent <ParticleSystemRenderer>().sharedMaterial.color = new Color(1, 0.99f, 0.8f); } poolSystem.Spawn(hitEffect, other.GetContact(0).point, Quaternion.LookRotation(other.GetContact(0).normal)); if (areaDamage) { StaticHelperClass.DamageArea(other.GetContact(0).point, areaRadius, weaponDamage); } } ResetVelocity(); poolSystem.poolDictionary[bulletName].Enqueue(gameObject); gameObject.SetActive(false); }
protected virtual void PickUp(IPickable pickingPerson) { poolSystem.Spawn(pickUpAudio, transform.position, Quaternion.identity); GetComponent <MeshRenderer>().enabled = false; GetComponent <Collider>().enabled = false; }