Пример #1
0
    public void OpenMenu()
    {
        if (initialised == false)
        {
            LoadObjects();
        }

        heroScript = MasterScript.heroGUI.currentHero.GetComponent <HeroScriptParent> ();

        switch (heroScript.heroType)
        {
        case "Infiltrator":
            SetLabels(infiltratorStats, infiltratorStatVal);
            break;

        case "Soldier":
            SetLabels(soldierStats, soldierStatVal);
            break;

        case "Diplomat":
            SetLabels(diplomatStats, diplomatStatVal);
            break;

        default:
            break;
        }
    }
Пример #2
0
    public Vector3 HeroPositionAroundStar(GameObject location)
    {
        Vector3 position = new Vector3();

        heroScript = gameObject.GetComponent <HeroScriptParent> ();

        switch (heroScript.heroOwnedBy)
        {
        case "Humans":
            position.x = location.transform.position.x;
            position.y = location.transform.position.y + 2.5f;
            break;

        case "Selkies":
            position.x = location.transform.position.x + 2.5f;
            position.y = location.transform.position.y - 1.66f;
            break;

        case "Nereides":
            position.x = location.transform.position.x - 2.5f;
            position.y = location.transform.position.y - 1.66f;
            break;

        default:
            break;
        }

        position.z = location.transform.position.z;

        return(position);
    }
Пример #3
0
    private void SetDestinationSystem(int targetSystem, string task)
    {
        float offence   = 0f;
        int   hero      = -1;
        bool  foundHero = false;

        for (int k = 0; k < player.playerOwnedHeroes.Count; ++k)
        {
            heroScript = player.playerOwnedHeroes[k].GetComponent <HeroScriptParent>();

            if (offence < heroScript.assaultDamage && heroScript.isBusy == false)
            {
                offence   = heroScript.assaultDamage;
                hero      = k;
                foundHero = true;
            }
        }

        if (foundHero == true)
        {
            HeroMovement heroMovement = player.playerOwnedHeroes[hero].GetComponent <HeroMovement>();
            heroScript = player.playerOwnedHeroes[hero].GetComponent <HeroScriptParent>();

            heroMovement.FindPath(heroScript.heroLocation, MasterScript.systemListConstructor.systemList[targetSystem].systemObject, true);

            heroScript.isBusy = true;

            if (task == "Invade")
            {
                heroScript.aiInvadeTarget = targetSystem;
            }
        }
    }
Пример #4
0
    private void CheckForOtherHeroes()
    {
        for (int i = 0; i < MasterScript.playerTurnScript.playerOwnedHeroes.Count; ++i)
        {
            if (MasterScript.playerTurnScript.playerOwnedHeroes[i] == MasterScript.heroGUI.currentHero)
            {
                continue;
            }

            heroScript = MasterScript.playerTurnScript.playerOwnedHeroes[i].GetComponent <HeroScriptParent>();

            if (heroScript.heroLocation == MasterScript.systemListConstructor.systemList[system].systemObject)
            {
                if (includeHero2.activeInHierarchy == false && hero2Object == null)
                {
                    hero2Object = MasterScript.playerTurnScript.playerOwnedHeroes[i];
                    NGUITools.SetActive(includeHero2, true);
                    includeHero2.transform.Find("Label").GetComponent <UILabel>().text = "INCLUDE " + heroScript.heroType;
                    continue;
                }
                if (includeHero2.activeInHierarchy == true && hero3Object == null && includeHero3.activeInHierarchy == false)
                {
                    if (MasterScript.playerTurnScript.playerOwnedHeroes[i] != hero2Object)
                    {
                        hero3Object = MasterScript.playerTurnScript.playerOwnedHeroes[i];
                        NGUITools.SetActive(includeHero3, true);
                        includeHero3.transform.Find("Label").GetComponent <UILabel>().text = "INCLUDE" + heroScript.heroType;
                    }
                }
            }
        }
    }
Пример #5
0
 public void Promote()
 {
     heroScript                   = currentHero.GetComponent <HeroScriptParent> ();
     systemSIMData                = heroScript.heroLocation.GetComponent <SystemSIMData> ();
     systemSIMData.embargoedBy    = null;
     systemSIMData.promotedBy     = heroScript.heroOwnedBy;
     systemSIMData.promotionTimer = Time.time;
 }
Пример #6
0
    public void ShipAbilities(TurnInfo thisPlayer)
    {
        heroScript = gameObject.GetComponent <HeroScriptParent> ();
        system     = MasterScript.RefreshCurrentSystem(heroScript.heroLocation);

        ShipFunctions.UpdateShips();
        heroScript.assaultDamage = ShipFunctions.primaryWeaponPower * heroScript.assaultMod;
        heroScript.maxHealth     = ShipFunctions.armourRating * heroScript.healthMod;
        heroScript.movementSpeed = ShipFunctions.engineValue * heroScript.movementMod;

        if (heroScript.heroType == "Diplomat")
        {
            heroScript.auxiliaryDamage = ShipFunctions.dropshipPower * heroScript.auxiliaryMod;

            DiplomatFunctions((ShipFunctions.logisticsRating + 10), thisPlayer);

            canViewSystem = true;
        }

        if (heroScript.heroType == "Infiltrator")
        {
            heroScript.auxiliaryDamage = ShipFunctions.bombPower * heroScript.auxiliaryMod;

            canViewSystem = true;

            systemSIMData = MasterScript.systemListConstructor.systemList[system].systemObject.GetComponent <SystemSIMData>();

            if (MasterScript.systemListConstructor.systemList[system].systemOwnedBy != thisPlayer.playerRace)
            {
                if (ShipFunctions.stealthValue >= systemSIMData.antiStealthPower)
                {
                    hasStealth = true;
                }

                else
                {
                    hasStealth = false;
                }
            }

            if (ShipFunctions.infiltratorEngine == true)
            {
                heroScript.movementSpeed = 1000;
            }
        }

        if (heroScript.heroType == "Soldier")
        {
            heroScript.auxiliaryDamage = ShipFunctions.artilleryPower * heroScript.auxiliaryMod;

            if (ShipFunctions.soldierPrimary == true)
            {
                heroScript.assaultDamage = heroScript.assaultDamage * 2;
            }
        }
    }
Пример #7
0
    public void TurnEnd(TurnInfo selectedPlayer)     //This function accumulates all the SIM generated by each system to give an empire SIM value
    {
        selectedPlayer.researchCostModifier = 0;

        MasterScript.diplomacyScript.DiplomaticStateEffects();

        CalculateExpansionModifier(selectedPlayer);

        for (int i = 0; i < MasterScript.systemListConstructor.mapSize; ++i)
        {
            if (MasterScript.systemListConstructor.systemList[i].systemOwnedBy != selectedPlayer.playerRace)
            {
                continue;
            }

            SystemSIMData     systemSIMData     = MasterScript.systemListConstructor.systemList[i].systemObject.GetComponent <SystemSIMData>();
            ImprovementsBasic improvementsBasic = MasterScript.systemListConstructor.systemList[i].systemObject.GetComponent <ImprovementsBasic>();
            SystemDefence     systemDefence     = MasterScript.systemListConstructor.systemList[i].systemObject.GetComponent <SystemDefence>();

            systemDefence.CalculateSystemDefence();

            improvementsBasic.ActiveTechnologies(i, selectedPlayer);
            systemSIMData.SystemSIMCounter(selectedPlayer);
            MasterScript.systemFunctions.CheckUnlockedTier(improvementsBasic, i);

            selectedPlayer.knowledge += systemSIMData.totalSystemKnowledge;
            selectedPlayer.power     += systemSIMData.totalSystemPower;

            if (selectedPlayer.playerRace == "Selkies")
            {
                MasterScript.racialTraitScript.amber += systemSIMData.totalSystemAmber;
            }

            selectedPlayer.researchCostModifier += improvementsBasic.researchCost;
        }

        for (int j = 0; j < selectedPlayer.playerOwnedHeroes.Count; ++j)
        {
            HeroScriptParent heroScript = selectedPlayer.playerOwnedHeroes[j].GetComponent <HeroScriptParent>();
            heroScript.HeroEndTurnFunctions(selectedPlayer);
        }

        MasterScript.racialTraitScript.RacialBonus(selectedPlayer);

        MasterScript.turnInfoScript.SortSystemPower();

        if (selectedPlayer.wealth > 10000.0f)
        {
            selectedPlayer.wealth = 10000.0f;
        }

        selectedPlayer.planetsColonisedThisTurn = 0;

        selectedPlayer.systemsColonisedThisTurn = 0;
    }
Пример #8
0
    public void ShowHeroDetails()
    {
        for (int i = 0; i < 3; ++i)                                                                                                    //For all possible heroes
        {
            if (i < MasterScript.playerTurnScript.playerOwnedHeroes.Count)                                                             //If the possible hero corresponds to an actual hero
            {
                ActivateHeroUI(i, true);                                                                                               //Activate the heroUI
                heroScript = MasterScript.playerTurnScript.playerOwnedHeroes[i].GetComponent <HeroScriptParent>();                     //Get a reference to the hero script
                heroUIInterfaces[i].armour.text = Math.Round(heroScript.currentHealth, 1) + "/" + Math.Round(heroScript.maxHealth, 1); //Write the current armour level to a text box
                heroUIInterfaces[i].name.text   = heroScript.heroType + " Dude/Ette";                                                  //Write the name of the hero to a text box

                bool enemyOwned = false;                                                                                               //New bool to determine whether the system the hero is orbiting is currently owned by an enemy player
                bool unowned    = false;                                                                                               //New bool to determinte whether the system the hero is orbiting is unowned

                if (MasterScript.systemListConstructor.systemList[heroScript.system].systemOwnedBy != heroScript.heroOwnedBy &&
                    MasterScript.systemListConstructor.systemList[heroScript.system].systemOwnedBy != null) //If the system is owned by someone that is not this player
                {
                    enemyOwned = true;                                                                      //It is enemy owned
                }
                if (MasterScript.systemListConstructor.systemList[heroScript.system].systemOwnedBy == null) //If it has no owner
                {
                    unowned = true;                                                                         //It is unowned
                }

                switch (heroScript.heroType)                //Switch to activate the class specific UI components
                {
                case "Diplomat":
                    DiplomatSwitchFunction(i, enemyOwned);                     //Diplomat takes the hero number and the enemy owned value
                    break;

                case "Soldier":
                    SoldierSwitchFunction(i, enemyOwned, unowned);                     //Soldier takes hero number, enemy owned value and unowned value
                    break;

                case "Infiltrator":
                    InfiltratorSwitchFunction(i, enemyOwned);                     //Infiltrator takes hero number and the enemy owned value
                    break;

                default:
                    Debug.Log("Invalid Hero");                      //If for some reason there is no hero write something to the console so I know there is an error
                    break;
                }
                continue;                 //Continue to the next possible hero
            }

            ActivateHeroUI(i, false);             //If the hero doesn't exist, disable the UI
        }
    }
Пример #9
0
    void Update()
    {
        if (Input.GetKeyDown("escape"))
        {
            NGUITools.SetActive(improvementScreen, false);
        }

        if (improvementScreen.activeInHierarchy == true)
        {
            heroScript = MasterScript.heroGUI.currentHero.GetComponent <HeroScriptParent> ();

            if (MasterScript.playerTurnScript.blueCarbon > 0)
            {
                statObject[0].button.enabled = true;
            }
            if (MasterScript.playerTurnScript.blueCarbon == 0)
            {
                statObject[0].button.enabled = false;
            }

            if (MasterScript.playerTurnScript.radioisotopes > 0)
            {
                statObject[1].button.enabled = true;
            }
            if (MasterScript.playerTurnScript.radioisotopes == 0)
            {
                statObject[1].button.enabled = false;
            }

            if (MasterScript.playerTurnScript.antimatter > 0)
            {
                statObject[2].button.enabled = true;
            }
            if (MasterScript.playerTurnScript.antimatter == 0)
            {
                statObject[2].button.enabled = false;
            }

            if (MasterScript.playerTurnScript.liquidH2 > 0)
            {
                statObject[3].button.enabled = true;
            }
            if (MasterScript.playerTurnScript.liquidH2 == 0)
            {
                statObject[3].button.enabled = false;
            }
        }
    }
Пример #10
0
    public void SpyOrEnterSystem()
    {
        heroScript = currentHero.GetComponent <HeroScriptParent> ();
        MasterScript.cameraFunctionsScript.CloseAllWindows();
        MasterScript.cameraFunctionsScript.selectedSystem       = heroScript.heroLocation;
        MasterScript.cameraFunctionsScript.selectedSystemNumber = MasterScript.RefreshCurrentSystem(heroScript.heroLocation);

        if (heroScript.heroType == "Infiltrator" || heroScript.heroType == "Diplomat")
        {
            MasterScript.cameraFunctionsScript.openMenu = true;
        }
        if (heroScript.heroType == "Soldier")
        {
            MasterScript.invasionGUI.openInvasionMenu = true;             //Open the invasion window through script
            MasterScript.invasionGUI.OpenPlanetInvasionScreen();
        }
    }
Пример #11
0
    public void CheckIfCanHire(TurnInfo player, string heroType)
    {
        if (player.wealth >= 50 && player.playerOwnedHeroes.Count < 7)
        {
            int i = MasterScript.RefreshCurrentSystem(GameObject.Find(player.homeSystem));

            GameObject instantiatedHero = (GameObject)Instantiate(MasterScript.heroGUI.heroObject, MasterScript.systemListConstructor.systemList[i].systemObject.transform.position,
                                                                  MasterScript.systemListConstructor.systemList[i].systemObject.transform.rotation);

            instantiatedHero.name = "Basic Hero_" + heroCounter;

            HeroScriptParent tempHero = instantiatedHero.GetComponent <HeroScriptParent>();

            tempHero.heroType = heroType;

            tempHero.heroLocation = MasterScript.systemListConstructor.systemList[i].systemObject;

            tempHero.heroOwnedBy = player.playerRace;

            HeroMovement tempMove = instantiatedHero.GetComponent <HeroMovement>();

            instantiatedHero.transform.position = tempMove.HeroPositionAroundStar(tempHero.heroLocation);

            ++heroCounter;

            player.wealth -= 50;

            player.playerOwnedHeroes.Add(instantiatedHero);

            switch (tempHero.heroType)
            {
            case "Soldier":
                tempHero.classModifier = 1.75f;
                break;

            case "Infiltrator":
                tempHero.classModifier = 1f;
                break;

            case "Diplomat":
                tempHero.classModifier = 1.5f;
                break;
            }
        }
    }
Пример #12
0
    void Update()
    {
        if (MasterScript.heroGUI.currentHero != null)                                            //If a hero is selected
        {
            heroScript    = MasterScript.heroGUI.currentHero.GetComponent <HeroScriptParent> (); //Get references to hero scripts
            systemDefence = heroScript.heroLocation.GetComponent <SystemDefence> ();             //And the defence script of that system

            if (systemDefence.underInvasion == true && openInvasionMenu == true)                 //If system is under invasion and the invasion menu is open
            {
                UpdateOpenMenuItems();
            }
        }

        if (openInvasionMenu == false)
        {
            UpdateClosedMenuItems();
            management.allTokens.Clear();
        }
    }
Пример #13
0
    public void OpenPlanetInvasionScreen()
    {
        NGUITools.SetActive(invasionScreen, true);

        heroScript = MasterScript.heroGUI.currentHero.GetComponent <HeroScriptParent> ();

        system = MasterScript.RefreshCurrentSystem(heroScript.heroLocation);

        int loadSystem = loadInvasion.CheckForExistingInvasion(system);

        if (loadSystem != -1)
        {
            loadInvasion.ReloadInvasionScreen(loadSystem);
            createdTokens = true;
        }

        systemDefence = MasterScript.systemListConstructor.systemList [system].systemObject.GetComponent <SystemDefence> ();

        systemDefence.underInvasion = true;

        LayoutPlanets(system);
    }
Пример #14
0
    private void UpdateHeroInterfaces()
    {
        for (int i = 0; i < 3; ++i)
        {
            if (hero2Object != null && i == 1 && includeHero2.activeInHierarchy == false || hero3Object != null && i == 2 && includeHero3.activeInHierarchy == false || i == 0)
            {
                NGUITools.SetActive(heroInterfaces [i], true);

                switch (i)
                {
                case 0:
                    heroScript = MasterScript.heroGUI.currentHero.GetComponent <HeroScriptParent>();
                    break;

                case 1:
                    heroScript = hero2Object.GetComponent <HeroScriptParent>();
                    break;

                case 2:
                    heroScript = hero3Object.GetComponent <HeroScriptParent>();
                    break;

                default:
                    break;
                }

                heroInvasionLabels [i].health.text = heroScript.currentHealth + "/" + heroScript.maxHealth + " HEALTH";
                heroInvasionLabels [i].name.text   = "A HERO";
                heroInvasionLabels [i].type.text   = heroScript.heroType;

                heroInvasionLabels [i].assaultDamage.text           = Math.Round(heroScript.assaultDamage, 0) + " ASSAULT DAMAGE";
                heroInvasionLabels [i].assaultDamagePerToken.text   = Math.Round(heroScript.assaultDamage / (float)heroScript.assaultTokens, 0) + " PER";
                heroInvasionLabels [i].auxiliaryDamage.text         = Math.Round(heroScript.auxiliaryDamage, 0) + " AUXILIARY DAMAGE";
                heroInvasionLabels [i].auxiliaryDamagePerToken.text = Math.Round(heroScript.auxiliaryDamage / (float)heroScript.auxiliaryTokens, 0) + " PER";
                heroInvasionLabels [i].defence.text         = Math.Round(heroScript.defence, 0) + " DEFENCE";
                heroInvasionLabels [i].defencePerToken.text = Math.Round(heroScript.defence / (float)heroScript.defenceTokens, 0) + " PER";
            }
        }
    }
Пример #15
0
    private void SetLabels(string[] arr, float[] floatArr)
    {
        heroScript = MasterScript.heroGUI.currentHero.GetComponent <HeroScriptParent> ();

        for (int i = 0; i < 4; ++i)
        {
            string tempStr = null;

            statObject[i].statName.text = arr[i];

            switch (statObject[i].resourceRq)
            {
            case "Liquid Hydrogen":
                tempStr = heroScript.lH2Spent + "(+" + heroScript.lH2Spent * floatArr[i] / 100 + "%)";
                statObject[i].statBonus.text = tempStr;
                break;

            case "Antimatter":
                tempStr = heroScript.antiSpent + "(+" + heroScript.antiSpent * floatArr[i] / 100 + "%)";
                statObject[i].statBonus.text = tempStr;
                break;

            case "Blue Carbon":
                tempStr = heroScript.blueCSpent + "(+" + heroScript.blueCSpent * floatArr[i] / 100 + "%)";
                statObject[i].statBonus.text = tempStr;
                break;

            case "Radioisotopes":
                tempStr = heroScript.radioSpent + "(+" + heroScript.radioSpent * floatArr[i] / 100 + "%)";
                statObject[i].statBonus.text = tempStr;
                break;

            default:
                break;
            }
        }

        NGUITools.SetActive(improvementScreen, true);
    }
Пример #16
0
    public void IncludeHero()
    {
        for (int i = 0; i < MasterScript.playerTurnScript.playerOwnedHeroes.Count; ++i)
        {
            if (MasterScript.playerTurnScript.playerOwnedHeroes[i] == MasterScript.heroGUI.currentHero)
            {
                continue;
            }

            HeroScriptParent heroScript = MasterScript.playerTurnScript.playerOwnedHeroes[i].GetComponent <HeroScriptParent>();

            if (heroScript.heroLocation == MasterScript.heroGUI.currentHero.GetComponent <HeroScriptParent>().heroLocation)
            {
                int tempNum = 0;

                if (UIButton.current.gameObject == MasterScript.invasionGUI.includeHero2)
                {
                    NGUITools.SetActive(MasterScript.invasionGUI.includeHero2, false);
                    MasterScript.invasionGUI.includeHero2.transform.Find("Label").GetComponent <UILabel>().text = "";
                    tempNum = 1;
                }
                if (UIButton.current.gameObject == MasterScript.invasionGUI.includeHero3)
                {
                    NGUITools.SetActive(MasterScript.invasionGUI.includeHero3, false);
                    MasterScript.invasionGUI.includeHero3.transform.Find("Label").GetComponent <UILabel>().text = "";
                    tempNum = 2;
                }

                CreateTokens("Assault", heroScript, tempNum);
                CreateTokens("Auxiliary", heroScript, tempNum);
                CreateTokens("Defence", heroScript, tempNum);
                break;
            }
        }

        NGUITools.SetActive(UIButton.current.gameObject, false);
    }
Пример #17
0
    private float CalculateTotalTokenValue(List <TokenInfo> tokenList, string damageType)
    {
        float total = 0;

        for (int k = 0; k < tokenList.Count; ++k)
        {
            HeroScriptParent heroScript = tokenList[k].heroOwner.GetComponent <HeroScriptParent>();

            float damageTotal = 0;

            if (damageType == "Assault")
            {
                damageTotal = heroScript.assaultDamage;
            }
            if (damageType == "Auxiliary")
            {
                damageTotal = heroScript.auxiliaryDamage;
            }

            total += damageTotal / heroScript.assaultTokens;
        }

        return(total);
    }
Пример #18
0
    public void CreateTokens(string tokenType, HeroScriptParent hero, int pos)     //Used to create, position and assign the tokens for the heroes
    {
        int tokenCount = 0;
        List <GameObject> container = new List <GameObject>();

        switch (tokenType)         //Used to assign both the parent for the token, and the number of tokens available to that hero
        {
        case "Assault":
            tokenCount = hero.assaultTokens;
            container  = MasterScript.invasionGUI.heroInvasionLabels[pos].assaultTokenPositions;
            break;

        case "Auxiliary":
            tokenCount = hero.auxiliaryTokens;
            container  = MasterScript.invasionGUI.heroInvasionLabels[pos].auxiliaryTokenPositions;
            break;

        case "Defence":
            tokenCount = hero.defenceTokens;
            container  = MasterScript.invasionGUI.heroInvasionLabels[pos].defenceTokenPositions;
            break;

        default:
            break;
        }

        for (int i = 0; i < 6; ++i)                                                                         //For all possible token positions
        {
            if (i < tokenCount)                                                                             //If the hero has this token
            {
                NGUITools.SetActive(container[i], true);                                                    //Set the position image to true (the faded greyscale image)
                GameObject tempToken = NGUITools.AddChild(container[i].transform.parent.gameObject, token); //Instantiate the token
                EventDelegate.Add(tempToken.GetComponent <UIButton>().onClick, behaviour.ButtonClicked);    //Add button clicked event

                tempToken.transform.position = container[i].transform.position;                             //Set the position of the token

                TokenUI tokenUI = tempToken.GetComponent <TokenUI>();                                       //Get a reference to the token's script
                tokenUI.originalPosition = i;                                                               //Assign the original position of the token
                tokenUI.originalParent   = container[i].transform.parent.gameObject;                        //Assign the original parent
                tokenUI.originalHero     = pos;
                tokenUI.tokenPositions   = container;
                tokenUI.hero             = MasterScript.heroGUI.currentHero;     //And assign which hero owns it

                UIButton tokenButton = tempToken.GetComponent <UIButton>();      //Get the button attached to the token

                AssignTokenButton(tokenButton, tokenType);

                switch (tokenType)                 //And change the button's sprites based on what kind of token it is
                {
                case "Assault":
                    tokenUI.name = "Assault Token";
                    MasterScript.invasionGUI.heroInvasionLabels[pos].assaultTokensList.Add(tempToken);
                    break;

                case "Auxiliary":
                    tokenUI.name = "Auxiliary Token";
                    MasterScript.invasionGUI.heroInvasionLabels[pos].auxiliaryTokensList.Add(tempToken);
                    break;

                case "Defence":
                    tokenUI.name = "Defence Token";
                    MasterScript.invasionGUI.heroInvasionLabels[pos].defenceTokensList.Add(tempToken);
                    break;

                default:
                    break;
                }

                allTokens.Add(tempToken);
            }

            else
            {
                NGUITools.SetActive(container[i], false);                 //If the hero does not have this token, disable the image and don't do anything
            }
        }
    }
Пример #19
0
    public string SetSpecialisation()
    {
        float  dipMod = 0;
        string type   = null;

        for (int i = 0; i < MasterScript.diplomacyScript.relationsList.Count; ++i)
        {
            if (MasterScript.diplomacyScript.relationsList[i].playerOne.playerRace == player.playerRace || MasterScript.diplomacyScript.relationsList[i].playerTwo.playerRace == player.playerRace)
            {
                switch (MasterScript.diplomacyScript.relationsList[i].diplomaticState)
                {
                case "War":
                    dipMod += 3;
                    break;

                case "Cold War":
                    dipMod += 2;
                    break;

                case "Peace":
                    dipMod += 1;
                    break;
                }
            }
        }

        dipMod = dipMod / MasterScript.diplomacyScript.relationsList.Count;

        for (int i = 0; i < player.playerOwnedHeroes.Count; ++i)
        {
            heroScript = player.playerOwnedHeroes[i].GetComponent <HeroScriptParent>();

            if (heroScript.heroType == "")
            {
                int randomNo = Random.Range(0, 100);

                if (dipMod <= 1.0f)
                {
                    if (randomNo < 25)
                    {
                        type = "Soldier";
                    }
                    if (randomNo < 50 && randomNo >= 25)
                    {
                        type = "Infiltrator";
                    }
                    if (randomNo > 50)
                    {
                        type = "Diplomat";
                    }
                }

                if (dipMod > 1.0f && dipMod <= 2.0f)
                {
                    if (randomNo < 25)
                    {
                        type = "Soldier";
                    }
                    if (randomNo < 50 && randomNo >= 25)
                    {
                        type = "Diplomat";
                    }
                    if (randomNo > 50)
                    {
                        type = "Infiltrator";
                    }
                }

                if (dipMod > 2.0f)
                {
                    if (randomNo < 25)
                    {
                        type = "Diplomat";
                    }
                    if (randomNo < 50 && randomNo >= 25)
                    {
                        type = "Infiltrator";
                    }
                    if (randomNo > 50)
                    {
                        type = "Soldier";
                    }
                }
            }
        }

        return(type);
    }
Пример #20
0
 void Start()
 {
     heroScript = gameObject.GetComponent <HeroScriptParent> ();
 }
Пример #21
0
    public void SpendResources()
    {
        heroScript = MasterScript.heroGUI.currentHero.GetComponent <HeroScriptParent> ();

        for (int i = 0; i < 4; ++i)
        {
            if (statObject[i].button == UIButton.current)
            {
                switch (i)
                {
                case 0:
                    --MasterScript.playerTurnScript.blueCarbon;
                    ++heroScript.blueCSpent;

                    if (heroScript.heroType == "Infiltrator")
                    {
                        heroScript.cloakMod += 0.05f;
                    }
                    if (heroScript.heroType == "Soldier")
                    {
                        heroScript.healthMod += 0.03f;
                    }
                    if (heroScript.heroType == "Diplomat")
                    {
                        heroScript.healthMod += 0.01f;
                    }

                    break;

                case 1:
                    --MasterScript.playerTurnScript.radioisotopes;
                    ++heroScript.radioSpent;

                    if (heroScript.heroType == "Infiltrator")
                    {
                        heroScript.assaultMod += 0.01f;
                    }
                    if (heroScript.heroType == "Soldier")
                    {
                        heroScript.assaultMod += 0.025f;
                    }
                    if (heroScript.heroType == "Diplomat")
                    {
                        heroScript.resourceMod += 0.005f;
                    }

                    break;

                case 2:
                    --MasterScript.playerTurnScript.antimatter;
                    ++heroScript.antiSpent;

                    if (heroScript.heroType == "Infiltrator")
                    {
                        heroScript.movementMod += 0.05f;
                    }
                    if (heroScript.heroType == "Soldier")
                    {
                        heroScript.auxiliaryMod += 0.025f;
                    }
                    if (heroScript.heroType == "Diplomat")
                    {
                        heroScript.movementMod += 0.025f;
                    }

                    break;

                case 3:
                    --MasterScript.playerTurnScript.liquidH2;
                    ++heroScript.lH2Spent;

                    if (heroScript.heroType == "Infiltrator")
                    {
                        heroScript.cooldownMod -= 0.02f;
                    }
                    if (heroScript.heroType == "Soldier")
                    {
                        heroScript.auxiliaryMod -= 0.01f;
                    }
                    if (heroScript.heroType == "Diplomat")
                    {
                        heroScript.auxiliaryMod += 0.02f;
                    }

                    break;

                default:
                    break;
                }

                OpenMenu();
            }
        }
    }
Пример #22
0
    void Update()
    {
        hit           = new RaycastHit();
        currentTarget = null;

        if (Physics.Raycast(Camera.main.ScreenPointToRay(Input.mousePosition), out hit))
        {
            if (Input.GetMouseButtonDown(0))            //Used to start double click events and to identify systems when clicked on. Throws up error if click on a connector object.
            {
                if (hit.collider.gameObject.tag == "Hero")
                {
                    currentHero = hit.collider.gameObject;
                    heroScript  = currentHero.GetComponent <HeroScriptParent>();

                    if (heroScript.heroOwnedBy != MasterScript.playerTurnScript.playerRace)
                    {
                        currentHero = null;
                    }
                }
            }

            if (hit.collider.gameObject.tag == "StarSystem")
            {
                if (currentHero != null)
                {
                    currentTarget = hit.collider.gameObject;
                    heroMovement  = currentHero.GetComponent <HeroMovement> ();

                    if (heroMovement.allowMovement == false)
                    {
                        heroMovement.FindPath(heroScript.heroLocation, hit.collider.gameObject, false);

                        if (Input.GetMouseButtonDown(1))
                        {
                            heroMovement.allowMovement = true;

                            if (heroScript.invasionObject != null)
                            {
                                Destroy(heroScript.invasionObject);
                            }
                        }

                        DestroyUIPath();

                        for (int i = 0; i < heroMovement.finalPath.Count - 1; ++i)
                        {
                            pathToSystem.Add(MasterScript.uiObjects.CreateConnectionLine(heroMovement.finalPath[i], heroMovement.finalPath[i + 1]));
                        }
                    }
                }
            }

            if (hit.collider.gameObject.tag != "StarSystem")
            {
                DestroyUIPath();
            }
        }

        if (currentTarget == null)
        {
            DestroyUIPath();
        }

        ShowHeroDetails();
    }