Пример #1
0
 public void Start()
 {
     levitated       = false;
     grabbed         = false;
     rigidBody       = GetComponent <Rigidbody>();
     chemistryObject = GetComponent <ChemistryObject>();
 }
Пример #2
0
    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();
    }
Пример #3
0
    void OnTriggerEnter(Collider collider)
    {
        ChemistryObject chemObj = collider.GetComponent <ChemistryObject>();

        if (chemObj != null)
        {
            chemObj.ChemistryInteraction(damage, element);
            Trigger();
        }
    }
Пример #4
0
    protected virtual void Start()
    {
        frozen             = false;
        currentFrostHealth = maxFrostHealth;
        currentFrozenTime  = 0;

        meshRenderer         = gameObject.GetComponentInChildren <MeshRenderer>();
        normalMaterial       = meshRenderer.material;
        frostHealthRegenRate = maxFrostHealth * .1f;
        chemObject           = GetComponent <ChemistryObject>();
    }
Пример #5
0
    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);
        }
    }