public void RemoveBubble(BubbleObject bubble) { var hex = bubble.GridPosition; var p = Hex2Array(hex); _bubbleMap[p.x, p.y] = null; _tempBubbleInMap.Remove(bubble); }
public void ReleaseBubble(BubbleObject bubble) { bubble.gameObject.SetActive(false); bubble.transform.position = Vector3.zero; bubblePool.Add(bubble); poolSize++; }
List <BubbleObject> FindNeighborWithType (BubbleObject current, HashSet <BubbleObject.BubbleTypes> types) { List <BubbleObject> bubbles = new List <BubbleObject>(); for (int q = -1; q <= 1; q++) { for (int r = -1; r <= 1; r++) { if (r == q) { continue; } Vector2Int neighborHexIndex = current.GridPosition + new Vector2Int(q, r); if (generater.IsInMap(neighborHexIndex)) { var mapBubble = generater.GetBubbleInMap(neighborHexIndex); if (mapBubble != null && types.Contains(mapBubble.BubbleType) && !bloomList.Contains(mapBubble) && !testList.Contains(mapBubble)) { bubbles.Add(mapBubble); } } } } return(bubbles); }
public ObjSlotManager(List <Input> inputs) { GlobalTimer = Config.Stream.GetInt(MiscConfig.GlobalTimerAddress); WaterLevelIndex = WaterLevelCalculator.GetWaterLevelIndex(); WaterLevel = WaterLevelCalculator.GetWaterLevelFromIndex(WaterLevelIndex); FutureWaterLevelIndex = WaterLevelCalculator.GetWaterLevelIndex() + 1; FutureWaterLevel = WaterLevelCalculator.GetWaterLevelFromIndex(FutureWaterLevelIndex); YorangeObjects = new List <WaterObject>(); GreenObjects = new List <WaterObject>(); PurpleObjects = new List <WaterObject>(); BrownObjects = new List <WaterObject>(); ObjectLists = new List <List <WaterObject> >() { YorangeObjects, GreenObjects, PurpleObjects, BrownObjects, }; Rng = new TtcRng(); MarioObject marioObject = new MarioObject(this, Rng, inputs); YorangeObjects.Add(marioObject); List <ObjectDataModel> bobombBuddyObjs = Config.ObjectSlotsManager.GetLoadedObjectsWithName("Bob-omb Buddy (Opens Cannon)"); foreach (var bobombBuddyObj in bobombBuddyObjs) { int blinkingTimer = Config.Stream.GetInt(bobombBuddyObj.Address + 0xF4); BobombBuddyObject bobombBuddyObject = new BobombBuddyObject(this, Rng, blinkingTimer); GreenObjects.Add(bobombBuddyObject); } List <ObjectDataModel> bubbleSpawnerObjs = Config.ObjectSlotsManager.GetLoadedObjectsWithName("Bubble Spawner"); foreach (var bubbleSpawnerObj in bubbleSpawnerObjs) { float y = Config.Stream.GetFloat(bubbleSpawnerObj.Address + ObjectConfig.YOffset); int timer = Config.Stream.GetInt(bubbleSpawnerObj.Address + ObjectConfig.TimerOffset); int timerMax = Config.Stream.GetInt(bubbleSpawnerObj.Address + 0xF4); BubbleSpawnerObject bubbleSpawnerObject = new BubbleSpawnerObject(this, Rng, y, timer, timerMax); PurpleObjects.Add(bubbleSpawnerObject); } List <ObjectDataModel> bubbleObjs = Config.ObjectSlotsManager.GetLoadedObjectsWithName("Underwater Bubble"); foreach (var bubbleObj in bubbleObjs) { float y = Config.Stream.GetFloat(bubbleObj.Address + ObjectConfig.YOffset); int timer = Config.Stream.GetInt(bubbleObj.Address + ObjectConfig.TimerOffset); float varF4 = Config.Stream.GetFloat(bubbleObj.Address + 0xF4); float varF8 = Config.Stream.GetFloat(bubbleObj.Address + 0xF8); float varFC = Config.Stream.GetFloat(bubbleObj.Address + 0xFC); float var100 = Config.Stream.GetFloat(bubbleObj.Address + 0x100); BubbleObject bubbleObject = new BubbleObject(this, Rng, y, timer, varF4, varF8, varFC, var100); BrownObjects.Add(bubbleObject); } }
public void AddBubble(BubbleObject bubble, Vector2Int hex) { bubble.SetPositionInGrid(hex); bubble.BubbleState = BubbleObject.BubbleStates.State_InMap; var p = Hex2Array(hex); _bubbleMap[p.x, p.y] = bubble; if (!_tempBubbleInMap.Contains(bubble)) _tempBubbleInMap.Add(bubble); }
public override void Update() { if (Timer == 0) { TimerMax = 2 + (int)(9 * Rng.PollFloat()); } if (Timer == TimerMax) { BubbleObject bubbleObject = new BubbleObject(ObjSlotManager, Rng, Y, 0, 0, 0, 0, 0); ObjSlotManager.AddObject(bubbleObject); MarkForDeletion(); } Timer++; }
public void FindBloomBubbles(BubbleObject current, HashSet <BubbleObject.BubbleTypes> types) { if (!bloomList.Contains(current)) { bloomList.Add(current); //Debug.Log(bloomList); } var tempList = FindNeighborWithType(current, types); testList.AddRange(tempList); testList.Remove(current); for (int i = 0; i < testList.Count; i++) { var b = testList[i]; FindBloomBubbles(b, types); } }
private Vector2Int FindNearestNeighborPos(BubbleObject thisBo, BubbleObject otherBo) { Vector2Int otherHexPos = otherBo.GridPosition; var neighbors = chainFinder.FindEmptyNeighborsInHex(otherHexPos); float currentNearest = float.MaxValue; Vector2Int gridPos = thisBo.GetGridPosition(thisBo.transform.position); foreach (var pos in neighbors) { var posW = otherBo.GetWorldPosition(pos); Vector2 thisPos = thisBo.transform.position; float dist = (thisPos - posW).SqrMagnitude(); if (dist < currentNearest) { currentNearest = dist; gridPos = pos; } } return(gridPos); }
public void RemoveObjectFromInventory(BubbleObject targetObject) { this.Objects.Remove(targetObject); }
public void AddObjectToInventory(BubbleObject newObject) { this._objects.Add(newObject); // Update UI }
public override void VisitStart(OfficeWorld world) { base.VisitStart(world); this.levelData = Serializer.Deserialize(this.pathLevel); // Create Objects OfficeObject office = new OfficeObject(); PatientObject patient = new PatientObject(); patient.Alias = "main"; ToubibObject toubib = new ToubibObject(); toubib.Alias = "main"; NotebookObject notebook = new NotebookObject(); notebook.Alias = "main"; BubbleObject bubble = new BubbleObject(); bubble.Alias = "main"; TimerObject timer = new TimerObject(); timer.Alias = "main"; QueueTalkObject queueTalk = new QueueTalkObject(); queueTalk.Alias = "main"; QueueDreamObject queueDream = new QueueDreamObject(); queueDream.Alias = "main"; //TestObject test = new TestObject(); DialogueObject dialoguePatient = DialogueFactory.CreateDialogueFactory(60, this.levelData.PatientDialogue); dialoguePatient.Alias = "patient"; DialogueObject dialogueToubib = DialogueFactory.CreateDialogueFactory(60, this.levelData.ToubibDialogue); dialogueToubib.Alias = "toubib"; DialogueObject dialogueAnswer = DialogueFactory.CreateDialogueFactory(30, this.levelData.AnswerTokens); dialogueAnswer.Alias = "answer"; DialogueObject dialogueSuccessAnswer = DialogueFactory.CreateDialogueFactory(60, this.levelData.PatientSuccessAnswer, TokenType.NORMAL); dialogueSuccessAnswer.Alias = "successAnswer"; DialogueObject dialogueFailAnswer = DialogueFactory.CreateDialogueFactory(60, this.levelData.PatientFailAnswer, TokenType.NORMAL); dialogueFailAnswer.Alias = "failAnswer"; DialogueObject dialogueComing = DialogueFactory.CreateDialogueFactory(30, "Hum, Entrez ...", TokenType.NORMAL); dialogueComing.Alias = "coming"; AToken timerToken = DialogueFactory.CreateToken(string.Empty, TokenType.TIMER); timerToken.Alias = "main"; // Create layers Layer background = new Layer(); Layer middleground = new Layer(); Layer foreground = new Layer(); Layer textLayer = new Layer(); Layer answerLayer = new Layer(); // Add Resources List <string> resourcesToLoad = new List <string>(); resourcesToLoad.Add(this.LevelName); resourcesToLoad.Add(office.Id); resourcesToLoad.Add(toubib.Id); resourcesToLoad.Add(patient.Id); resourcesToLoad.Add(notebook.Id); resourcesToLoad.Add(bubble.Id); resourcesToLoad.Add(queueTalk.Id); resourcesToLoad.Add(queueDream.Id); resourcesToLoad.Add(timer.Id); resourcesToLoad.Add("normalToken"); resourcesToLoad.Add("sanctuaryToken"); resourcesToLoad.Add("answerToken"); resourcesToLoad.Add("lampClipped"); resourcesToLoad.Add("wordPicked"); resourcesToLoad.Add("bubbleClosed"); resourcesToLoad.Add("bubbleOpened"); resourcesToLoad.Add("wordInserted"); resourcesToLoad.Add("wordDroped"); resourcesToLoad.Add("dialoguePatient"); resourcesToLoad.Add("dialogueToubib"); resourcesToLoad.Add("dialogueReflexion"); resourcesToLoad.Add("dialoguePatientSuccess"); resourcesToLoad.Add("dialoguePatientFail"); resourcesToLoad.Add("doorKnock"); resourcesToLoad.Add("endTimer"); resourcesToLoad.Add("validationSuccess"); resourcesToLoad.Add("validationFail"); /*resourcesToLoad.Add(patient.Id); * resourcesToLoad.Add(toubib.Id);*/ world.NotifyResourcesToLoad(resourcesToLoad); // Add Layers world.AddLayer(background); world.AddLayer(middleground); world.AddLayer(foreground); world.AddLayer(textLayer); world.AddLayer(answerLayer); // Add Objects /*world.AddObject(test, 0); * world.AddObject(patient, 0); * world.AddObject(toubib, 0);*/ world.AddObject(office, 0); world.AddObject(toubib, 1); world.AddObject(patient, 1); world.AddObject(queueTalk, 2); world.AddObject(queueDream, 2); world.AddObject(timer, 2); world.AddObject(timerToken, 3); world.AddObject(notebook, 2); world.AddObject(bubble, 2); world.AddObject(dialoguePatient, 3); world.AddObject(dialogueToubib, 3); world.AddObject(dialogueAnswer, 4); world.AddObject(dialogueFailAnswer, 3); world.AddObject(dialogueSuccessAnswer, 3); world.AddObject(dialogueComing, 3); // Set Object Position. office.SetKinematicParameters(new Vector2f(0, 0), new Vector2f(0, 0)); toubib.SetKinematicParameters(new Vector2f(150, 160), new Vector2f(0, 0)); patient.SetKinematicParameters(new Vector2f(-550, 140), new Vector2f(0, 0)); notebook.SetKinematicParameters(new Vector2f(10000, 10000), new Vector2f(0, 0)); bubble.SetKinematicParameters(new Vector2f(10000, 10000), new Vector2f(0, 0)); queueTalk.SetKinematicParameters(new Vector2f(10000, 10000), new Vector2f(0, 0)); queueDream.SetKinematicParameters(new Vector2f(10000, 10000), new Vector2f(0, 0)); timer.SetKinematicParameters(new Vector2f(10000, 10000), new Vector2f(0, 0)); timerToken.SetKinematicParameters(new Vector2f(400, 260), new Vector2f(0f, 0f)); queueTalk.SetAnimationIndex(1); queueDream.SetAnimationIndex(1); }
public BubbleCreatedEventArgs(BubbleObject bubbleObject) { this.BubbleObj = bubbleObject; }