public ResolvePhase() { this.periodPhase = Time.FromSeconds(3); this.timeElapsed = Time.Zero; this.moment = ResolvePhaseMoment.START; }
protected override void OnInternalGameEvent(OfficeWorld world, AObject lObject, AObject lObjectTo, string details) { if (details.Equals("endDialogue")) { DialogueObject dialogue; AObject patient = world.GetObjectFromId("patient main"); if (this.isSuccess) { dialogue = world.GetObjectFromId("dialogue successAnswer") as DialogueObject; } else { dialogue = world.GetObjectFromId("dialogue failAnswer") as DialogueObject; } if (dialogue == lObject) { this.timeElapsed = Time.Zero; this.periodPhase = Time.FromSeconds(3); this.moment = ResolvePhaseMoment.END_DIALOGUE; } } else if (details.Equals("speedUpDialogue")) { DialogueObject dialogue; if (this.isSuccess) { dialogue = world.GetObjectFromId("dialogue successAnswer") as DialogueObject; } else { dialogue = world.GetObjectFromId("dialogue failAnswer") as DialogueObject; } dialogue.SpeedFactor = 10; } }
public override void UpdateLogic(OfficeWorld world, Time timeElapsed) { this.timeElapsed += timeElapsed; if (this.timeElapsed > periodPhase) { DialogueObject dialogue = null; switch (this.moment) { case ResolvePhaseMoment.START: if (this.isSuccess) { dialogue = world.GetObjectFromId("dialogue successAnswer") as DialogueObject; } else { dialogue = world.GetObjectFromId("dialogue failAnswer") as DialogueObject; } dialogue.SetKinematicParameters(new Vector2f(-380f, dialogue.GetHeight(-150)), new Vector2f(0f, 0f)); dialogue.LaunchDialogue(2); AObject queueTalk = world.GetObjectFromId("queueTalk main"); queueTalk.SetKinematicParameters(new Vector2f(-200f, 120f), new Vector2f(0f, 0f)); AObject bubble = world.GetObjectFromId("bubble main"); bubble.SetAnimationIndex(2); this.timeElapsed = Time.Zero; this.periodPhase = Time.FromSeconds(2); this.moment = ResolvePhaseMoment.BUBBLE_APPEARED; break; case ResolvePhaseMoment.END_DIALOGUE: AObject patient = world.GetObjectFromId("patient main"); if (this.isSuccess) { dialogue = world.GetObjectFromId("dialogue successAnswer") as DialogueObject; patient.SetAnimationIndex(5); } else { dialogue = world.GetObjectFromId("dialogue failAnswer") as DialogueObject; patient.SetAnimationIndex(4); } dialogue.ResetDialogue(); bubble = world.GetObjectFromId("bubble main"); bubble.SetAnimationIndex(3); queueTalk = world.GetObjectFromId("queueTalk main"); queueTalk.SetKinematicParameters(new Vector2f(10000, 10000), new Vector2f(0, 0)); this.timeElapsed = Time.Zero; this.periodPhase = Time.FromSeconds(2); this.moment = ResolvePhaseMoment.END; break; case ResolvePhaseMoment.END: if (this.isSuccess) { world.NotifyGameStateChanged(world.CurrentLevel.LevelName, new GameEvent(EventType.ENDING, "good")); } else { world.NotifyGameStateChanged(world.CurrentLevel.LevelName, new GameEvent(EventType.ENDING, "bad")); } this.NodeState = NodeState.NOT_ACTIVE; break; } } }