Beispiel #1
0
    public static CultistJob TakeCultistJob(CultistAI worker)
    {
        InitOpenJobs();
        if (openCultistJobs.Count == 0)
            return null;

        if (worker.myCultistJob != null)
            return null;
        
        CultistJob j = (openCultistJobs.First as LinkedListNode<CultistJob>).Value;
        while (j.worker != null)
        {
            openCultistJobs.RemoveFirst();
            j = (openCultistJobs.First as LinkedListNode<CultistJob>).Value;
        }

        j.worker = worker;
        openCultistJobs.RemoveFirst();
        return j;
    }
    public static void SpawnEnemyKnights(int numberToSpawn, CultistAI[] cultists, GameObject knight)
    {
        if (watch == null)
            watch = new Stopwatch();

        watch.Start();

        for (int i = 0; i < numberToSpawn; i++)
        {
            while ((watch.ElapsedMilliseconds / 1000) < 5)
            {

            }
            GameObject.Instantiate(knight, spawn.position, Quaternion.identity);
            JobQueue.AddGoodyJob(new DoogooderJob(null, cultists[i]));
            //JobQueue.Add
        }

        watch.Reset();
    }
 public DoogooderJob(Tile myJob, CultistAI target) : base(myJob)
 {
     watch = new Stopwatch();
     
 }
    public void Update()
    {
        MapManager map = GameObject.FindObjectOfType<MapManager>();

        if (totalDemons == null)
            totalDemons = new List<DemonAI>();
        if (totalCultists == null)
            totalCultists = new List<CultistAI>();
        if (totalDoogooders == null)
            totalDoogooders = new List<DoogooderAI>();        

    _goldCounter.text = string.Format("Gold: {0}", _resourceManager.Gold);
        _soulsCounter.text = string.Format("Souls: {0}/{1}", _resourceManager.Souls, _resourceManager.MaxSouls);
        _renownCounter.text = string.Format("Renoun: {0}", _resourceManager.Renoun);

        //this.totalDemons.AddRange(GameObject.FindObjectsOfType<DemonAI>().Where(da => (!totalDemons.Contains(da))));
        this.totalCultists.AddRange(GameObject.FindObjectsOfType<CultistAI>().Where(da => (!totalCultists.Contains(da))));
        this.totalDoogooders.AddRange(GameObject.FindObjectsOfType<DoogooderAI>().Where(da => (!totalDoogooders.Contains(da))));

        minuteChecker += Time.deltaTime;
        if (minuteChecker >= 120 * difficultySpeed)
        {
            CultistAI[] array = new CultistAI[Mathf.Abs(map.yDepth / 2)];
            for(int i = 0; i < array.Length; i++)
            {
                array[i] = totalCultists[i];
            }

            SpawnKnights.SpawnEnemyKnights(Mathf.Abs(map.yDepth / 2), array, knight);

            minuteChecker = 0;
        }
    }