bool DoWork() { if (myCultistJob == null) myCultistJob = JobQueue.TakeCultistJob(this); if (myCultistJob == null) return false; if (myCultistJob.tile != null) { if (myCultistJob.tile.TileType == Enumerations.GetEnumDescription(TileTypes.SummonRoom)) { Debug.Log("Cultist: " + (int)myCultistJob.tile.Pos.y + " | " + "Target: " + transform.position.y); if ((int)myCultistJob.tile.Pos.y != transform.position.y) { moving = true; base.MoveToFloor((int)myCultistJob.tile.Pos.y); } else if (transform.position.x < myCultistJob.tile.Pos.x + 0.9f || transform.position.x > myCultistJob.tile.Pos.x + 1.1f) base.MoveToX((int)myCultistJob.tile.Pos.x + 1f); else { myCultistJob.timeToComplete = myCultistJob.tile.JobDuration; GetComponent<Animator>().SetBool("Praying", true); GetComponent<Animator>().SetBool("Walking", false); myCultistJob.tile.myJob = myCultistJob; myCultistJob.StartJob(); working = true; } } } return false; //if () }
public static void RemoveCultistJob(CultistJob j) { openCultistJobs.Remove(j); }
public static void MaxCultistPriority(CultistJob j) { if (openCultistJobs.Contains(j)) { openCultistJobs.Remove(j); } openCultistJobs.AddFirst(j); }
public static void AddCultistJob(CultistJob j) { InitOpenJobs(); openCultistJobs.AddLast(j); }
void JobLogic(TileTypes type) { if (type == TileTypes.SummonRoom) { if (myJob != null) { if (myJob.JobCompleted()) { GameObject prefab = Resources.Load<GameObject>("Demon1"); // check type exists iin prefabs if (prefab == null) { Debug.LogError("No prefab found: " + type); } GameObject go = (GameObject)GameObject.Instantiate(prefab, new Vector3(Pos.x + 1.5f, Pos.y + 0.25f, 0), Quaternion.identity); myJob.KillJob(); myJob.Done(); myJob = null; } } } }