public async Task RunInteractionStep(InteractionStep interactionStep, Vector2 roomObjectLocation) { Logger.Log("Make interaction Transaction for {0}", ObjectInteraction.Name); if (ObjectInteraction.CharacterRole == ObjectInteractionCharacterRole.NoCharacter) { if (interactionStep.HasSequenceLine()) { GameObject interactionSequenceLine = OnScreenTextContainer.Instance.CreateInteractionSequenceLine(interactionStep.InteractionSequenceLine, roomObjectLocation); interactionStep.InteractionSequenceLineGO = interactionSequenceLine; } await Task.Delay(interactionStep.Duration); interactionStep.CleanUp(); } else { Vector2 characterTarget = roomObjectLocation; InteractingCharacter.PlayerLocomotion.SetLocomotionTarget(characterTarget); Logger.Log("characterTarget for {0} is {1},{2}", InteractingCharacter.CharacterName, characterTarget.x, characterTarget.y); await MoveToInteractionLocation(InteractingCharacter, characterTarget, ObjectInteraction, RoomObject); if (characterTarget != InteractingCharacter.PlayerLocomotion.Target) // character target was changed on the way { return; } RoomObject.SetInteractingCharacter(InteractingCharacter); InteractingCharacter.CharacterAnimationHandler.SetLocomotion(false); InteractingCharacter.SetCharacterActionState(CharacterActionState.PlayerAction); InteractingCharacter.PlayerLocomotion.SetLocomotionTarget(InteractingCharacter.transform.position); if (interactionStep.HasSequenceLine()) { GameObject interactionSequenceLine = OnScreenTextContainer.Instance.CreateInteractionSequenceLine(interactionStep.InteractionSequenceLine, roomObjectLocation); interactionStep.InteractionSequenceLineGO = interactionSequenceLine; } await Task.Delay(interactionStep.Duration); interactionStep.CleanUp(); //TEMPORARY if (ObjectInteraction.ObjectInteractionType == ObjectInteractionType.Record) { // TODO externalise album record action into own class RecordSong(); } ///// } return; }
private static RoomObjectBlueprint ControlRoomMicrophoneBlueprint() { RoomObjectBlueprint blueprint = new RoomObjectBlueprint(RoomObjectName.ControlRoomMicrophone) .WithName("Microphone") .WithMenuDescription("Test one, two") .WithObjectInteractions(new ObjectInteraction[] { ObjectInteraction.Create(ObjectInteractionType.Perform, "Speak", ObjectInteractionCharacterRole.CharacterAtRoomObject) .AddInteractionStep(InteractionStep.Create().WithSequenceLine("Everyone is listening to the instructions")) }) .WithCharacterRoutines(new CharacterRoutineType[] { CharacterRoutineType.Create(CharacterRoutineTypeName.Sing) }); return(blueprint); }
private static RoomObjectBlueprint GuitarBlueprint() { RoomObjectBlueprint blueprint = new RoomObjectBlueprint(RoomObjectName.Guitar) .WithName("Guitar") .WithMenuDescription("A mean guitar") .WithPrice(5) .WithObjectInteractions(new ObjectInteraction[] { ObjectInteraction.Create(ObjectInteractionType.Perform, "Guitar plays itself") .AddInteractionStep(InteractionStep.Create().WithSequenceLine("It is a self-playing guitar")), ObjectInteraction.Create(ObjectInteractionType.Perform, "Play guitar", ObjectInteractionCharacterRole.CharacterAtRoomObject) .AddInteractionStep(InteractionStep.Create().WithSequenceLine("A mean guitar")), ObjectInteraction.Create(ObjectInteractionType.Practice, "Learn playing the guitar", ObjectInteractionCharacterRole.CharacterInRoom) .AddInteractionStep(InteractionStep.Create().WithSequenceLine("Our hero hopes he will be as good Jimmy Hendrix one day.")) }); return(blueprint); }
private static RoomObjectBlueprint MixPanelBlueprint() { RoomObjectBlueprint blueprint = new RoomObjectBlueprint(RoomObjectName.MixPanel) .WithName("Mix panel") .WithMenuDescription("Turn everything up to 11") .WithObjectInteractions(new ObjectInteraction[] { ObjectInteraction.Create(ObjectInteractionType.Record, "Remix", ObjectInteractionCharacterRole.CharacterAtRoomObject) .AddInteractionStep(InteractionStep.Create().WithSequenceLine("The song now sounds even better")), ObjectInteraction.Create(ObjectInteractionType.Record, "Record song", ObjectInteractionCharacterRole.CharacterAtRoomObject) .AddInteractionStep(InteractionStep.Create().WithSequenceLine("A new song was recorded")) }) .WithCharacterRoutines(new CharacterRoutineType[] { }); return(blueprint); }
private static RoomObjectBlueprint PianoBlueprint() { RoomObjectBlueprint blueprint = new RoomObjectBlueprint(RoomObjectName.Piano) .WithName("Piano") .WithMenuDescription("Be more like Mozart") .WithPrice(15) .WithObjectInteractions(new ObjectInteraction[] { ObjectInteraction.Create(ObjectInteractionType.Perform, "Self-play") .AddInteractionStep(InteractionStep.Create().WithSequenceLine("It is a self-playing piano")), ObjectInteraction.Create(ObjectInteractionType.Perform, "Perform", ObjectInteractionCharacterRole.CharacterAtRoomObject) .AddInteractionStep(InteractionStep.Create().WithSequenceLine("Our hero is playing the guitar")), ObjectInteraction.Create(ObjectInteractionType.Practice, "Practice", ObjectInteractionCharacterRole.CharacterInRoom) .AddInteractionStep(InteractionStep.Create().WithSequenceLine("Our hero hopes he will play as Rachmaninov one day.")), ObjectInteraction.Create(ObjectInteractionType.Repair, "Repair", ObjectInteractionCharacterRole.CharacterAtRoomObject) .AddInteractionStep(InteractionStep.Create().WithSequenceLine("The piano is no longer broken!")) }); return(blueprint); }
private static RoomObjectBlueprint TelephoneBlueprint() { RoomObjectBlueprint blueprint = new RoomObjectBlueprint(RoomObjectName.Telephone) .WithName("Telephone") .WithMenuDescription("A classic black telephone") .WithObjectInteractions(new ObjectInteraction[] { ObjectInteraction.Create(ObjectInteractionType.Contact, "Call the police") .AddInteractionStep(InteractionStep.Create().WithSequenceLine("You asked the police to removed the loud, beared hippies from your studio")), ObjectInteraction.Create(ObjectInteractionType.Contact, "Order a pizza") .AddInteractionStep(InteractionStep.Create().WithSequenceLine("You ordered a pizza for the whole band")), ObjectInteraction.Create(ObjectInteractionType.Contact, "Organise a tour") .AddInteractionStep(InteractionStep.Create().WithSequenceLine("The band is going on tour again!")) }) .WithCharacterRoutines(new CharacterRoutineType[] { CharacterRoutineType.Create(CharacterRoutineTypeName.MakePhoneCall) }); return(blueprint); }
void NextStep() { current++; if (current < Interactions.Count) { InteractionStep istep = Interactions[current]; promptText.text = istep.Prompt; int m = Mathf.Min(istep.Responses.Length, responseButtons.Length); for (int i = 0; i < m; i++) { responseButtons[i].gameObject.SetActive(true); Text text = responseButtons[i].GetComponentInChildren <Text>(); if (text != null) { text.text = istep.Responses[i]; } } for (int i = m; i < responseButtons.Length; i++) { responseButtons[i].gameObject.SetActive(false); } } }
public ObjectInteraction AddInteractionStep(InteractionStep interactionStep) { InteractionSteps.Add(interactionStep); return(this); }