public ActionResult Stage1() { if (GetGameStage() != GameStage.Start) { return(RedirectToAction("Index")); } var playerId = Request.Cookies.Get("PlayerId").Value; var playerGuid = new Guid(playerId); var player = db.Players.First(x => x.UniqueId == playerGuid); var ricketyBridge = db.RicketyBridges.First(x => x.Id == player.RicketyBridgeId); var stage = new Stage1Model() { UserId = new Guid(playerId), TaskText = $@" {Environment.NewLine}Four travelers are going to their friend house. As it is getting late, they decide to take a shortcut that is a long, long dark tunnel {Environment.NewLine} with many turns and bends. Sadly, they are not completely prepared, and brought only one phone with flashlight. {Environment.NewLine}The light from it is too little for it to be safe to have 2 walk together at same time.(2 can cross, and then one them has to bring the light back) They each can move at different speed, which are given here: {ricketyBridge.Speedster1} min, {ricketyBridge.Speedster2} min, {ricketyBridge.SlowPoke1} min, {ricketyBridge.SlowPoke2} min| {Environment.NewLine} What is the fastest time they all can get through the tunnel? {Environment.NewLine}Hint: its faster than {ricketyBridge.WrongAnswer} min." }; return(View(stage)); }
public ActionResult Stage1([Bind(Include = "Answer")] Stage1Model stage) { //This done nothing if (stage == null) { return(View(stage)); } var playerId = Request.Cookies.Get("PlayerId").Value; var playerGuid = new Guid(playerId); var player = db.Players.First(x => x.UniqueId == playerGuid); var correctAnswer = db.RicketyBridges.First(x => x.Id == player.RicketyBridgeId).CorrectAnswer; if (correctAnswer == stage.Answer) { player.GameStage = GameStage.FirstDone; } else { player.GameStage = GameStage.Lost; } db.SaveChanges(); return(RedirectToAction("Stage2")); }
void iniciar() { elementosManobra = new Stage1Model(); this.msgCuidado = GameObject.Find("msgCuidado"); this.msgCuidado.SetActive(true); this.transformador = GameObject.Find("transformador"); this.transformador.SetActive(true); this.msgOk = GameObject.Find("msgOk"); this.msgOk.SetActive(false); this.WinText = GameObject.Find("WinText"); this.WinText.SetActive(false); this.txtStep = GameObject.Find("txtStep"); this.txtStep.SetActive(false); this.maxOjetivos = 2; }