public void StatCheck(string stat) { string value = stat.Substring(3, 1); int toCheck = Convert.ToInt32(value); int charStat = 0; switch (stat.Substring(0, 3)) { case "STR": charStat = mainCharacter.STR; break; case "INT": charStat = mainCharacter.INT; break; case "CHA": charStat = mainCharacter.CHA; break; default: Debug.LogError("Stat checking string pass didn't work"); break; } if (charStat >= toCheck) { Debug.Log("parsed int" + toCheck); variableMemory.SetValue("$passedCheck", true); } else { variableMemory.SetValue("$passedCheck", false); } }
public void ChooseBattler(OCStats stats) { if (chooseBattler) { currentBattler = stats; previousAttack = currentBattler.MainStat(); variableStorage.SetValue("$playerName", currentBattler.characterName); clickManager.canBePaused = true; clickManager.Progress(); Debug.Log("Player set to " + currentBattler.characterName); } }
void Update() { if (inRange && Input.GetKeyDown("e")) { audio.clip = Resources.Load <AudioClip>("SFX/wyjebka"); audio.Play(); doors.UnlockDoors(); npcMemory.SetValue("$wheelchairGleba", 1); npcMemory.SetValue("$alarm", 1); GetComponentInParent <NPC>().TakeDamage(1); NPC.moveSpeed = 4f; guard.mass = 0.5f; } }
void HandleInput() { if (IsBusy()) { return; } //shooting if (Input.GetButtonDown("Fire1") && inventory.items.Count - 1 >= inventory.activeItem && inventory.items[inventory.activeItem].itemType == ItemType.Gun && inventory.items[inventory.activeItem].currentAmmo > 0) { playerShooting.Shoot(); npcMemory.SetValue("$alarm", 1); } //change eq scrollValue = Input.GetAxis("Mouse ScrollWheel"); //drop if (Input.GetKeyDown("g") && inventory.items.Count - 1 >= inventory.activeItem) { Debug.Log("DROP: " + inventory.items[inventory.activeItem]); DropItem(inventory.items[inventory.activeItem]); } if (Input.GetKeyDown(KeyCode.Space)) { if (rewind.rewindsRemaining > 0) { rewind.rewindsRemaining -= 1; rewind.IsRewinding = true; } } }
IEnumerator Steal() { GameObject chleb = (GameObject)Instantiate(itemToSteal.gameObject, otherObject.transform.position, Quaternion.identity); chleb.GetComponent <SpriteRenderer>().enabled = false; chleb.transform.parent = Ground.transform; chleb.GetComponent <Item>().shot = false; if (isVital) { inMemoryVariableStorage.SetValue("$" + globalVariable, 1); } itemStolen = true; audio.clip = Resources.Load <AudioClip>("SFX/GunPickup"); audio.Play(); while (audio.isPlaying) { yield return(null); } if (!otherObject.GetComponent <Inventory>().Add(chleb.GetComponent <Item>())) { itemStolen = false; } else { chleb.SetActive(false); chleb.GetComponent <SpriteRenderer>().enabled = true; } }
public void SetValue_TryGetValue() { // set, then get, then test equality VarStorage.SetValue("$stringVar", stringTest); VarStorage.TryGetValue <string>("$stringVar", out var actualStringResult); Assert.AreEqual(stringTest, actualStringResult); VarStorage.SetValue("$boolVar", boolTest); VarStorage.TryGetValue <bool>("$boolVar", out var actualBoolResult); Assert.AreEqual(boolTest, actualBoolResult); VarStorage.SetValue("$floatVar", floatTest); VarStorage.TryGetValue <float>("$floatVar", out var actualFloatResult); Assert.AreEqual(floatTest, actualFloatResult); VarStorage.SetValue("$totallyNewUndeclaredVar", stringTest); VarStorage.TryGetValue <string>("$totallyNewUndeclaredVar", out var actualUndeclaredResult); Assert.AreEqual(stringTest, actualUndeclaredResult); }
void Update() { if (inRange && Input.GetKeyDown("e") && !changed) { npcMemory.SetValue("$isInUniform", 1); Debug.Log("SetAnimator(police)"); player.GetComponentInChildren <PlayerAnimation>().SetAnimator("police"); changed = true; //player.ChangeUniform("policjant"); Destroy(gameObject, 3f); Destroy(OpenExitObject); } }
private void FishReelEnded(bool success, CollectibleItem.ItemID id, Fish fish) { if (m_currState != FishingState.Reeling) { Debug.LogError("Received fish reel ended event while in state (" + m_currState + ")"); } if (success) { m_currFishingSign.FishingArea.RemoveFish(fish); m_eventManager.TriggerItemEvent(id, 1); m_caughFish.Add(id); Debug.Log("caught " + m_caughFish.Count + " different fishes"); m_variableStorage.SetValue("$fishSpeciesCaught", m_caughFish.Count); Debug.Log(m_variableStorage); } m_fishingReticle.SetAnimTriggReelEnd(); m_fishingRod.SetAnimTriggReelEnd(); m_uiManager.ToggleInstructions("Aiming"); ChangeState(FishingState.Aiming); }
public void AddToInventory(GameObject item) { UI_Inventory ui_inv = new UI_Inventory(); ui_inv.name = item.name; ui_inv.inv_icon = item.GetComponent <Image>(); inventory_dict.Add(ui_inv.name, ui_inv); yarn_variables.SetValue(item.GetComponent <PickUp>().yarn_var, true); //GameObject g = new GameObject(); //g.AddComponent(typeof(Image)); //g.name = ui_inv.name; //g.GetComponent<Image>().sprite = ui_inv.inv_icon.sprite; //GameObject b = Instantiate(g); //b.transform.parent = inv_ui.transform; //b.GetComponent<Image>().color = ui_inv.inv_icon.color; // b.GetComponent<RectTransform>().localScale = new Vector3(1, 1, 0); }
public void setForgiveness(float value) { _memStorage.SetValue("$forgiveness", value); saveForgiveness(); Debug.Log("Forgiveness set to " + value); }
private void SetCity(Settlement s) { city = s; Debug.Log("Current settlement: " + city.name); storage.SetValue("$city_name", new Yarn.Value(city.name)); storage.SetValue("$city_description", new Yarn.Value(city.description)); }
public void SetValue(string variableName, Yarn.Value value) { yarnVars.SetValue(variableName, value); }
IEnumerator dothething() { yield return(new WaitForSeconds(0.1f)); varstorage.SetValue("$Player", username); }