Beispiel #1
0
    void Start()
    {
        ScrapCount   = GameObject.Find("ScrapCount" + PlayerNo.ToString()).GetComponent <Text>();
        HealthCount  = GameObject.Find("HealthCount" + PlayerNo.ToString()).GetComponent <Text>();
        HealthSlider = GameObject.Find("HPBar" + PlayerNo.ToString()).GetComponent <Image>();
        EnergySlider = GameObject.Find("EnergyBar" + PlayerNo.ToString()).GetComponent <Image>();

        playerHP     = GetComponent <Health>();
        playerScrap  = GetComponent <BarrierPlayersideLogic>();
        playerEnergy = GetComponent <PlayerMovScript>();
    }
Beispiel #2
0
    public void RepairBarrier(BarrierPlayersideLogic playerRes, int turretNumber)
    {
        if (playerRes.Resources >= (TurInformation[turretNumber].Cost / 2))
        {
            playerRes.Resources = playerRes.Resources - (TurInformation[turretNumber].Cost / 2);

            // Set Current Lifetime back to max lifetime
            TurInformation[turretNumber].curActiveTime = TurInformation[turretNumber].activeTime;
            Debug.Log("Repaired the Barrier!");
        }
    }
Beispiel #3
0
    public void UpgradeBarrier(BarrierPlayersideLogic playerRes)
    {
        Debug.Log("Upgrading!");

        if (playerRes.Resources >= Cost)
        {
            playerRes.Resources -= Cost;

            Level++;
            switch (Level)
            {
            case 0:
                Cost = Information.Cost.Level1;
                GetComponent <Health>().health    = Information.Health.Level1;
                GetComponent <Health>().maxHealth = Information.Health.Level1;
                break;

            case 1:
                Cost = Information.Cost.Level2;
                GetComponent <Health>().health    = Information.Health.Level2;
                GetComponent <Health>().maxHealth = Information.Health.Level2;
                break;

            case 2:
                Cost = Information.Cost.Level3;
                GetComponent <Health>().health    = Information.Health.Level3;
                GetComponent <Health>().maxHealth = Information.Health.Level3;
                break;

            case 3:
                Cost = Information.Cost.Level4;
                GetComponent <Health>().health    = Information.Health.Level4;
                GetComponent <Health>().maxHealth = Information.Health.Level4;
                break;

            case 4:
                Cost = Information.Cost.Level5;
                GetComponent <Health>().health    = Information.Health.Level5;
                GetComponent <Health>().maxHealth = Information.Health.Level5;
                break;
            }
        }
    }
Beispiel #4
0
    public void RepairBarrier(BarrierPlayersideLogic playerRes)
    {
        Debug.Log("Repairing! " + Cost / 2);

        if (playerRes.Resources >= (Cost / 2))
        {
            playerRes.Resources -= (Cost / 2);

            switch (Level)
            {
            case 0:
                Cost = Information.Cost.Level1;
                GetComponent <Health>().health    = Information.Health.Level1;
                GetComponent <Health>().maxHealth = Information.Health.Level1;
                break;

            case 1:
                Cost = Information.Cost.Level2;
                GetComponent <Health>().health    = Information.Health.Level2;
                GetComponent <Health>().maxHealth = Information.Health.Level2;
                break;

            case 2:
                Cost = Information.Cost.Level3;
                GetComponent <Health>().health    = Information.Health.Level3;
                GetComponent <Health>().maxHealth = Information.Health.Level3;
                break;

            case 3:
                Cost = Information.Cost.Level4;
                GetComponent <Health>().health    = Information.Health.Level4;
                GetComponent <Health>().maxHealth = Information.Health.Level4;
                break;

            case 4:
                Cost = Information.Cost.Level5;
                GetComponent <Health>().health    = Information.Health.Level5;
                GetComponent <Health>().maxHealth = Information.Health.Level5;
                break;
            }
        }
    }
Beispiel #5
0
    public void UpgradeBarrier(BarrierPlayersideLogic playerRes, int turretNumber)
    {
        if (TurInformation[turretNumber].Level < MaxLevel)
        {
            if (playerRes.Resources >= TurInformation[turretNumber].Cost)
            {
                playerRes.Resources = playerRes.Resources - TurInformation[turretNumber].Cost;

                switch (TurInformation[turretNumber].Level)
                {
                case 0:
                    // Set Level
                    TurInformation[turretNumber].Level++;
                    // Set Cost
                    TurInformation[turretNumber].Cost = LevInformation.Cost.Level1;
                    // Set Damage
                    TurInformation[turretNumber].DPS = LevInformation.Damage.Level1;
                    // Set Max Lifetime
                    TurInformation[turretNumber].activeTime = LevInformation.lifetime.Level1;
                    // Set Current Lifetime
                    TurInformation[turretNumber].curActiveTime = TurInformation[turretNumber].activeTime;
                    Debug.Log("Upgraded to lvl 1");

                    // UI Upgrades
                    if (turretNumber == 0)
                    {
                        UIPieceInfo.Cost1.text = ("Cost: " + LevInformation.Cost.Level1.ToString());
                    }
                    if (turretNumber == 1)
                    {
                        UIPieceInfo.Cost2.text = ("Cost: " + LevInformation.Cost.Level1.ToString());
                    }
                    if (turretNumber == 2)
                    {
                        UIPieceInfo.Cost3.text = ("Cost: " + LevInformation.Cost.Level1.ToString());
                    }
                    break;

                case 1:
                    // Set Level
                    TurInformation[turretNumber].Level++;
                    // Set Cost
                    TurInformation[turretNumber].Cost = LevInformation.Cost.Level2;
                    // Set Damage
                    TurInformation[turretNumber].DPS = LevInformation.Damage.Level2;
                    // Set Max Lifetime
                    TurInformation[turretNumber].activeTime = LevInformation.lifetime.Level2;
                    // Set Current Lifetime
                    TurInformation[turretNumber].curActiveTime = TurInformation[turretNumber].activeTime;
                    Debug.Log("Upgraded to lvl 2");

                    // UI Upgrades
                    if (turretNumber == 0)
                    {
                        UIPieceInfo.Cost1.text = ("Cost: " + LevInformation.Cost.Level2.ToString());
                    }
                    if (turretNumber == 1)
                    {
                        UIPieceInfo.Cost2.text = ("Cost: " + LevInformation.Cost.Level2.ToString());
                    }
                    if (turretNumber == 2)
                    {
                        UIPieceInfo.Cost3.text = ("Cost: " + LevInformation.Cost.Level2.ToString());
                    }
                    break;

                case 2:
                    // Set Level
                    TurInformation[turretNumber].Level++;
                    // Set Cost
                    TurInformation[turretNumber].Cost = LevInformation.Cost.Level3;
                    // Set Damage
                    TurInformation[turretNumber].DPS = LevInformation.Damage.Level3;
                    // Set Max Lifetime
                    TurInformation[turretNumber].activeTime = LevInformation.lifetime.Level3;
                    // Set Current Lifetime
                    TurInformation[turretNumber].curActiveTime = TurInformation[turretNumber].activeTime;
                    Debug.Log("Upgraded to lvl 3");

                    // UI Upgrades
                    if (turretNumber == 0)
                    {
                        UIPieceInfo.Cost1.text = ("Cost: " + LevInformation.Cost.Level3.ToString());
                    }
                    if (turretNumber == 1)
                    {
                        UIPieceInfo.Cost2.text = ("Cost: " + LevInformation.Cost.Level3.ToString());
                    }
                    if (turretNumber == 2)
                    {
                        UIPieceInfo.Cost3.text = ("Cost: " + LevInformation.Cost.Level3.ToString());
                    }
                    break;

                case 3:
                    // Set Level
                    TurInformation[turretNumber].Level++;
                    // Set Cost
                    TurInformation[turretNumber].Cost = LevInformation.Cost.Level4;
                    // Set Damage
                    TurInformation[turretNumber].DPS = LevInformation.Damage.Level4;
                    // Set Max Lifetime
                    TurInformation[turretNumber].activeTime = LevInformation.lifetime.Level4;
                    // Set Current Lifetime
                    TurInformation[turretNumber].curActiveTime = TurInformation[turretNumber].activeTime;
                    Debug.Log("Upgraded to lvl 4");

                    // UI Upgrades
                    if (turretNumber == 0)
                    {
                        UIPieceInfo.Cost1.text = ("Cost: " + LevInformation.Cost.Level4.ToString());
                    }
                    if (turretNumber == 1)
                    {
                        UIPieceInfo.Cost2.text = ("Cost: " + LevInformation.Cost.Level4.ToString());
                    }
                    if (turretNumber == 2)
                    {
                        UIPieceInfo.Cost3.text = ("Cost: " + LevInformation.Cost.Level4.ToString());
                    }
                    break;

                case 4:
                    // Set Level
                    TurInformation[turretNumber].Level++;
                    // Set Cost
                    TurInformation[turretNumber].Cost = LevInformation.Cost.Level5;
                    // Set Damage
                    TurInformation[turretNumber].DPS = LevInformation.Damage.Level5;
                    // Set Max Lifetime
                    TurInformation[turretNumber].activeTime = LevInformation.lifetime.Level5;
                    // Set Current Lifetime
                    TurInformation[turretNumber].curActiveTime = TurInformation[turretNumber].activeTime;
                    Debug.Log("Upgraded to lvl 5");

                    // UI Upgrades
                    if (turretNumber == 0)
                    {
                        UIPieceInfo.Cost1.text = ("Cost: " + LevInformation.Cost.Level5.ToString());
                    }
                    if (turretNumber == 1)
                    {
                        UIPieceInfo.Cost2.text = ("Cost: " + LevInformation.Cost.Level5.ToString());
                    }
                    if (turretNumber == 2)
                    {
                        UIPieceInfo.Cost3.text = ("Cost: " + LevInformation.Cost.Level5.ToString());
                    }
                    break;
                }
            }
            else
            {
                Debug.Log("More Money Needed");
            }
        }
        else
        {
            Debug.Log("Already At Max Level");
        }
    }