Example #1
0
 private void Start()
 {
     rosta = GameObject.Find("PlayerData" + "(Clone)").GetComponent <RostaInfo>();
     StartCoroutine(WaitAndShowStats());
     equipPanel = itemInformationPanel.GetComponent <EquipmentInfoPanel>();
     highlights = new GameObject[] { mainHandSlotHighlight, offHandSlotHighlight, armourSlotHighlight, accessory1SlotHighlight, accessory2SlotHighlight };
 }
Example #2
0
    void Awake()
    {
        if (GameObject.Find("EncounterManager") != null)
        {
            encounterManager = GameObject.Find("EncounterManager").GetComponent <EncounterManager>();
        }

        if (GameObject.Find("PlayerData" + "(Clone)") != null)
        {
            rosta = GameObject.Find("PlayerData" + "(Clone)").GetComponent <RostaInfo>();
        }
        else
        {
            rosta = Instantiate(playerData).GetComponent <RostaInfo>();
            //assign the rest of the rosta after.
            for (int n = (numberOfStartingUnits); n > 0; n--)
            {
                UnitInfo unit = new UnitInfo();
                AssignStats(unit);
                rosta.castle.Add(unit);
            }
            //Build the intial inventory
            inventory = playerData.GetComponent <Inventory>();
            InitializeInventory();
        }
    }
Example #3
0
    IEnumerator WaitAndFindPlayerData()
    {
        //gammy way of doing this. Should set up a delegate on player data that announces when everything is in place.
        yield return(new WaitForSeconds(0.2f));

        rosta = GameObject.Find("PlayerData" + "(Clone)").GetComponent <RostaInfo>();
        yield break;
    }
Example #4
0
 public void GetReferences()
 {
     mapManager = GameObject.Find("MapManager").GetComponent <MapManager>();
     if (mapManager == null)
     {
         Debug.LogError("Encounter couldn't get reference to map manager");
     }
     rosta = GameObject.Find("PlayerData" + "(Clone)").GetComponent <RostaInfo>();
     if (rosta == null)
     {
         Debug.LogError("Encounter could not find the player data");
     }
 }
Example #5
0
    private void Start()
    {
        theCastle = GameObject.Find("The Castle").GetComponent <EncounterSite>();
        rosta     = GameObject.Find("PlayerData" + "(Clone)").GetComponent <RostaInfo>();
        if (rosta == null)
        {
            Debug.LogError("Encounter could not find the player data");
        }

        if (RostaInfo.currentEncounter != null)
        {
            if (RostaInfo.currentEncounter.completionState == Encounter.CompletionState.VICTORY)
            {
                MapUIManager.RequestAlert(RostaInfo.currentEncounter.victoryMapText, "Return");
                RostaInfo.currentEncounter.selectedCompany.targetEncounter = null;
                RostaInfo.currentEncounter.site.encounter = null;
                RostaInfo.encounters.Remove(RostaInfo.currentEncounter);
            }
            else if (RostaInfo.currentEncounter.completionState == Encounter.CompletionState.DEFEAT)
            {
                MapUIManager.RequestAlert(RostaInfo.currentEncounter.defeatMapText, "Return");
                RostaInfo.currentEncounter.selectedCompany.targetEncounter = null;
                RostaInfo.currentEncounter.selectedCompany = null;
                RostaInfo.currentEncounter.completionState = Encounter.CompletionState.UNASSIGNED;
            }
        }

        foreach (Encounter e in RostaInfo.encounters)
        {
            e.GetReferences();
            e.runCompanySelectSetUp = false;
            e.site           = GameObject.Find(e.site.SiteName).GetComponent <EncounterSite>();
            e.site.encounter = e;
            e.site.ShowEncounter();
        }

        for (int i = RostaInfo.companies.Count - 1; i >= 0; i--)
        {
            if (RostaInfo.companies[i].units.Count == 0)
            {
                RostaInfo.companies.RemoveAt(i);
            }
            else
            {
                RostaInfo.companies[i].CreateCompany();
            }
        }

        date.text = ("Day " + RostaInfo.date);
        CheckForAvailableEncounters();
    }
Example #6
0
    public override void GoToCompanySelect()
    {
        ConfirmationPopUp.onConfirm -= GoToCompanySelect;
        ConfirmationPopUp.onCancel  -= CancelRally;

        origin = GameObject.Find("The Castle").transform;
        if (origin == null)
        {
            Debug.LogError("encounter can't find the castle");
        }

        RostaInfo.CreateCompanyInfo(this, origin.gameObject, site.gameObject);

        RostaInfo.currentEncounter = this;
        base.GoToCompanySelect();
    }
Example #7
0
    IEnumerator SetInfoPanels()
    {
        yield return(new WaitForSeconds(0.1f));

        unitInfoPanels.Add(infoPanel1);
        unitInfoPanels[0].position = 0;
        unitInfoPanels.Add(infoPanel2);
        unitInfoPanels[1].position = 1;
        unitInfoPanels.Add(infoPanel3);
        unitInfoPanels[2].position = 2;
        unitInfoPanels.Add(infoPanel4);
        unitInfoPanels[3].position = 3;

        rosta = GameObject.Find("PlayerData" + "(Clone)").GetComponent <RostaInfo>();
        CompanyInfo company = RostaInfo.currentEncounter.selectedCompany;
        int         max     = Math.Min(3, company.units.Count);

        for (int count = max; count >= 0; count--)
        {
            unitInfoPanels[count].SetUnit(company.units[count]);
        }
        yield break;
    }
Example #8
0
    private void Awake()
    {
        if (RostaInfo.encounter == true || encounterSettings == EncounterSettings.Test)
        {
            RostaInfo.encounter = true;
            rosta                  = GameObject.Find("PlayerData" + "(Clone)").GetComponent <RostaInfo>();
            encounterManager       = this;
            staticEncounterPanel   = encounterEndPanel;
            staticEncounterEndtext = encounterEndtext;
            StartCoroutine(PositioningUnits());
        }

        if (RostaInfo.currentEncounter == null)
        {
            Encounter encounter = new Reclaim();
            encounter.permanent = true;
            //encounter.GetReferences();
            //Will need to change this formula if I want to get 3 by 3 arenas, but for now we're just making arenasizes 4 (2 b 2) and 6 (2 b 3).
            encounter.arenaSize        = (((int)UnityEngine.Random.Range(1, 3)) * 2) + 2;
            encounter.difficulty       = UnityEngine.Random.Range(0, 2);
            encounter.enemyCompany     = EncounterTable.CreateEnemyCompany(encounter);
            RostaInfo.currentEncounter = encounter;
        }
    }