void ContinueBtn_onClick() { Genie.I.LogEvent(OE_INTERACT.CreateDuration(OE_INTERACT.Type.END, "levelComplete", Session.instance.timeTaken)); Genie.I.LogEvent(OE_INTERACT.Create(OE_INTERACT.Type.TOUCH, "levelComplete.continue")); SaveData.instance.SyncAndSave(); EggAward.Clear(); EggCounter.Show(false); EggCounter.SetSuitcaseButton(false); ContinueButton.enabled = false; this.SmartCoroutine(ContinueBtn_onClickRoutine()); }
public void AddDragGroup(int zone, DragGroup group) { if (zone == 1) { Genie.I.LogEvent(OE_INTERACT.Create(OE_INTERACT.Type.OTHER, "gameplay.onesSubtract")); onesZone.AddDragGroup(group); } else if (zone == 10) { Genie.I.LogEvent(OE_INTERACT.Create(OE_INTERACT.Type.OTHER, "gameplay.tensSubtract")); tensZone.AddDragGroup(group); } }
void stampsBtn_onClick() { //bring up the stamps screen Genie.I.LogEvent(OE_INTERACT.Create(OE_INTERACT.Type.TOUCH, "hud.suitcase")); stampsBtn.GetComponent <Animator>().SetTrigger("hideStampBtn"); eggScreen.SetActive(true); stampCollection.gameObject.SetActive(true); stampCollection.GetComponent <SuitcaseCtrl>().Show(true); stampCollection.GetComponent <SuitcaseCtrl>().onExited = OnStampClose; // override the direction of the animation stampCollection.GetComponent <Animator>().SetBool("showCollection", false); stampCollection.GetComponent <Animator>().SetBool("showCollectionFromBottom", true); m_HideRoutine = this.WaitSecondsThen(0.3f, m_GroupHider.HideAll); }
void SnapBack() { if (value == 1) { Genie.I.LogEvent(OE_INTERACT.Create(OE_INTERACT.Type.DROP, "gameplay.onesSub.snapBack")); } else if (value == 10) { Genie.I.LogEvent(OE_INTERACT.Create(OE_INTERACT.Type.DROP, "gameplay.tensSub.snapBack")); } // put creatures back into drop zone //SoundManager.instance.PlayOneShot(SoundManager.instance.chickenSnapBack); CreatureCtrl[] children = dragGroup.GetComponentsInChildren <CreatureCtrl>(); children[0].Drop(this.transform); }
public void UpdateSaveData(int inEggsToAdd) { if (Session.Exists) { Session.instance.numEggs += inEggsToAdd; Genie.I.LogEvent(OE_INTERACT.Create(OE_INTERACT.Type.OTHER, "eggsEarned." + Session.instance.numEggs.ToStringLookup())); } else { SaveData.instance.Eggs += inEggsToAdd; Genie.I.LogEvent(OE_INTERACT.Create(OE_INTERACT.Type.OTHER, "eggsEarned." + SaveData.instance.Eggs.ToStringLookup())); } SaveData.instance.SyncAndSave(); Genie.I.SyncEvents(); }
void exitConfirmBtn_onClick() { if (m_ShuttingDown) { return; } m_ShuttingDown = true; CloseButton.enabled = false; ConfirmButton.enabled = false; Genie.I.LogEvent(OE_INTERACT.Create(OE_INTERACT.Type.TOUCH, "mainMenu.quit.confirm")); this.SmartCoroutine(ShutdownSequence()); loadingScreen.SetActive(true); }
void Dragger_OnDragStart(DragObject obj) { Genie.I.LogEvent(OE_INTERACT.Create(OE_INTERACT.Type.DROP, m_IsOperator ? "minigame.expression.opChicken" : "minigame.expression.valueChicken")); GetComponent <Animator>().SetBool("dragging", true); SoundManager.instance.PlayRandomOneShot(SoundManager.instance.chickenDrag); m_Minigame = Dragger.Controller.GetComponent <ExpressionMinigame>(); if (m_IsOperator) { m_Minigame.GlowOperatorNests(); } else { m_Minigame.GlowChickenNests(); } }
public void ToOn() { Genie.I.LogEvent(OE_INTERACT.Create(OE_INTERACT.Type.START, "levelComplete")); m_PolaroidGroup.HideAll(); m_PolaroidGroup.ShowAll(); if (Session.instance.currentLevel.value == 0) { MakePeacockAndKiwiPhoto(); } else { MakeChickenPhoto(); } // reset the reward being shown or not EggAward.Clear(); ContinueButton.enabled = false; EggScreen.GetComponent <TransformParentMemory>().ChangeTransform(this.transform, false); EggScreen.gameObject.SetActive(true); // show SoundManager.instance.PlayOneShot(SoundManager.instance.polaroidEnter); this.GetComponent <Animator>().SetTrigger("tinyShipOut"); this.GetComponent <MecanimEventHandler>().RegisterOnStateEnd(Animator.StringToHash("Base Layer.PolaroidToOn"), Ctrl_on); Level levelFrom = Session.instance.currentLevel; if (levelFrom.isDoubleDigitProblem) { SaveData.instance.SeenTens = true; } levelFrom.CompletedMechanicsTutorials(); m_Masks.StartChecking(); m_LevelLoaded = false; this.SmartCoroutine(LoadNextLevel()); CleanupHook.instance.Cleanup(); }
void playBtn_onClick() { GetComponent <Image>().enabled = false; //loadingScreen.SetActive(true); //start transition if (SaveData.instance.WatchedIntro) { Genie.I.LogEvent(OE_INTERACT.Create(OE_INTERACT.Type.TOUCH, "mainMenu.play.game")); //this.WaitSecondsThen(0.2f, SceneMgr.instance.LoadGameScene); SceneMgr.instance.LoadGameScene(); } else { Genie.I.LogEvent(OE_INTERACT.Create(OE_INTERACT.Type.TOUCH, "mainMenu.play.intro")); //this.WaitSecondsThen(0.2f, () => { SceneMgr.instance.LoadScene(SceneMgr.INTRO); }); SceneMgr.instance.LoadScene(SceneMgr.INTRO); } }
public void OnEggTap() { if (!AllowTap) { return; } Genie.I.LogEvent(OE_INTERACT.Create(OE_INTERACT.Type.TOUCH, "hud.tapEggs")); if (transform.parent.FindChild("egg1").GetComponent <Animator>().GetCurrentAnimatorStateInfo(0).IsName("Base Layer.eggsIdle")) { SoundManager.instance.PlayRandomOneShot(SoundManager.instance.hudTapEgg, .5f); transform.parent.FindChild("egg1").GetComponent <Animator>().SetTrigger("tapped"); secondTap.Clear(); if (Session.instance.eggsEarned != 1) { secondTap = this.WaitSecondsThen(.25f, TapSecondEgg); } } }
void CloseBtn_onClick() { if (m_UnlockingStamp || m_DraggingStamp) { return; } Genie.I.LogEvent(OE_INTERACT.Create(OE_INTERACT.Type.TOUCH, "suitcase.close")); SoundManager.instance.PlayOneShot(SoundManager.instance.suitcaseClose); DropStamp(); SaveStampData(); Show(false); if (onExited != null) { onExited(); } }
private void Update() { if (m_Rotating && m_Stamp != null) { float mouseRotation = Mathf.Atan2(Input.mousePosition.y - transform.position.y, Input.mousePosition.x - transform.position.x); float deltaRotation = mouseRotation - m_OldMouseAngle; m_Stamp.SetRotation(m_Stamp.GetRotation() + deltaRotation * Mathf.Rad2Deg); m_OldMouseAngle = mouseRotation; UpdateAngle(); if (!Input.GetMouseButton(0)) { m_Rotating = false; m_SoundRoutine.Clear(); transform.parent.GetComponent <Animator>().SetBool("showRotateAnim", true); Genie.I.LogEvent(OE_INTERACT.Create(OE_INTERACT.Type.DROP, "suitcase.stamp.rotate")); } } }
private void Update() { if (m_Scaling && m_Stamp != null) { RectTransform rectTransform = (RectTransform)transform; Vector2 localPos = rectTransform.InverseTransformPoint(Input.mousePosition); float percentAmount = Mathf.InverseLerp(-m_Height / 2, m_Height / 2, localPos.y); SetScale(Mathf.Lerp(MIN_SCALE, MAX_SCALE, percentAmount)); UpdatePosition(); if (!Input.GetMouseButton(0)) { m_Scaling = false; m_SoundRoutine.Clear(); transform.parent.GetComponent <Animator>().SetBool("showScaleAnim", true); Genie.I.LogEvent(OE_INTERACT.Create(OE_INTERACT.Type.DROP, "suitcase.stamp.scale")); } } }
public void Drop(Transform returnTransform = null, bool plop = true) { isReturningToSeat = (returnTransform != null); parent = returnTransform; // reparent creature & // have chicken drop to 'ground level' if (isReturningToSeat) { this.transform.SetParent(parent, true); } else { //Genie.instance.LogEvent(OE_INTERACT.Create(OE_INTERACT.Type.OTHER, "gameplay.thrownAway"); Genie.I.LogEvent(OE_INTERACT.Create(OE_INTERACT.Type.OTHER, "gameplay.thrownAway")); this.transform.SetParent(null, true); } UpdateQueuedSeatbelt(); if (plop) { this.transform.localScale = ChickenSettings.instance.dropScale;//new Vector3(0.66f, 2.5f, 1f); Vector3 pos = new Vector3(this.transform.position.x, -2.5f, this.transform.position.z); this.StartMove(pos, true, ChickenSettings.instance.dropSpeed, true); this.onMoveEnd = Creature_onFellToGround; } else if (isSeatbelted) { this.StartMove(prevLocalPosition, false, ChickenSettings.instance.seatbeltSpeed, true); this.onMoveEnd = Creature_onSnappedBack; } else { PrepWalkAnims(plop && isReturningToSeat); this.StartMove(prevLocalPosition, false, ChickenSettings.instance.snapBackSpeed, true); //this.StartMove(pos, true, ChickenSettings.instance.dropSpeed, true); this.onMoveEnd = Creature_onSnappedBack; } }
public override void Open() { base.Open(); Genie.I.LogEvent(OE_INTERACT.Create(OE_INTERACT.Type.START, "minigame.expression")); GetComponent <ExpressionMinigameGenerator>().GenerateLevel(); foreach (Text text in ExpressionTitle.GetComponentsInChildren <Text>()) { text.text = Level.Value.ToStringLookup(); } m_Expression.DesiredValue = Level.Value; m_Expression.SetNumPieces(Level.NumValueSlots * 2 - 1); SpawnNests(); SpawnChickens(); Timer.Timer.MaxTime = Level.TimeLimit; Timer.Timer.ResetTimer(); Pilot.SetTrigger("Intro"); this.WaitSecondsThen(2.5f, Begin); }
void groupGameBtn_onClick() { Genie.instance.LogEvent(OE_INTERACT.Create(OE_INTERACT.Type.TOUCH, "debug.expressionGame")); Application.LoadLevel("ExpressionPrototype"); }
void nestGameBtn_onClick() { Genie.instance.LogEvent(OE_INTERACT.Create(OE_INTERACT.Type.TOUCH, "debug.make10game")); Application.LoadLevel("Make10Prototype"); }
void homeBtn_onClick() { Genie.I.LogEvent(OE_INTERACT.Create(OE_INTERACT.Type.TOUCH, "debug.home")); StartCoroutine(Transition()); }
//Buttons void closeBtn_onClick() { Genie.I.LogEvent(OE_INTERACT.Create(OE_INTERACT.Type.TOUCH, "debug.close")); this.GetComponent <Animator>().SetTrigger("hidePopup"); }
private void SuitcaseButton_onClicked() { Genie.I.LogEvent(OE_INTERACT.Create(OE_INTERACT.Type.TOUCH, "levelComplete.suitcase")); OpenSuitcase(); }
void OpenOptions() { Genie.I.LogEvent(OE_INTERACT.Create(OE_INTERACT.Type.TOUCH, "mainMenu.options")); optionsPopup.SetActive(true); optionsPopup.GetComponent <Animator>().SetTrigger("showPopup"); }
private void Counter_OnReachTop() { Genie.I.LogEvent(OE_INTERACT.Create(OE_INTERACT.Type.OTHER, "stampsEarned." + Session.instance.numStamps.ToStringLookup())); Counter.OpenSuitcase(); }
void OnMouseUp() { if (!isDragging) { return; } StopDrag(); // check for bounding box intersections between group and place value subtraction car Bounds dragGroupBounds = dragGroup.GetComponent <SpriteRenderer>().bounds; int dragValue = dragGroup.GetComponent <DragGroup>().value; PlaceValueCtrl draggedColumn = null; if (dragGroupBounds.Intersects(column.bounds)) { draggedColumn = column; } else if (convertColumn != null && dragGroupBounds.Intersects(convertColumn.bounds) && (value == 1 || convertColumn.allowDragConvert)) { draggedColumn = convertColumn; } if (draggedColumn != null) { bool bFlashAlt = false; if (value == 1 && draggedColumn == convertColumn) { draggedColumn = column; bFlashAlt = true; } int creaturesToAdd = (dragValue / draggedColumn.value); if (draggedColumn.numCreatures + creaturesToAdd <= draggedColumn.creatureMax) { if (draggedColumn.value == 1) { //Genie.instance.LogEvent(OE_INTERACT.Create(OE_INTERACT.Type.DROP, "gameplay.onesColumn"); Genie.I.LogEvent(OE_INTERACT.Create(OE_INTERACT.Type.DROP, "gameplay.onesColumn")); } else { //Genie.instance.LogEvent(OE_INTERACT.Create(OE_INTERACT.Type.DROP, "gameplay.tensColumn"); Genie.I.LogEvent(OE_INTERACT.Create(OE_INTERACT.Type.DROP, "gameplay.tensColumn")); } // remove creatures from list CreatureCtrl[] children = dragGroup.GetComponentsInChildren <CreatureCtrl>(); for (int i = 0; i < children.Length; ++i) { _creatures.Remove(children[i]); } // place into column if (draggedColumn.numCreatures > 9) { dragGroup.GetComponent <DragGroup>().SetCreaturesBool("fullTen", true); } dragGroup.GetComponent <DragGroup>().SetCreaturesBool("inColumn", true); dragGroup.GetComponent <DragGroup>().SetCreaturesBool("inCar", false); dragGroup.GetComponent <DragGroup>().SetCreaturesTrigger("reset"); if (creaturesToAdd > 1) { column.Explode(dragGroup.GetComponent <DragGroup>()); draggedColumn.screen.Poof(); SoundManager.instance.PlayOneShot(SoundManager.instance.chickenConvertToOnes); } else { draggedColumn.AddDragGroup(dragGroup.GetComponent <DragGroup>()); if (bFlashAlt) { SoundManager.instance.PlayOneShot(SoundManager.instance.chickenSnapBack); convertColumn.ShowIncorrectFeedback(); } } } else { SnapBack(); } } else { //Genie.instance.LogEvent(OE_INTERACT.Create(OE_INTERACT.Type.DROP, "gameplay.sub.snapback"); //Genie.I.LogEvent(OE_INTERACT.Create(OE_INTERACT.Type.DROP, "gameplay.sub.snapback")); SnapBack(); } column.ForceDragOverFalse(); if (convertColumn != null) { convertColumn.UpdateDragOver(false, 10); convertColumn.ForceDragOverFalse(); } // dispose of drag group Destroy(dragGroup); dragGroup = null; }
void LaunchBtn_onClick() { //Genie.instance.LogEvent(OE_INTERACT.Create(OE_INTERACT.Type.TOUCH, "hud.submit"); Genie.I.LogEvent(OE_INTERACT.Create(OE_INTERACT.Type.TOUCH, "hud.submit")); onLaunched(); }
void skipBtn_onClick() { Genie.I.LogEvent(OE_INTERACT.Create(OE_INTERACT.Type.TOUCH, "intro.skip")); StartCoroutine(Transition()); this.enabled = false; }
void OnMouseUp() { if (!isDragging) { return; } StopDrag(); PlaceValueCtrl ones = container.controller.screen.GetComponent <MyScreen>().onesColumn; PlaceValueCtrl tens = container.controller.screen.GetComponent <MyScreen>().tensColumn; // update place value column over states ones.UpdateDragOver(false, (numOnes == 0 ? numTens * 10 : numOnes)); tens.UpdateDragOver(false, numTens); // check for bounding box intersections between group and place value columns bool onesPlacement = this.GetComponent <SpriteRenderer>().bounds.Intersects(ones.bounds) && (ones.numCreatures + numOnes + numTens * 10) <= ones.creatureMax && (!isMultipleOfTen || ones.allowDragConvert); bool tensPlacement = this.GetComponent <SpriteRenderer>().bounds.Intersects(tens.bounds) && (tens.numCreatures + numTens) <= tens.creatureMax && !onesPlacement; if ((onesPlacement || tensPlacement) && !isMultipleOfTen && isGreaterThanNine) { //NOTE: this probably doesn't happen any more, should confirm //Genie.instance.LogEvent(OE_INTERACT.Create(OE_INTERACT.Type.DROP, "gameplay.eitherColumn"); Genie.I.LogEvent(OE_INTERACT.Create(OE_INTERACT.Type.DROP, "gameplay.eitherColumn")); ones.ForceDragOverFalse(value); RemoveFromContainerDistributeToPlaceValue(); } else if (onesPlacement && !tensPlacement && isLessThanTen) { //Genie.instance.LogEvent(OE_INTERACT.Create(OE_INTERACT.Type.DROP, "gameplay.onesColumn"); Genie.I.LogEvent(OE_INTERACT.Create(OE_INTERACT.Type.DROP, "gameplay.onesColumn")); // if on the correct place-value column, snap to place-value column (remove from queue) // try to place in ones column ones.ForceDragOverFalse(value); RemoveFromContainerAddToPlaceValue(ones); } else if (tensPlacement && !onesPlacement && isMultipleOfTen) { //Genie.instance.LogEvent(OE_INTERACT.Create(OE_INTERACT.Type.DROP, "gameplay.tensColumn"); Genie.I.LogEvent(OE_INTERACT.Create(OE_INTERACT.Type.DROP, "gameplay.tensColumn")); // try to place in tens column tens.ForceDragOverFalse(value); RemoveFromContainerAddToPlaceValue(tens); } else if (tensPlacement && !onesPlacement && !isMultipleOfTen) { //Genie.instance.LogEvent(OE_INTERACT.Create(OE_INTERACT.Type.DROP, "gameplay.tensColumn"); Genie.I.LogEvent(OE_INTERACT.Create(OE_INTERACT.Type.DROP, "gameplay.tensColumn")); // highlight tens column as incorrect placement (reminder) tens.ShowIncorrectFeedback(); SoundManager.instance.PlayOneShot(SoundManager.instance.chickenSnapBack); // try to place in ones column ones.ForceDragOverFalse(value); RemoveFromContainerAddToPlaceValue(ones, true); } else if (onesPlacement && isMultipleOfTen && ones.numCreatures < 10 && ones.allowDragConvert) { //Genie.instance.LogEvent(OE_INTERACT.Create(OE_INTERACT.Type.DROP, "gameplay.onesColumn"); Genie.I.LogEvent(OE_INTERACT.Create(OE_INTERACT.Type.DROP, "gameplay.onesColumn")); EnlearnInstance.I.LogActions(EnlearnInstance.Action.AddNestToOnes); // place a 10s in 1s column ones.ForceDragOverFalse(value); CreatureCtrl[] children = this.GetComponentsInChildren <CreatureCtrl>(); bool bIsBrown = children[0].color == CreatureCtrl.COLOR_BROWN; SoundManager.instance.PlayOneShot(SoundManager.instance.chickenConvertToOnes); ones.Add(10, bIsBrown); // add explosion effects container.controller.screen.Poof(); Cleanup(); } else { if (onesPlacement) { // update place value column over states ones.ForceDragOverFalse(value); ones.GetComponent <Animator>().SetTrigger("correct"); } if (tensPlacement) { tens.ForceDragOverFalse(value); tens.GetComponent <Animator>().SetTrigger("correct"); } // else, if we're overlapping with both or neither // snap back to QueueContainer //SnapBack(); CreatureCtrl[] children = this.GetComponentsInChildren <CreatureCtrl>(); children[0].Drop(); Cleanup(); } }
void NumberPadBtn_onClick() { Genie.I.LogEvent(OE_INTERACT.Create(OE_INTERACT.Type.TOUCH, "hud.numberPad.toggle")); onNumberPad(); }
void PauseBtn_onClick() { //Genie.instance.LogEvent(OE_INTERACT.Create(OE_INTERACT.Type.TOUCH, "hud.reset"); Genie.I.LogEvent(OE_INTERACT.Create(OE_INTERACT.Type.TOUCH, "hud.pause")); onPause(); }