Пример #1
0
    private void InitializeAIsInArena()
    {
        int        numberOfFactions   = am.GetNumberOfFactionsIncludingFeral();
        GameObject feralFactionLeader = Instantiate(dummyFactionLeaderPrefab, Vector3.zero, Quaternion.identity) as GameObject;

        am.AddFactionLeaderToList(IFF.feralIFF, feralFactionLeader.GetComponent <FactionLeader>());
        for (int i = 1; i < numberOfFactions; i++)
        {
            int newIFFAllegiance = i;
            if (am.GetPlayerIFF() == newIFFAllegiance)
            {
                continue;
            }
            CitySquare startingCS       = cm.FindNearestCitySquare(transform, newIFFAllegiance);
            Vector3    startingPos      = startingCS.transform.position;
            GameObject newFactionLeader = Instantiate(actualFactionLeaderPrefab, startingPos, Quaternion.identity) as GameObject;
            newFactionLeader.GetComponent <IFF>().SetIFFAllegiance(newIFFAllegiance);
            am.AddFactionLeaderToList(newIFFAllegiance, newFactionLeader.GetComponent <FactionLeader>());
            startingCS.SetAllegianceForBuildingsInCity(newIFFAllegiance);
        }
    }
Пример #2
0
    private void OnTriggerStay2D(Collider2D collision)
    {
        if (cs.IsRunningOnServer)
        {
            if (!cityToCapture)
            {
                return;
            }
            cityToCapture.BuildCaptureTime(Time.deltaTime);
            PushUpdateToUIDriver(cityToCapture);

            if (cityToCapture.GetTimeSpentCapturing() >= cityToCapture.GetTimeRequiredToCapture())
            {
                int newAllegiance = iff.GetIFFAllegiance();
                cityToCapture.GetComponent <IFF>().SetIFFAllegiance(newAllegiance); // change allegiance of square itself
                cityToCapture.SetAllegianceForBuildingsInCity(newAllegiance);       // change allegiance for all city objects
                cityToCapture.ResetCaptureStatus();
                cityToCapture = null;
                avcuid.UpdateTimes(0, 0);
            }
        }
    }