public static string GetStatValueString(CharacterInfoScript charInfo, CharacterStatistic stat) { string result = ""; try { float value = GetStatValue(charInfo, stat); switch (stat) { case CharacterStatistic.BaseDamage: result = (value - 1).ToString("n0") + " - " + (value + 1).ToString("n0"); break; case CharacterStatistic.WalkingSpeed: result = (value / 1000).ToString("n1"); break; default: result = value.ToString("n0"); break; } } catch (NotImplementedException e) { switch (stat) { case CharacterStatistic.HealRatesCombined: return(VitalityHealRate(charInfo).ToString("n1") + "/" + SanityHealRate(charInfo).ToString("n1")); } } return(result); }
public void SetCharacter(CharacterInfoScript character) { if (character == null) { SetDefault(); return; } ToggleVisible(true); ToggleDead(false); assignedCharDetails = character; previousHealthChange = assignedCharDetails.HealthPerc / 100f; if (shieldBar != null) { shieldBar.color = shieldColors.Evaluate(assignedCharDetails.ShieldPerc / 100f); } characterName.text = assignedCharDetails.Name; if (assignedCharDetails.CharacterIcons.Length > 0) { characterIconIdle.sprite = assignedCharDetails.CharacterIcons[0]; if (assignedCharDetails.CharacterIcons.Length > 1) { characterIconSelected.sprite = assignedCharDetails.CharacterIcons[1]; } } UpdateVitalities(); }
public static float GetStatValue(CharacterInfoScript charInfo, CharacterStatistic stat) { switch (stat) { case CharacterStatistic.BaseDamage: return(BaseDamage(charInfo)); case CharacterStatistic.HealRateSanity: return(SanityHealRate(charInfo)); case CharacterStatistic.HealRateVitality: return(VitalityHealRate(charInfo)); case CharacterStatistic.Sanity: return(MaxSanity(charInfo)); case CharacterStatistic.Vitality: return(MaxHealthPoints(charInfo)); case CharacterStatistic.WalkingSpeed: return(WalkSpeedPerHour(charInfo)); } throw new NotImplementedException(); }
public static bool TestRNG(CharacterInfoScript charInfo, CharacterAttribute statToTest, int modificator, CharacterSkills skill) { int diceResult = UnityEngine.Random.Range(1, 100); bool result = false; bool crit = false; if (diceResult <= 5) { result = true; crit = true; } if (diceResult >= 95) { result = false; crit = true; } if (!crit) { int baseToPass = 5 * (charInfo.GetStat(statToTest) + modificator); int stressPenalty = charInfo.StressPenalty; int skillBonus = (charInfo.HasSkill(skill)) ? 20 : 0; result = diceResult <= (baseToPass + skillBonus - stressPenalty); } Debug.Log("Rand Value: " + diceResult + ", result: " + result); return(result); }
public void DisplayInfoOnCard() { if (IAmChar == "Play1") { CharacterInfoScript = GM.current.PlayerChar1; } if (IAmChar == "Play2") { CharacterInfoScript = GM.current.PlayerChar2; } if (IAmChar == "Play3") { CharacterInfoScript = GM.current.PlayerChar3; } if (IAmChar == "Enem1") { CharacterInfoScript = GM.current.EnemyChar1; } if (IAmChar == "Enem2") { CharacterInfoScript = GM.current.EnemyChar2; } if (IAmChar == "Enem3") { CharacterInfoScript = GM.current.EnemyChar3; } NameDisplay.text = CharacterInfoScript.name; MaxHealthDisplay.text = CharacterInfoScript.maxHealth.ToString(); FavFoodDisplay.sprite = CharacterInfoScript.FavFood.IngredientImage; DislikeFoodDisplay.sprite = CharacterInfoScript.DislikeFood.IngredientImage; IntolDisplay.sprite = CharacterInfoScript.Intolerance.IngredientImage; }
public static int HealRate(CharacterInfoScript charInfo) { int result = 5 * charInfo.Physique + 2 * charInfo.Character; return(1 + Mathf.RoundToInt(result / 30.0f)); }
void Awake() { OcclusionImage = gameObject.GetComponent <Image>(); PlayerInfo = GameObject.Find("Game Info Component").GetComponent <CharacterInfoScript>(); PlayerInfo.RegisterToHealthChanged(UpdateByHealth); UpdateByHealth(PlayerInfo.HealthPercentage); }
void Awake() { CharInfo = GameObject.Find("Game Info Component").GetComponent <CharacterInfoScript>(); CharInfo.RegisterToHealthChanged(UpdateHealthText); CharInfo.RegisterToHealthChanged(UpdateStressText); CharInfo.RegisterToSanityChanged(UpdateStressText); UpdateTexts(); }
public override bool ConditionTest() { CharacterInfoScript characterInfo = GameObject.Find("Game Info Component").GetComponent <CharacterInfoScript>(); bool result = StatsRuleSet.TestRNG(characterInfo, Attribute, AttributeMod, Skill); return (result); }
public static int MaxStressPenalty(CharacterInfoScript charInfo) { int CHMod = 5; int WTMod = 3; return (10 + Mathf.RoundToInt( (20 - (CHMod * charInfo.Character + WTMod * charInfo.Wits) / ((float)CHMod + WTMod)) * 15 / 19.0f)); }
public static int WalkSpeedPerHour(CharacterInfoScript charInfo) { int AGMod = 4; int PHMod = 1; float walkingAttributeValue = ((float)AGMod * (charInfo.Agility - 1) + PHMod * (charInfo.Physique - 1)) / (AGMod + PHMod); float value = WalkingSpeedMin + (WalkingSpeedMax - WalkingSpeedMin) * walkingAttributeValue / 19; return(Mathf.RoundToInt(value)); }
public static int BaseDamage(CharacterInfoScript charInfo) { int Mod1 = 5; int Mod2 = 3; float Mod3 = 1f; int result = Mod1 * charInfo.Physique + Mod2 * charInfo.Agility; return(Mathf.RoundToInt(Mod3 * result / (Mod1 + Mod2))); }
public static int MaxSanity(CharacterInfoScript charInfo) { int modCh = 2; int modWt = 5; float Mod3 = 10f; int result = modCh * charInfo.Character + modWt * charInfo.Wits; return(Mathf.RoundToInt(Mod3 * result / (modCh + modWt))); }
public static int MaxHealthPoints(CharacterInfoScript charInfo) { int Mod1 = 5; int Mod2 = 2; float Mod3 = 10f; int result = Mod1 * charInfo.Physique + Mod2 * charInfo.Character; return(Mathf.RoundToInt(Mod3 * result / (Mod1 + Mod2))); }
void Awake() { DialogueLog = new List <GameObject>(); PlayerInfo = GameObject.Find("Game Info Component").GetComponent <CharacterInfoScript>(); Dialogue.RegisterToOnDialogueEnded(onDialogueEnded); if (DialogueShown != null) { StartCoroutine(StartDialogue()); } }
private IEnumerator WaitForFadeOutEnd() { while (scr.FadeInProgress) { yield return(new WaitForEndOfFrame()); } CharacterInfoScript temp = gameObject.AddComponent <CharacterInfoScript>(); temp.SetPlayerInfo(PlayerInfo); SceneManager.LoadSceneAsync("Loading Screen"); }
void Start() { MapDisplay = GetComponent <RectTransform>(); TimeManager = GameObject.Find("Time Manager").GetComponent <TimeManagerScript>(); Edges = new Dictionary <Vector2, List <Edge> >(); Edge[] edges = EdgesSource.GetComponentsInChildren <Edge>(); foreach (Edge e in edges) { if (!Edges.ContainsKey(e.A)) { e.SetMap(this); Edges.Add(e.A, new List <Edge>()); } if (!Edges.ContainsKey(e.B)) { e.SetMap(this); Edges.Add(e.B, new List <Edge>()); } Edges[e.A].Add(e); Edges[e.B].Add(e); /* * int totalEdges = 0; * * foreach(KeyValuePair<Vector2, List<Edge>> pair in Edges) * { * totalEdges += pair.Value.Count; * } * * Debug.Log("Dodaje do mapy krawędź: " + e.transform.name + " From: " + e.From + " To: " + e.To + ", Vertex Count: " + Edges.Count + " Edge Count: " + totalEdges); */ } Pathfinder = GetComponent <AStarPathfindingScript>(); Pathfinder.SetEdges(Edges); if (Pathfinder.LastPlayerWaypoint != null) { Entered(Pathfinder.LastPlayerWaypoint); Pathfinder.PlayerWorldPosition = Pathfinder.LastPlayerWaypoint.WorldCoords; } PlayerStats = GameObject.Find("Game Info Component").GetComponent <CharacterInfoScript>(); }
public static int StressPenalty(CharacterInfoScript charInfo) { float currentStress = 100 * Stress(charInfo); int result = 0; for (int i = 0; i < StressThresholds.Length; i++) { if (StressThresholds[i] > currentStress) { result = StressPenalties[i]; break; } } return(result); }
private IEnumerator SetCharacterInfoScript() { GameObject gic; while ((gic = GameObject.Find("Game Info Component")) == null) { yield return(new WaitForSeconds(0.5f)); } while (gic.GetComponent <CharacterInfoScript>() == null) { yield return(new WaitForSeconds(0.5f)); } playerInfo = gic.GetComponent <CharacterInfoScript>(); }
void Awake() { CharacterInfoScript player = GameObject.Find("Game Info Component"). GetComponent <CharacterInfoScript>(); Image portrait = gameObject.GetComponent <Image>(); portrait.sprite = player.CharacterPortrait; Transform temp = transform.Find("Damage Occlusion"); if (temp != null) { Image portraitOcclusion = temp.GetComponent <Image>(); portraitOcclusion.sprite = player.CharacterPortrait; } }
public void AssignCharacters(string IAmChar) { //player characters if (IAmChar == "Play1") { int whichChar = Random.Range(0, CharacterDeckScript.current.allCharacters.Count); PlayerChar1 = CharacterDeckScript.current.allCharacters[whichChar]; CharacterDeckScript.current.allCharacters.Remove(CharacterDeckScript.current.allCharacters[whichChar]); } else if (IAmChar == "Play2") { int whichChar = Random.Range(0, CharacterDeckScript.current.allCharacters.Count); PlayerChar2 = CharacterDeckScript.current.allCharacters[whichChar]; CharacterDeckScript.current.allCharacters.Remove(CharacterDeckScript.current.allCharacters[whichChar]); } else if (IAmChar == "Play3") { int whichChar = Random.Range(0, CharacterDeckScript.current.allCharacters.Count); PlayerChar3 = CharacterDeckScript.current.allCharacters[whichChar]; CharacterDeckScript.current.allCharacters.Remove(CharacterDeckScript.current.allCharacters[whichChar]); } //enemy characters else if (IAmChar == "Enem1") { int whichChar = Random.Range(0, CharacterDeckScript.current.allCharacters.Count); EnemyChar1 = CharacterDeckScript.current.allCharacters[whichChar]; CharacterDeckScript.current.allCharacters.Remove(CharacterDeckScript.current.allCharacters[whichChar]); } else if (IAmChar == "Enem2") { int whichChar = Random.Range(0, CharacterDeckScript.current.allCharacters.Count); EnemyChar2 = CharacterDeckScript.current.allCharacters[whichChar]; CharacterDeckScript.current.allCharacters.Remove(CharacterDeckScript.current.allCharacters[whichChar]); } else if (IAmChar == "Enem3") { int whichChar = Random.Range(0, CharacterDeckScript.current.allCharacters.Count); EnemyChar3 = CharacterDeckScript.current.allCharacters[whichChar]; CharacterDeckScript.current.allCharacters.Remove(CharacterDeckScript.current.allCharacters[whichChar]); } }
public IEnumerator OnBattleFieldAttackCo(CharacterInfoScript cInfo, ScriptableObjectAttackBase atk, Vector2Int basePos) { foreach (BulletBehaviourInfoClassOnBattleFieldClass item in atk.TilesAtk.BulletTrajectories) { float timer = 0; foreach (BattleFieldAttackTileClass target in item.BulletEffectTiles) { if (isPosOnField(target.Pos)) { GameObject go; go = Instantiate(TargetIndicator, GetBattleTile(target.Pos).transform.position, Quaternion.identity); go.GetComponent <BattleTileTargetScript>().StartTarget(item.Delay, target.Pos, cInfo.DamageStats.BaseDamage, cInfo.Elemental); } } while (timer <= item.Delay) { yield return(BattleManagerScript.Instance.PauseUntil()); timer += Time.fixedDeltaTime; } } }
void Awake() { CharInfo = GameObject.Find("Game Info Component").GetComponent <CharacterInfoScript>(); OnValidate(); }
void InstantiateCharacterInfo() { characterInfo = CharacterDeckScript.current.playerDeck[gm.characterInstantiated]; gm.characterInstantiated++; }
private static float StressM2(CharacterInfoScript charInfo) { return (1 - (charInfo.HealthPercentage + charInfo.SanityPercentage) / 2); }
private static float StressM1(CharacterInfoScript charInfo) { return (1 - ((float)(charInfo.CurrentHealth + charInfo.CurrentSanity)) / (charInfo.MaxHealthPoints + charInfo.MaxSanity)); }
public static float Stress(CharacterInfoScript charInfo) { return(StressM2(charInfo)); }
public void UpdateVitalitiesOfCharacter(CharacterInfoScript character, SideType side) { GetvitalityBoxOfCharacter(character.CharacterID, side).UpdateVitalities(); }
public static float VitalityHealRate(CharacterInfoScript charInfo) { return(healPercentPerHour * MaxHealthPoints(charInfo)); }
public static float SanityHealRate(CharacterInfoScript charInfo) { return(healPercentPerHour * MaxSanity(charInfo)); }