void OnTriggerStay2D(Collider2D collider)
    {
        if (collider.gameObject.name == "Turret1Check" && upgradingTurretsBool == false)
        {
            turretScript = collider.gameObject.GetComponentInParent <Turret>();


            UpgradingTurretsObjects[0] = turretScript.upgradeButtons[0];
            UpgradingTurretsObjects[0].SetActive(true);
            UpgradingTurretsObjects[1].SetActive(true);

            upgradingTurretsBool = true;
        }

        if (collider.gameObject.name == "Turret2Check" && upgradingTurretsBool == false)
        {
            turret2Script = collider.gameObject.GetComponentInParent <Turret2>();

            UpgradingTurretsObjects[2] = turret2Script.upgradeWindows[0];

            UpgradingTurretsObjects[2].SetActive(true);
            UpgradingTurretsObjects[3].SetActive(true);

            upgradingTurretsBool = true;
        }

        if (collider.gameObject.tag == "TurretZone" && gC.purchaseTurretWindow == false)
        {
            buyingTurretScript = collider.gameObject.GetComponent <BuyingTurret>();
            if (buyingTurretScript.turretSpawned == false)
            {
                purchaseTurretButtons[0] = buyingTurretScript.purchaseTurretsButton[0];
                purchaseTurretButtons[0].SetActive(true);
                purchaseTurretButtons[1].SetActive(true);

                gC.purchaseTurretWindow = true;
                //buyingTurretScript.turretSpawned = true;
            }
        }
    }
예제 #2
0
    private void OnTriggerStay2D(Collider2D collision)
    {
        if (collision.gameObject.name == "Turret1Check" && upgradingTurretsBool == false)
        {
            turretScript = collision.gameObject.GetComponentInParent <Turret>();

            openWindow = true;
            UpgradingTurretsObjects[0] = turretScript.upgradeButtons[0];
            UpgradingTurretsObjects[1] = turretScript.upgradeButtons[1];
            UpgradingTurretsObjects[0].SetActive(true);
            UpgradingTurretsObjects[1].SetActive(true);
            UpgradingTurretsObjects[2].SetActive(true);

            upgradingTurretsBool = true;
        }

        // this if statement is only used to reset test to false so that OnClickEvent() starts being called again
        if (collision.gameObject.name == "Turret1Check")
        {
            if (pauseMovement == true)
            {
                pauseMovement = false;
            }
        }

        //using turret2check so the range collider doesnt trigger
        if (collision.gameObject.name == "Turret2Check" && upgradingTurretsBool == false)
        {
            turret2Script = collision.gameObject.GetComponentInParent <Turret2>();

            UpgradingTurretsObjects[3] = turret2Script.upgradeWindows[0];
            UpgradingTurretsObjects[4] = turret2Script.upgradeWindows[1];
            openWindow = true;

            UpgradingTurretsObjects[3].SetActive(true);
            UpgradingTurretsObjects[4].SetActive(true);
            UpgradingTurretsObjects[5].SetActive(true);

            upgradingTurretsBool = true;
        }

        // this if statement is only used to reset test to false so that OnClickEvent() starts being called again
        if (collision.gameObject.name == "Turret2Check")
        {
            if (pauseMovement == true)
            {
                pauseMovement = false;
            }
        }

        if (collision.gameObject.name == "Turret3Check" && upgradingTurretsBool == false)
        {
            turret3Script = collision.gameObject.GetComponentInParent <Turret3>();
            UpgradingTurretsObjects[6] = turret3Script.upgradeWindows[0];
            UpgradingTurretsObjects[8] = turret3Script.upgradeWindows[1];
            openWindow = true;

            UpgradingTurretsObjects[6].SetActive(true);

            UpgradingTurretsObjects[7].SetActive(true);

            UpgradingTurretsObjects[8].SetActive(true);

            upgradingTurretsBool = true;
        }

        // this if statement is only used to reset test to false so that OnClickEvent() starts being called again
        if (collision.gameObject.name == "Turret3Check")
        {
            if (pauseMovement == true)
            {
                pauseMovement = false;
            }
        }

        if (collision.gameObject.tag == "TurretZone" && gC.purchaseTurretWindow == false)
        {
            buyingTurretScript = collision.gameObject.GetComponent <BuyingTurret>();
            if (buyingTurretScript.turretSpawned == false)
            {
                purchaseTurretButtons[0] = buyingTurretScript.purchaseTurretsButton[0];
                purchaseTurretButtons[0].SetActive(true);
                purchaseTurretButtons[1].SetActive(true);

                openWindow = true;

                gC.purchaseTurretWindow = true;
            }
        }
    }