Exemple #1
0
    private void OnTriggerEnter(Collider other)
    {
        if (other.CompareTag("Orb"))
        {
            PowerController powerController = other.GetComponent <PowerController>();

            if (type == ElectricPylonType.Classic)
            {
                //if the electric pylon is not active and the orb is on fire, set the brazier on and activates the object if not null
                if (!isActive && powerController.elementalPower == GameManager.PowerType.Electric)
                {
                    this.Activate();
                }
                //if the electric pylon is active and the orb isn't (else refrech the duration of the power)
                else if (isActive)
                {
                    powerController.ActivatePower(GameManager.PowerType.Electric, "forced");
                }
            }

            if (type == ElectricPylonType.ArenaElectricPylon)
            {
                powerController.ActivatePower(GameManager.PowerType.Electric, "forced");
                Deactivate();
                StartCoroutine(ReActivateArenaElectricPylon());
            }
        }
    }
    private void OnTriggerEnter(Collider other)
    {
        if (other.CompareTag("Orb"))
        {
            PowerController powerController = other.GetComponent <PowerController>();

            if (type == BrazierType.Classic)
            {
                //if the brazier is not active and the orb is on fire, set the brazier on and activates the object if not null
                if (!isActive && powerController.elementalPower == GameManager.PowerType.Fire && activatedByOrb)
                {
                    this.Activate();
                }
                //if the brazier is active and the orb isn't, set the orb on fire
                else if (isActive && activatedByOrb)
                {
                    powerController.ActivatePower(GameManager.PowerType.Fire, "forced");
                    powerController.isActivatedByBrazier = true;
                }
            }

            if (type == BrazierType.ArenaBrazier)
            {
                if (isActive)
                {
                    powerController.ActivatePower(GameManager.PowerType.Fire, "forced");
                    powerController.isActivatedByBrazier = true;
                    Deactivate();
                    StartCoroutine(ReActivateArenaBrazier());
                }
                else if (!isActive && powerController.elementalPower == GameManager.PowerType.Fire)
                {
                    this.Activate();
                }
            }
        }
    }