public SpyUnit GetSpyUnit()
    {
        SpyUnit cardToGive = spyCards.First();

        spyCards.Remove(cardToGive);
        return(cardToGive);
    }
 public void RecruitSpy(Globals.FactionNames factionId)
 {
     if (Stats.GetFactionSupport(factionId) >= MINIMUM_SPY_RECRUITMENT_SUPPORT)
     {
         SpyUnit newSpy = new SpyUnit(this, factionId);
         PresentSpies.Add(newSpy);
         Events.EventManager.TriggerEvent(EventNames.SpyRecruited, new UnitRecruitmentData()
         {
             NewlyRecruitedUnit = newSpy
         });
     }
     else
     {
         Debug.Log("The faction: " + factionId.ToString() + " doesn´t have enough support to recruit a spy unit in: " + Stats.PopulationNodeName);
     }
 }
Exemple #3
0
    private void OnInitializeCollectControlledSpies()
    {
        GameObject[] populationNodeGameobjects = GameObject.FindGameObjectsWithTag("PopulationNode");

        if (populationNodeGameobjects == null)
        {
            Debug.Log("OnInitializeCollectControlledSpies - PopulationNode GameObjects not found when looking for controlled spies!");
            return;
        }

        for (int populationNodeIndex = 0; populationNodeIndex < populationNodeGameobjects.Length; populationNodeIndex++)
        {
            for (int spyIndex = 0; spyIndex < populationNodeGameobjects[populationNodeIndex].GetComponent <PopulationNode>().PresentSpies.Count; spyIndex++)
            {
                SpyUnit spyUnit = populationNodeGameobjects[populationNodeIndex].GetComponent <PopulationNode>().PresentSpies[spyIndex];
                if (spyUnit.Faction == FactionId)
                {
                    ControlledSpies.Add(populationNodeGameobjects[populationNodeIndex].GetComponent <PopulationNode>().PresentSpies[spyIndex]);
                }
            }
        }
    }