public void Operate() { ClearList(); int amountToCollect = UnityEngine.Random.Range(1, 9); CollectFromPool(EventPoolHolder <GameEvent> .mInstance.GetPool("eventPool"), amountToCollect); //CollectFromPool(EventPoolHolder<GameEvent>.m_GoodsPool, 3); Debug.Log(String.Format("EventSelector: collected {0} elements from pool, size of goods: {1}, size of obstacles: {2}" , amountToCollect, mGoods.Count, mObstacles.Count)); //We can specify 0 in the tube since the greedy algo does not use this information. List <GameEvent>[] gameEventsToDeployArray = Assembel(EventAssemblerGreedy.Instance, 0); Debug.Log(String.Format("EventSelector: asseembled {0} ", gameEventsToDeployArray.ToString())); //DeploymentTubeManager.Instance.ApplyRequest(gameEventsToDeploy, SystemAIManager.m_Instance.Activate); float timeDelay = 0; holder2 = new CountDownRoot(WakeUpSystemAI); for (int i = 0; i < gameEventsToDeployArray.Length; i++) { //--If there are game events to deploy if (gameEventsToDeployArray[i].Count != 0) { DeploymentTubeManager.Instance.ApplyRequestToTube(i, (Action callback) => { Debug.Log("EventSelector: ApplyRequestToTube"); CountDownRoot holder = new CountDownRoot(callback); holder2.IncreaseByOne(); timeDelay += UnityEngine.Random.Range(0f, 1f);; //BluePrintConstruct bluePrint = LevelConstructUtil.ConvertFromLevelConstructToBluePrint(gameEventsToDeployArray[i]); SubSceneMultiton.Instance.GetInstance(i).GetLocalLevelBuilder().Build(gameEventsToDeployArray[i], Vector3.zero, holder, timeDelay); }, this); } } //deploymentTubes[0].ApplyRequest(gameEventsToDeploy); foreach (List <GameEvent> gel in gameEventsToDeployArray) { foreach (GameEvent ge in gel) { Debug.Log(String.Format("EventSelector: applied request to deploy {0}", ge.mName)); } } Debug.Log(String.Format("EventSelector: applied request to tube")); }
public override void Enter() { Init(); //myEvent =new UnityEvent( GameEventManager.Instance.onPlayerJumpEvent); //--Display the fatui image //StartCoroutine(ExecuteAfterTime(10)) TutorialSystem.Instance.DisplayImageOnPlaceHolder(TutorialImage, PrimaryScene, waitForEvent, delay); //--Instantiate the constructs using the json data //--Create a new list List <GameEvent>[] gameEvents = new List <GameEvent> [ApplicationConstants.NumberOfScenes]; //--Initialize the lists for (int i = 0; i < ApplicationConstants.NumberOfScenes; i++) { gameEvents[i] = new List <GameEvent>(); } //--Populate the lists using the PREvent data foreach (PREvent e in Events) { gameEvents[e.scene].Add(GameEventFactory.GetIntance().GenerateOne(e.type, e.level, e.index)); } holder2 = new CountDownRoot(WakeUp); for (int i = 0; i < gameEvents.Length; i++) { //--If there are game events to deploy if (gameEvents[i].Count != 0) { DeploymentTubeManager.Instance.ApplyRequestToTube(i, (Action callback) => { Debug.Log("EventSelector: ApplyRequestToTube"); CountDownRoot holder = new CountDownRoot(callback); holder2.IncreaseByOne(); //BluePrintConstruct bluePrint = LevelConstructUtil.ConvertFromLevelConstructToBluePrint(gameEvents[i]); SubSceneMultiton.Instance.GetInstance(i).GetLocalLevelBuilder().Build(gameEvents[i], Vector3.zero, holder); }, this); } } ////--Deploy request to tube. //for (int i = 0; i < ApplicationConstants.NumberOfScenes; i++) //{ // BluePrintConstruct bluePrint = LevelConstructUtil.ConvertFromLevelConstructToBluePrint(gameEvents[i]); // DeploymentTubeManager.Instance.ApplyRequestToTube(i, TutorialSystem.Instance.MoveToNexTStep, this); //} }
public void SubscribeToRoot(CountDownRoot root) { mRoot = root; mRoot.IncreaseByOne(); mIsSubscribedToRoot = true; }
public CountDownLatch(CountDownRoot root) { this.root = root; root.IncreaseByOne(); }