Exemplo n.º 1
0
 void OnTriggerEnter2D(Collider2D other)
 {
     // if colliding with an enemy, deal damage play hit animation
     if (other.CompareTag("Enemy") && !deactivating)
     {
         Burnable burnableScript = other.GetComponent <Burnable>();
         if (burnableScript != null)
         {
             burnableScript.Burn(baseDamage);
         }
         else
         {
             Debug.LogError("Enemy not burning.");
         }
         if (owner != null)
         {
             PlayerStatus playerStatusReference = owner.GetComponent <PlayerStatus>();
             if (playerStatusReference != null)
             {
                 playerStatusReference.gainEnergy(1f);
             }
         }
         speed = 0f;
         StartCoroutine(Deactivate());
     }
     else if (other.transform.parent != null)
     {
         if (other.transform.parent.gameObject.CompareTag("bat"))
         {
             other.transform.parent.gameObject.SetActive(false);
             StartCoroutine(Deactivate());
         }
     }
 }
Exemplo n.º 2
0
 void BurnTarget()
 {
     previouslyHitBurnable = null;
     CheckBurnablePossibilities();
     if (targetBurnable != null && playerHandConfig.hasFire)
     {
         if (!targetBurnable.IsLit)
         {
             targetBurnable.Burn();
             playerHandConfig.triggerThrow = true;
         }
     }
 }
Exemplo n.º 3
0
    /// <summary>
    /// Checks the colliding objects if they can burn and stops the fire from falling once it hits something
    /// </summary>
    /// <param name="collision">The object wich the Fire collided with</param>
    private void OnCollisionEnter(Collision collision)
    {
        Burnable bur = collision.gameObject.GetComponentInChildren <Burnable>();

        if (bur != null)
        {
            Rigidbody rb = GetComponent <Rigidbody>();
            rb.isKinematic = true;
            rb.useGravity  = false;
            rb.constraints = RigidbodyConstraints.FreezeAll;

            bur.Burn(this);
        }
    }
Exemplo n.º 4
0
    public void OnTriggerEnter2D(Collider2D other)
    {
        Burnable burnable = other.GetComponent <Burnable>();

        if (GetComponent <SelfDestruction>() == null && burnable && !burnable.IsBurning())
        {
            HeatmapEvent.Send("BurnedVegetation2", transform.position, Time.timeSinceLevelLoad);
            KHeatmap.Log("BurnedVegetation2", transform.position);
            burnable.Burn();
        }

        //if (other.GetComponent<ChargeRecharge>())
        //boostEffect(true);
    }
    //Server call only, no call on client.
    //ServerCallback is similar to Server but doesn't generate a warning when called on client.
    void OnTriggerEnter(Collider other)
    {
        if (other.tag == "Shield")
        {
            other.GetComponent <Shield>().Break();
            Destroy(GetComponent <SphereCollider>(), 0);
        }
        else if (other.tag == "Spell_Interactable")
        {
            SpellInteractable si = other.GetComponent <SpellInteractable>();
            Burnable          b  = other.GetComponent <Burnable>();
            if (si != null)
            {
                si.Trigger("fireball");
            }
            if (b != null)
            {
                b.Burn();
            }
            Destroy(GetComponent <SphereCollider>(), 0);
        }
        else if (other.tag == "Enemy")
        {
            EnemyAI  enemy = other.GetComponent <EnemyAI>();
            CasterAI ci    = other.GetComponent <CasterAI>();
            if (enemy != null)
            {
                enemy.TakeDamage("fire", damage);
            }
            if (ci != null)
            {
                ci.TakeDamage("fire", damage);
            }
        }
        else if (other.tag == "Player")
        {
            Player player = other.GetComponent <Player>();
            if (player != null)
            {
                player.WeaponHit(damage);
            }
        }

        Rigidbody r = other.GetComponent <Rigidbody>();

        if (r != null)
        {
            r.AddExplosionForce(explosionForce, transform.position, 2f);
        }
    }
Exemplo n.º 6
0
Arquivo: Burnable.cs Projeto: mz000/QQ
    // TODO: find a way so we don't have this many getcomponents
    private void BurnEffect()
    {
        colliders = Physics2D.OverlapCircleAll(transform.position, radius);

        if (colliders.Length >= 1)
        {
            for (int i = 0; i < colliders.Length; i++)
            {
                Burnable adjucantBurnable = colliders[i].GetComponent <Burnable>();
                if (adjucantBurnable != null && !adjucantBurnable.burning && !colliders[i].isTrigger)
                {
                    adjucantBurnable.Burn();
                }

                _obj.Hurt(5);
            }
        }
    }