private void OnCollisionStay2D(Collision2D collision)
 {
     if (powered)
     {
         if (collision.gameObject.GetComponent <BurnableObject>())
         {
             BurnableObject bObject = collision.gameObject.GetComponent <BurnableObject>();
             bObject.Burn();
         }
     }
 }
示例#2
0
    private void HandlerGroup51()
    {
        levelManager.InstantiatePortal("WarriorTeleporter", new Vector2(-49.273f, -1.56f), new Vector2(-20.7f, 0.5f), true, 1);
        BurnableObject treeToBurn = GameObject.Find("TreeAltarHolder").GetComponent <BurnableObject>();

        treeToBurn.Burn();

        GameObject mageFeedback = GameObject.Find("ActivateNPCForGreen2");

        if (mageFeedback)
        {
            Destroy(mageFeedback);
        }
    }
示例#3
0
    protected virtual void OnTriggerEnter2D(Collider2D other)
    {
        if (other.GetComponent <DamagingObject>())
        {
            if (!levelManager.GetMage().ProtectedByShield(gameObject))
            {
                for (int i = 0; i < playerControllers.Length; i++)
                {
                    if (playerControllers[i] != null)
                    {
                        PlayerController playerToRelease = playerControllers[i];
                        playerControllers[i] = null;
                        playerToRelease.ResetTransform();
                        playerToRelease.TakeDamage(10, new Vector2(150f, 15f));
                        playerToRelease.parent = null;
                    }
                }
                Destroy(parasiteParticle.gameObject);
                Destroy(gameObject);
            }
        }

        if (other.GetComponent <DestroyableObject>())
        {
            if (levelManager.GetWarrior().IsWarriored(gameObject))
            {
                DestroyableObject destroyable = other.GetComponent <DestroyableObject>();
                destroyable.DestroyMe(true);
            }
            else
            {
                for (int i = 0; i < playerControllers.Length; i++)
                {
                    if (playerControllers[i] != null)
                    {
                        PlayerController playerToRelease = playerControllers[i];
                        playerControllers[i] = null;
                        playerToRelease.ResetTransform();
                        playerToRelease.TakeDamage(10, new Vector2(150f, 15f));
                        playerToRelease.parent = null;
                    }
                }
                Destroy(parasiteParticle.gameObject);
                Destroy(gameObject);
            }
        }

        if (other.GetComponent <BurnableObject>())
        {
            if (levelManager.GetWarrior().IsWarriored(gameObject))
            {
                BurnableObject burnable = other.GetComponent <BurnableObject>();
                burnable.Burn();
            }
            else
            {
                for (int i = 0; i < playerControllers.Length; i++)
                {
                    if (playerControllers[i] != null)
                    {
                        PlayerController playerToRelease = playerControllers[i];
                        playerControllers[i] = null;
                        playerToRelease.ResetTransform();
                        playerToRelease.TakeDamage(10, new Vector2(150f, 15f));
                        playerToRelease.parent = null;
                    }
                }
                Destroy(parasiteParticle.gameObject);
                Destroy(gameObject);
            }
        }

        if (other.GetComponent <KillingObject>() && other.GetComponent <KillingObject>().activated)
        {
            if (!other.GetComponent <DarkElectricity>())
            {
                if (levelManager.GetMage().ProtectedByShield(gameObject))
                {
                    for (int i = 0; i < playerControllers.Length; i++)
                    {
                        if (playerControllers[i] != null)
                        {
                            PlayerController playerSaved = playerControllers[i];
                            Physics2D.IgnoreCollision(playerSaved.GetComponent <BoxCollider2D>(), other.GetComponent <Collider2D>(), true);
                        }
                    }
                }

                else if (!levelManager.GetMage().ProtectedByShield(gameObject))
                {
                    for (int i = 0; i < playerControllers.Length; i++)
                    {
                        if (playerControllers[i] != null)
                        {
                            PlayerController playerToRelease = playerControllers[i];
                            playerControllers[i] = null;
                            playerToRelease.ResetTransform();
                            playerToRelease.parent = null;
                        }
                    }
                    Destroy(parasiteParticle.gameObject);
                    Destroy(gameObject);
                }
            }
            else if (other.GetComponent <DarkElectricity>())
            {
                if (levelManager.GetEngineer().IsElectrified(gameObject))
                {
                    for (int i = 0; i < playerControllers.Length; i++)
                    {
                        if (playerControllers[i] != null)
                        {
                            PlayerController playerSaved = playerControllers[i];
                            Physics2D.IgnoreCollision(playerSaved.GetComponent <BoxCollider2D>(), other.GetComponent <Collider2D>(), true);
                        }
                    }
                }
                else
                {
                    for (int i = 0; i < playerControllers.Length; i++)
                    {
                        if (playerControllers[i] != null)
                        {
                            PlayerController playerToRelease = playerControllers[i];
                            playerControllers[i]   = null;
                            playerToRelease.parent = null;
                            playerToRelease.ResetTransform();
                        }
                    }
                    Destroy(parasiteParticle.gameObject);
                    Destroy(gameObject);
                }
            }
        }
    }
示例#4
0
    protected override void OnCollisionEnter2D(Collision2D other)
    {
        if (GameObjectIsPlayer(other.gameObject))
        {
            DealDamage(other.gameObject);
            DestroyMeAndParticles();
        }

        if (GameObjectIsEnemy(other.gameObject))
        {
            if (CheckIfImWarriored(gameObject))
            {
                KillEnemy(other.gameObject);
                DestroyMeAndParticles();
            }

            if (CheckIfImMaged())
            {
                GetThisEnemyMaged(other.gameObject);
                DestroyMeAndParticles();
            }

            DestroyMeAndParticles();
        }

        if (GameObjectIsDestroyable(other.gameObject))
        {
            if (CheckIfImWarriored(gameObject))
            {
                DestroyableObject destroyable = other.gameObject.GetComponent <DestroyableObject>();
                destroyable.DestroyMe(true);
                DestroyMeAndParticles();
            }

            DestroyMeAndParticles();
        }

        if (GameObjectIsDeactivableKillPlane(other.gameObject))
        {
            if (CheckIfImWarriored(gameObject))
            {
                KillingObject kObject = other.gameObject.GetComponent <KillingObject>();
                kObject.HitByPoweredDamaging();
                DestroyMeAndParticles();
            }

            if (CheckIfImMaged())
            {
                KillingObject kObject = other.gameObject.GetComponent <KillingObject>();
                kObject.HitByPoweredDamaging();
                DestroyMeAndParticles();
            }
        }

        if (GameObjectIsBurnable(other.gameObject))
        {
            if (CheckIfImWarriored(gameObject))
            {
                BurnableObject bObject = other.gameObject.GetComponent <BurnableObject>();
                bObject.Burn();
                DestroyMeAndParticles();
            }
            DestroyMeAndParticles();
        }
    }
    protected void BurnObject(GameObject burnableObject)
    {
        BurnableObject bObject = burnableObject.GetComponent <BurnableObject>();

        bObject.Burn();
    }