public void AddChoices() { PlayerChoice askPlayerName = new PlayerChoice("PlayerName"); askPlayerName.ChoicePrompt = delegate(GameController controller, string userInput) { Player player = controller.Game.Player; if (userInput != "") { player.FirstName = userInput; return(true); } GameController.InputResponse.Append("What is your name"); return(false); }; askPlayerName.ChoiceResult = delegate(GameController controller) { StorySequenceState StoryState = (StorySequenceState)controller.GameStates["StoryScene"]; Player player = controller.Game.Player; GameScene scene = StoryState.Scenes[Scene.IntroLetter]; string scenePage = scene.SceneText.Dequeue(); scenePage = scenePage.Replace("<firstName>", player.FirstName); scene.SceneText.Enqueue(scenePage); controller.ActiveStoryScene = Scene.IntroLetter; controller.SetGameState("StoryScene"); }; Choices[Choice.PlayerName] = askPlayerName; }
public IPlayerContext GetPlayerContext(PlayerChoice player) { lock (SyncObj) { int slotIndex = PlayerManagerConsts.PRIMARY_SLOT; switch (player) { case PlayerChoice.PrimaryPlayer: slotIndex = PlayerManagerConsts.PRIMARY_SLOT; break; case PlayerChoice.SecondaryPlayer: slotIndex = PlayerManagerConsts.SECONDARY_SLOT; break; case PlayerChoice.CurrentPlayer: slotIndex = _currentPlayerIndex; break; case PlayerChoice.NotCurrentPlayer: slotIndex = 1 - _currentPlayerIndex; break; } return(GetPlayerContextInternal(slotIndex)); } }
void BuyGoblinBox() { if (ShowingVillage.Members.Count == 0) { PlayerChoice.SetupPlayerChoice(new PlayerChoice.ChoiceOption[] { OkOption }, "No goblins for sale here."); } if (team.Treasure >= 5) { var options = ShowingVillage.Members.Take(4).Select(g => new PlayerChoice.ChoiceOption() { Action = () => PlayerController.BuyGoblin(g, 5, ShowingVillage), Description = g.name + " the " + g.ClassType }).ToList(); options.Add(No); PlayerChoice.SetupPlayerChoice(options.ToArray(), "Buy a Goblin for 5 goblin treasures?"); } else { PlayerChoice.SetupPlayerChoice(new PlayerChoice.ChoiceOption[] { OkOption }, "You do not have enough goblin treasure to buy goblins."); } }
private Transform BuildPlayerChoice(string[] strArray) { string idStr = strArray[0]; string choiceText = strArray[1]; string nextNode = strArray[3]; PlayerChoice choice = (Instantiate(InGamePlayerChoicePrefab, new Vector3(0f, 0f, 0f), Quaternion.identity) as GameObject).GetComponent <PlayerChoice>(); choice.InitialiseMe(idStr, choiceText, nextNode); return(choice.transform); }
new void Awake() { base.Awake(); Type = WindowType.PlayerChoice; if (!Instance) { Instance = this; } }
public void Chosen(PlayerChoice playerChoice) { //colorRect.Color = new Color(255,255,0); may be useful if (playerChoice == PlayerChoice.One) { choice_one.Show(); } else if (playerChoice == PlayerChoice.Two) { choice_two.Show(); } }
void BuyFoodBox() { if (team.Treasure >= 2) { PlayerChoice.SetupPlayerChoice(new PlayerChoice.ChoiceOption[] { BuyFood, No }, "Buy 5 food for 2 Goblin Treasures?"); } else { PlayerChoice.SetupPlayerChoice(new PlayerChoice.ChoiceOption[] { OkOption }, "You do not have enough goblin treasure to buy food."); } }
public void UpdateChoice() { if (Input.GetKey(foodKey)) { choice = PlayerChoice.Food; } if (Input.GetKey(chickenKey)) { choice = PlayerChoice.Chicken; } if (Input.GetKey(giveChickenKey)) { choice = PlayerChoice.GiveChicken; } }
public void InsertDialogueNodeResult(GameObject selectedBtn) { NewNodeChoiceResultBtn dialogueNodeChoiceResultBtn = selectedBtn.GetComponent <NewNodeChoiceResultBtn>(); //(GetSelectedItemFromGroup(selectedChoice) as PlayerChoice).MyNextNode = dialogueNodeChoiceResultBtn.MyID; string[,] fieldVals = new string[, ] { { "NextNodes", dialogueNodeChoiceResultBtn.MyID } }; PlayerChoice selectedChoiceObj = playerChoicesListUI.GetSelectedItemFromGroup(playerChoicesListUI.SelectedChoice) as PlayerChoice; selectedChoiceObj.MyNextNode = dialogueNodeChoiceResultBtn.MyID; DbCommands.UpdateTableTuple("PlayerChoices", "ChoiceIDs = " + selectedChoiceObj.MyID, fieldVals); DisplayResultsRelatedToChoices(); DeactivateNewChoiceResult(); }
void SellGoblinBox() { //TODO: maybe shuffle first var options = team.Members.Where(g => g != team.Leader).Take(4).Select(g => new PlayerChoice.ChoiceOption() { Action = () => PlayerController.SellGoblin(g, 2, ShowingVillage), Description = g.name + " the " + g.ClassType }).ToList(); options.Add(No); PlayerChoice.SetupPlayerChoice(options.ToArray(), "Sell a Goblin for 2 goblin treasures?"); }
void SacGoblinBox() { //TODO: maybe shuffle first var options = team.Members.Take(4).Select(g => new PlayerChoice.ChoiceOption() { Action = () => PlayerController.SacGoblin(g, Monument), Description = g.name + " the " + g.ClassType }).ToList(); options.Add(No); PlayerChoice.SetupPlayerChoice(options.ToArray(), "Sacrifice a Goblin to the Big stone?"); }
void SacTreasureBox() { if (team.Treasure >= 3) { var options = new List <PlayerChoice.ChoiceOption> { SacTreasureOption, No }; PlayerChoice.SetupPlayerChoice(options.ToArray(), "Sacrifice 3 goblin treasure to Big Stone?"); } else { PlayerChoice.SetupPlayerChoice(new PlayerChoice.ChoiceOption[] { OkOption }, "You do not have enough goblin treasure to sacrifice."); } }
protected override IEnumerator HandleResult(PlayerChoice choice, int choiceValue) { if (choice == PlayerChoice.Beggar) { if (choiceValue == PlayerChoiceValues.BEGGAR_GIVECOIN) { yield return(this.playerMover.MoveToPosition(this.beggarTransform.position)); yield return(new WaitForSeconds(0.5f)); } this.StartCoroutine(this.MoveToPosAfterTime(0.5f, this.talkToFriendPosition)); } else if (choice == PlayerChoice.Friend) { this.StopAllCoroutines(); this.StartCoroutine(this.MoveToPosAfterTime(1.5f, this.offScreenPosition)); } }
void LureMonsterBox() { if (team.Food >= 1) { var amount = Mathf.Min(team.Food, 3); PlayerChoice.SetupPlayerChoice(new PlayerChoice.ChoiceOption[] { new PlayerChoice.ChoiceOption() { Action = () => Cave.LureMonster(team, amount), Description = "Ok" }, No }, "Put " + amount.ToString("D") + " food out to attract monster?"); } else { PlayerChoice.SetupPlayerChoice(new PlayerChoice.ChoiceOption[] { OkOption }, "You do not have any food put out."); } }
void StealTreasureBox() { if (Monument.Treasure <= 0) { PlayerChoice.SetupPlayerChoice(new PlayerChoice.ChoiceOption[] { OkOption }, "No treasure to steal."); } else { var options = new List <PlayerChoice.ChoiceOption>() { new PlayerChoice.ChoiceOption() { Action = () => PlayerController.StealTreasure(Monument), Description = "Yes" }, No }; PlayerChoice.SetupPlayerChoice(options.ToArray(), "Steal treasure from Big Stone?"); } }
void SacFoodBox() { if (team.Food >= 1) { var amount = Mathf.Min(team.Food, 5); PlayerChoice.SetupPlayerChoice(new PlayerChoice.ChoiceOption[] { new PlayerChoice.ChoiceOption() { Action = () => PlayerController.SacFood(amount), Description = "Ok" }, No }, "Sacrifice " + amount.ToString("D") + " food to Big Stone?"); } else { PlayerChoice.SetupPlayerChoice(new PlayerChoice.ChoiceOption[] { OkOption }, "You do not have any food to sacrifice."); } }
void SendInGoblinBox() { //TODO: maybe shuffle first if (!Cave.Explored) { var options = team.Members.Where(ge => ge.InArea == Cave.InArea).Take(4).Select(g => new PlayerChoice.ChoiceOption() { Action = () => Cave.SendInGoblin(g), Description = g.name + " the " + g.ClassType }).ToList(); options.Add(No); PlayerChoice.SetupPlayerChoice(options.ToArray(), "Send a Goblin in to the Cave?"); } else { PlayerChoice.SetupPlayerChoice(new PlayerChoice.ChoiceOption[] { OkOption }, "You have already explored the cave."); } }
public IPlayerContext GetPlayerContext(PlayerChoice player) { lock (SyncObj) { int slotIndex = PlayerManagerConsts.PRIMARY_SLOT; switch (player) { case PlayerChoice.PrimaryPlayer: slotIndex = PlayerManagerConsts.PRIMARY_SLOT; break; case PlayerChoice.SecondaryPlayer: slotIndex = PlayerManagerConsts.SECONDARY_SLOT; break; case PlayerChoice.CurrentPlayer: slotIndex = _currentPlayerIndex; break; case PlayerChoice.NotCurrentPlayer: slotIndex = 1 - _currentPlayerIndex; break; } return GetPlayerContextInternal(slotIndex); } }
public static Result Match(PlayerChoice player1, PlayerChoice player2) { return (Result)((player1 - player2 + 3) % 3); }
/// <summary> /// Handles the Click event of the addHumanButton control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="RoutedEventArgs" /> instance containing the event data.</param> private void addHumanButton_Click(object sender, RoutedEventArgs e) { playerChoice = PlayerChoice.Human; DialogResult = true; }
public void Initialize(MediaWorkflowStateType stateType, IPlayer player) { _playerContext = stateType == MediaWorkflowStateType.CurrentlyPlaying ? PlayerChoice.CurrentPlayer : PlayerChoice.PrimaryPlayer; _mediaWorkflowStateType = stateType; _player = player as IImagePlayer; }
private void changeCursor(PlayerChoice newPlayer) { if (this.cursor == newPlayer) return; this.cursor = newPlayer; foreach (Transform child in this._menuInstantiated.transform) { switch (child.name) { case "Equipment Panel": foreach(Transform lChild in child) { Text txt = null; switch (lChild.name) { case "Name": txt = lChild.GetComponent<Text>(); txt.text = this.cursor.Player.Name; break; case "Job Name": txt = lChild.GetComponent<Text>(); txt.text = this.cursor.Player.Job; break; default: break; } } break; case "Stats Panel": foreach (Transform lChild in child) { Text txt = null; Slider bar = null; switch (lChild.name) { case "HP": bar = lChild.GetComponent<Slider>(); bar.maxValue = this.cursor.Player.MaxHp; bar.value = this.cursor.Player.Hp; foreach (Transform obj in lChild) { if (obj.name == "HP Value") { txt = obj.GetComponent<Text>(); txt.text = this.cursor.Player.Hp.ToString() + "/" + this.cursor.Player.MaxHp.ToString(); } } break; case "Mana": bar = lChild.GetComponent<Slider>(); bar.maxValue = this.cursor.Player.MaxMp; bar.value = this.cursor.Player.Mp; foreach (Transform obj in lChild) { if (obj.name == "Mana Value") { txt = obj.GetComponent<Text>(); txt.text = this.cursor.Player.Mp.ToString() + "/" + this.cursor.Player.MaxMp.ToString(); } } break; case "Exp": bar = lChild.GetComponent<Slider>(); bar.maxValue = this.cursor.Player.MaxExp; bar.value = this.cursor.Player.Exp; foreach (Transform obj in lChild) { if (obj.name == "Exp Value") { txt = obj.GetComponent<Text>(); txt.text = this.cursor.Player.Exp.ToString() + "/" + this.cursor.Player.MaxExp.ToString(); } } break; case "Strength": txt = lChild.GetComponent<Text>(); txt.text = "Force : " + this.cursor.Player.Strenght.ToString(); break; case "Defense": txt = lChild.GetComponent<Text>(); txt.text = "Armure : " + this.cursor.Player.Defense.ToString(); break; case "Resistance": txt = lChild.GetComponent<Text>(); txt.text = "Resistance : " + this.cursor.Player.Resistance.ToString(); break; case "Stamina": txt = lChild.GetComponent<Text>(); txt.text = "Stamina : " + this.cursor.Player.Stamina.ToString(); break; case "Speed": txt = lChild.GetComponent<Text>(); txt.text = "Vitesse : " + this.cursor.Player.Speed.ToString(); break; case "Intelligence": txt = lChild.GetComponent<Text>(); txt.text = "Intelligence : " + this.cursor.Player.Intel.ToString(); break; case "Agility": txt = lChild.GetComponent<Text>(); txt.text = "Agilite : " + this.cursor.Player.Agility.ToString(); break; case "Precision": txt = lChild.GetComponent<Text>(); txt.text = "Precision : " + this.cursor.Player.Precision.ToString(); break; case "Luck": txt = lChild.GetComponent<Text>(); txt.text = "Chance : " + this.cursor.Player.Luck.ToString(); break; case "MagicResistance": txt = lChild.GetComponent<Text>(); txt.text = "Def magic : " + this.cursor.Player.MagicResistance.ToString(); break; default: break; } } break; default: break; } } }
public void Initialize(MediaWorkflowStateType stateType, IPlayer player) { _playerContext = stateType == MediaWorkflowStateType.CurrentlyPlaying ? PlayerChoice.CurrentPlayer : PlayerChoice.PrimaryPlayer; _mediaWorkflowStateType = stateType; _player = player as IImagePlayer; _imageWidthProperty = new WProperty(typeof(int), null); _imageHeightProperty = new WProperty(typeof(int), null); _cameraMakeProperty = new WProperty(typeof(string), string.Empty); _cameraModelProperty = new WProperty(typeof(string), string.Empty); _imageExposureBiasProperty = new WProperty(typeof(double), null); _imageExposureTimeProperty = new WProperty(typeof(string), string.Empty); _imageFlashModeProperty = new WProperty(typeof(string), string.Empty); _imageFNumberProperty = new WProperty(typeof(string), string.Empty); _imageDimensionsProperty = new WProperty(typeof(string), string.Empty); _imageISOSpeedProperty = new WProperty(typeof(string), string.Empty); _imageMeteringModeProperty = new WProperty(typeof(string), string.Empty); _imageCountryProperty = new WProperty(typeof(string), string.Empty); _imageStateProperty = new WProperty(typeof(string), string.Empty); _imageCityProperty = new WProperty(typeof(string), string.Empty); }
// Use this for initialization void Start() { S = this; }