//Set references to the playerIcon, start necessary coroutines, etc. void InitializeNPCPanelController() { playerTransform = CurrentLevelVariableManagement.GetPlayerReference().transform; playerIcon = transform.Find("FlippingItem").Find("Character").Find("Head").GetComponent <SpriteRenderer> ().sprite; mainSpeechControl = CurrentLevelVariableManagement.GetLevelUIReference().transform.Find("Speech Bubble").GetComponent <SpeechControl> (); mainInteractablePanelController = CurrentLevelVariableManagement.GetLevelUIReference().transform.Find("InteractablePanels").gameObject.GetComponent <InteractablePanelController> (); StartCoroutine("CheckForAndAttemptToSpeakToPlayer"); }
public Application(ILogger logger, IConfiguration configuration) { _logger = logger; _configuration = configuration; _motionDetectControl = new MotionDetectControl(logger); _speechControl = new SpeechControl(logger, _configuration["AzureSpeechKey"], _configuration["AzureRegion"]); _cameraControl = new CameraControl(logger); _faceDetectControl = new FaceDetectControl(logger, _configuration["AzureFaceKey"], _configuration["AzureRegion"]); _motionDetectControl.OnMotionDetected = () => Task.Run(OnMotionDetectedAsync); }
public override void Update(GameTime gameTime, GameEntry gameEntry, Level level) { var currentPad = GamePad.GetState(PlayerIndex); #if WINDOWS var currentSpeech = SpeechControl.GetState(PlayerIndex); #endif #if DEBUG if (currentPad.Buttons.RightShoulder == ButtonState.Pressed && lastPad.Buttons.RightShoulder == ButtonState.Released) { level.SendMessage(string.Format("Score: {0}", Points)); } #endif var run = currentPad.Triggers.Left; var moveX = currentPad.ThumbSticks.Left.X; var jump = currentPad.Buttons.A == ButtonState.Pressed && lastPad.Buttons.A == ButtonState.Released; jump = jump || (currentSpeech.EmulateButtons.A == ButtonState.Pressed && currentSpeech.EmulateButtons.A == ButtonState.Released); var jumpPower = currentPad.Buttons.Y == ButtonState.Pressed && lastPad.Buttons.Y == ButtonState.Released; Update(gameTime, gameEntry, level, run, moveX, jump, jumpPower); lastPad = currentPad; #if WINDOWS lastSpeech = currentSpeech; #endif var enemyHit = IsCollisionEnemies(level); var goalHit = IsCollisionGoalPoints(level); if (enemyHit.HasValue) { if (lastEnemyHit != enemyHit.Value) { level.SendMessage(string.Format("id:{0} - Enemy Hit", enemyHit)); Points -= 50; lastEnemyHit = enemyHit.Value; } } if (goalHit.HasValue) { level.SendMessage(string.Format("id:{0} - Goal Hit", goalHit)); Points += 100; level.ChangeLevel(level.Goals[goalHit.Value].TargetLevelName); } }
void Start() { start = transform.localPosition; targetItem = transform.localPosition; objs = ( ObjectManager )FindObjectOfType(typeof(ObjectManager)); speechControl = new SpeechControl(); progress = new Progress(); progress.SetItem("winder", objs.winderStage, objs.winderInventory); progress.SetItem("button", objs.buttonStage, objs.buttonInventory); progress.SetItem("thread", objs.threadStage, objs.threadInventory); progress.SetItem("photo_1", objs.photo1Stage, objs.photo1Inventory); progress.SetItem("photo_2", objs.photo2Stage, objs.photo2Inventory); progress.SetItem("ballerina", objs.ballerinaStage, objs.ballerinaInventory); StartCoroutine("gameStart"); }
protected void ProcessSpeechCommand(SpeechControl.ComponentControl.SpeechCommand command) { switch(command) { case SpeechControl.ComponentControl.SpeechCommand.TelevisionOff: this.TV.PowerOff(); break; case SpeechControl.ComponentControl.SpeechCommand.TelevisionOn: this.TV.PowerOn(); break; case SpeechControl.ComponentControl.SpeechCommand.WatchTelevision: if(!this.PrePro.PoweredOn) this.PrePro.PowerOn(); this.PrePro.InputSAT(); if(!this.TV.PoweredOn) this.TV.PowerOn(); this.TV.SetInputHDMI1(); this.TV.SetVolume(0); break; case SpeechControl.ComponentControl.SpeechCommand.WatchMovie: this.Oppo.Eject(); if(!this.PrePro.PoweredOn) this.PrePro.PowerOn(); this.PrePro.InputDVD(); this.PrePro.Input8Channel(); if(!this.TV.PoweredOn) this.TV.PowerOn(); this.TV.SetInputHDMI1(); this.TV.SetVolume(0); break; case SpeechControl.ComponentControl.SpeechCommand.ViewComputer: if(!this.TV.PoweredOn) this.TV.PowerOn(); this.TV.SetInputHDMI2(); this.TV.SetVolume(0); if(!this.PrePro.PoweredOn) { this.PrePro.PowerOn(); } this.PrePro.InputVID1(); break; case SpeechControl.ComponentControl.SpeechCommand.PowerOff: this.TV.PowerOff(); this.PrePro.PowerOff(); break; case SpeechControl.ComponentControl.SpeechCommand.ListenStereo: if(!this.PrePro.PoweredOn) this.PrePro.PowerOn(); this.PrePro.InputCD(); break; default: Console.WriteLine("Unknown speech command received"); break; } }
public void OnDialog(SpeechControl speechController, Progress progress) { DisableScreens(); HandleSpeechEvent(speechController.Current().speech, progress); }
public TypeSequence NextSpeechAndNewTypeSequence(SpeechControl speechController, Progress progress) { if (currentCharacterInScroll < totalCharactersInText + 15) { if (currentCharacterInScroll < totalCharactersInText) { currentCharacterInScrollf = ( float )totalCharactersInText; currentCharacterInScroll = totalCharactersInText; actionText.maxVisibleCharacters = totalCharactersInText; dialogText.maxVisibleCharacters = totalCharactersInText; } return(TypeSequence.DIALOG); } DisableScreens(); SpeechPackage speechPack = speechController.Continue(); Speech speechHeld = speechPack.speech; if (speechHeld.type == EventType.FIX) { if (speechHeld.dialog == "bear" && progress.Bear == false) { progress.Bear = true; buttonInventory.SetActive(false); threadInventory.SetActive(false); oldBear.SetActive(false); newBear.SetActive(true); progress.heartHeal++; } else if (speechHeld.dialog == "frame" && progress.Frame == false) { progress.Frame = true; photo1Inventory.SetActive(false); photo2Inventory.SetActive(false); oldPortrait.SetActive(false); newPortrait.SetActive(true); progress.heartHeal++; } else if (speechHeld.dialog == "box" && progress.Box == false) { progress.Box = true; ballerinaInventory.SetActive(false); winderInventory.SetActive(false); oldBox.SetActive(false); newBox.SetActive(true); progress.heartHeal++; } else if (speechHeld.dialog == "finale" && progress.Box == false) { ballerinaInventory.SetActive(false); winderInventory.SetActive(false); oldBox.SetActive(false); newBox.SetActive(true); progress.heartHeal++; //FINALE } merry.heart1.SetActive(false); merry.heart2.SetActive(false); merry.heart3.SetActive(false); merry.heart4.SetActive(false); switch (progress.GetHeartStatus()) { case HeartStatus.ONE: merry.heart1.SetActive(true); break; case HeartStatus.TWO: merry.heart2.SetActive(true); break; case HeartStatus.THREE: merry.heart3.SetActive(true); break; case HeartStatus.FOUR: merry.heart4.SetActive(true); break; } speechPack = speechController.Continue(); speechHeld = speechPack.speech; //prevType = TypeSequence.ON_ITEM; // return TypeSequence.ITEM_SEARCH; } if (speechHeld.type == EventType.FINALE) { SceneManager.LoadScene("ED"); } if (!speechPack.isValidSPeech) { if (progress.heartHeal == 3) { progress.heartHeal = 4; speechController.Start(Events.finale); speechPack = speechController.Current(); speechHeld = speechPack.speech; HandleSpeechEvent(speechHeld, progress); return(TypeSequence.DIALOG); } if (prevType == TypeSequence.ON_ITEM) { OnItem(showInventoryButton); return(TypeSequence.ON_ITEM); } else { //TypeSequence.ITEM_SEARCH ItemSearch(); return(TypeSequence.ITEM_SEARCH); } } if (speechHeld.type == EventType.OPEN_INVENTORY) { OnInventory(); prevType = TypeSequence.ON_ITEM; return(TypeSequence.INVENTORY); } if (speechHeld.type == EventType.OPEN_INVENTORY_2ND_STAGE) { OnInventory(); prevType = TypeSequence.ON_ITEM; return(TypeSequence.INVENTORY); } if (speechHeld.type == EventType.AQUIRE_ITEM) { ItemSearch(); progress.GetItem(speechHeld.dialog); prevType = TypeSequence.ON_ITEM; return(TypeSequence.ITEM_SEARCH); } HandleSpeechEvent(speechHeld, progress); return(TypeSequence.DIALOG); }