public void createLocalVariable(string name) { if (!GlobalVariables.ContainsVariable(name + "_" + variable)) { GlobalVariables.AddNewAs(name + "_" + variable, 0); //Cambiar este 0 por Value para que por defecto aparezca la opción. } }
public void createGlobalVariable() { if (!GlobalVariables.ContainsVariable(variable)) { GlobalVariables.AddNewAs(variable, 0); //Cambiar este 0 por Value para que por defecto aparezca la opción. } }
public override void TriggerResponse(GameController controller) { base.TriggerResponse(controller); controller.playerManager.characteristics.playerJob = jobToGive; if (!GlobalVariables.ContainsVariable(jobToGive.jobName)) { GlobalVariables.AddNewAs(jobToGive.jobName, 1); } else { GlobalVariables.SetValue(jobToGive.jobName, 1); } if (!GlobalVariables.ContainsVariable("hasjob")) { GlobalVariables.AddNewAs("hasjob", 1); } else { GlobalVariables.SetValue("hasjob", 1); } Debug.Log("hasjob: " + GlobalVariables.GetValueOf("hasjob")); controller.questManager.updateQuests(); }
public void updateQuests() { foreach (Quest q in quests) { q.update(); } if (GlobalVariables.ContainsVariable("diario")) { if (GlobalVariables.GetValueOf("diario") == 1) { bar.color = new Color(bar.color.r, bar.color.g, bar.color.b, 256); text.text = "<b>Diario</b>\n" + getQuestLog(); } else { bar.color = new Color(bar.color.r, bar.color.g, bar.color.b, 0); text.text = ""; } } else { bar.color = new Color(bar.color.r, bar.color.g, bar.color.b, 0); text.text = ""; } }
/// <summary> /// Intenta moverse en la dirección dada. Si esta dirección no pertenece a una salida, no se mueve. /// </summary> /// <param name="directionNoun"></param> public void AttemptToChangeRooms(DirectionKeyword directionNoun) { if (converter == null) { converter = KeywordToStringConverter.Instance; } if (exitDictionary.ContainsKey(directionNoun)) { foreach (Exit e in currentRoom.exits) { if (e.myKeyword == directionNoun && !e.isAble) { controller.LogStringWithReturn("No puedes ir en esa dirección."); return; } } Exit exitToGo = exitDictionary[directionNoun]; if (exitToGo.exitActionDescription == "") { controller.LogStringWithReturn("Te diriges hacia el " + converter.ConvertFromKeyword(directionNoun) + "."); } else { controller.LogStringWithReturn(exitToGo.exitActionDescription); } HideEnemies(); currentRoom = exitDictionary[directionNoun].conectedRoom; currentPosition = currentRoom.roomPosition; miniMapper.MovePlayerInMap(currentPosition); equipManager.updateText(); inventoryManager.DisplayInventory(); if (GlobalVariables.ContainsVariable("diario")) { if (GlobalVariables.GetValueOf("diario") == 1) { controller.questManager.updateQuests(); } } PlayerChangedRooms(); //Añadido para network controller.DisplayRoomText(); } else if (directionNoun != DirectionKeyword.unrecognized) { controller.LogStringWithReturn("No hay caminos hacia el " + converter.ConvertFromKeyword(directionNoun) + "."); } else { controller.LogStringWithReturn("Eso sería bastante difícil."); } }
public bool checkVar() { if (GlobalVariables.ContainsVariable(variableName)) { return(true); } return(false); }
/// <summary> /// Termina el momento de creación de personaje. /// </summary> private void EndResponse() { GameState.Instance.ChangeCurrentState(GameState.GameStates.exploration); gameController.playerRoomNavigation.AttemptToChangeRooms( gameController.playerRoomNavigation.currentRoom.exits[0].myKeyword); if (!GlobalVariables.ContainsVariable("om")) { GlobalVariables.AddNewAs("om", 1); } }
public void applyEffects() { if (variables != null) { foreach (GlobalVariable v in variables) { if (GlobalVariables.ContainsVariable(v.name)) { GlobalVariables.SetValue(v.name, v.value); Debug.Log("'" + v.name + "' = " + v.value + "."); } else { GlobalVariables.AddNewAs(v.name, v.value); Debug.Log("new: '" + v.name + "' = " + v.value + "."); } } } }
public void updateText() { text.color = inactiveColor; text.text = "<b>- + -</b>"; string t = ""; if (GlobalVariables.ContainsVariable("om") && GlobalVariables.GetValueOf("om") == 1) { text.color = activeColor; text.text = ""; if (player.playerName != "jugador") { t += player.playerName + " | "; } if (player.gender == "macho") { if (characteristics.playerRace.raceName != "ninguna") { t += characteristics.playerRace.raceName + " "; } } else { switch (characteristics.playerRace.raceName) { case "Búho": t += "Búha "; break; case "Toro": t += "Vaca "; break; case "Oso": t += "Osa "; break; case "Conejo": t += "Coneja "; break; } } if (characteristics.playerJob.jobName != "ninguno") { t += characteristics.playerJob.jobName + " "; t += "Nivel " + player.playerLevel + " "; } t += "--"; text.text = t; if (player.currentState.stateName != "estándar") { text.text += " [" + player.currentState.stateName + "]"; } int health = Mathf.RoundToInt(player.currentHealth / player.MaxHealth * 100); if (health > 100) { health = 100; } string code = ColorUtility.ToHtmlStringRGB(healthGradient.Evaluate(player.currentHealth / player.MaxHealth)); text.text += "<color=#" + code + "> Salud " + health + "%</color>"; } }