/// <summary> /// Constructor for a stat based condition /// </summary> /// <param name="stat"></param> /// <param name="evaluation"></param> /// <param name="rule"></param> public StatCondition(ActorStats stat, Evaluation evaluation, int value, bool isPercetage) { Stat = stat; Evaluator = evaluation; ComparisonValue = value; Percetage = isPercetage; }
public void SetActorStats(ActorStats _stats) { actorStats = _stats; LoadHealthBarText(); LoadEnergyBarText(); }
public void Configure(ActorStats _stats) { actorStats = _stats; LoadHealthBarText(); LoadEnergyBarText(); }
public StatModifier(ActorStats stat, int modifier, bool isPercentage, bool isBuff) { Stat = stat; Modifier = modifier; Percentage = isPercentage; Buff = isBuff; }
public void initActorFromType(ActorStats stats, int ix) { if (_actorTypes != null && ix < _actorTypes.Length) { initActor(stats, _actorTypes[ix]); } }
private ActionManager.AttackResult ResolveAttack(ActorStats attackerStats, ActorStats victimStats) { var infectionChance = UnityEngine.Random.Range(0.0f, 100.0f); var cloningChance = UnityEngine.Random.Range(0.0f, 100.0f); var infectedVictim = (infectionChance <= attackerStats.InfectionChance); victimStats.Health -= attackerStats.Damage; if (victimStats.Health <= 0.0f) { if (infectedVictim) { //If infecting on the last hit instead, give the health back victimStats.Health += attackerStats.Damage; } //Infected attackers have the chance to clone the victim on death if (attackerStats.Infected) { if (cloningChance <= attackerStats.CloningChance) { GameObject.FindObjectOfType <FriendlyNPCManager>().SpawnSingleFriendly(victimStats.gameObject.transform.position); SpawnStatusChange("+1", victimStats.gameObject.transform.position); } } return(infectedVictim ? ActionManager.AttackResult.VictimInfected : ActionManager.AttackResult.VictimDeath); } return(ActionManager.AttackResult.VictimOkay); //return infectedVictim ? ActionManager.AttackResult.VictimInfected : ActionManager.AttackResult.VictimOkay; }
private void initActor(ActorStats stats, Actor actor) { stats.Health = actor.health; stats.Damage = actor.damage; stats.MovementSpeed = actor.movementSpeed; stats.AttackSpeed = actor.attackSpeed; stats.AttackRange = actor.attackRange; }
public void Set(ActorDef a_def, int a_level, bool a_resetHitPoints = true) { m_actorDef = a_def; m_stats = m_actorDef.GetStatsForLevel(a_level); if (a_resetHitPoints) { m_hitPoints = HitPointsMax; } }
public ActorStats Attack(int toAttackBy, ActorStats targetStats, GameObject attackIcon, Vector3 posToSpawn) { var attackIconComp = gameObject.AddComponent <AttackIcon>(); attackIconComp.attackIconPrefab = attackIcon; var tempIcon = attackIconComp.Spawn(posToSpawn, toAttackBy); return(Attack(toAttackBy, targetStats)); }
public void initActorFromType(ActorStats stats, FlowManager.EnemyType enemyType) { int ix = (int)enemyType; if (_actorTypes != null && ix < _actorTypes.Length) { initActor(stats, _actorTypes[ix]); } }
private void OnTriggerStay(Collider collision) { ActorStats stats = collision.gameObject.GetComponent <ActorStats>(); if (stats != null) { stats.TakeDamage(damage); } }
private void Awake() { playerStats = GameObject.FindGameObjectWithTag("Player").GetComponent <ActorStats>(); if (playerStats == null) { Debug.LogError("HealthBarController could not find actor stats of player."); } maxHealth = playerStats.MaxHealth; }
public void ApplyStatChange(ActorStats stat, int modifier) { switch (stat) { case ActorStats.MaxHealthPoints: MaxHealthPoints += modifier; break; case ActorStats.HealthPoints: HealthPoints += modifier; break; case ActorStats.MaxManaPoints: MaxManaPoints += modifier; break; case ActorStats.ManaPoints: ManaPoints += modifier; break; case ActorStats.Strength: Strength += modifier; break; case ActorStats.Dexterity: Dexterity += modifier; break; case ActorStats.Agility: Agility += modifier; break; case ActorStats.Defense: Defense += modifier; break; case ActorStats.MagicPower: MagicPower += modifier; break; case ActorStats.MagicDefense: MagicDefense += modifier; break; case ActorStats.ActorLevel: ActorLevel += modifier; break; case ActorStats.ExperiencePoints: ExperiencePoints += modifier; break; default: break; } }
public ActorStats Heal(int toHealBy, ActorStats targetStats) { targetStats.currentHP = targetStats.currentHP + toHealBy; if (targetStats.currentHP > targetStats.maxHP) { targetStats.currentHP = targetStats.maxHP; } return(targetStats); }
private void OnTriggerEnter(Collider other) { ActorStats stats = other.gameObject.GetComponent <ActorStats>(); if (stats != null && stats.IsPlayer) { AudioManager.Instance.PlaySoundEffect(SoundEffect.Pickup); StartCoroutine(DoubleScoreEffect()); } }
private void Awake() { input = GetComponent <FPSInput>(); motor = GetComponent <FPSMotor>(); stats = GetComponent <ActorStats>(); fire = GetComponent <FireWeapon>(); currentMoveSpeed = moveSpeed; currentTurnSpeed = turnSpeed; }
public int GetStatValue(ActorStats stat) { int output = 0; switch (stat) { case ActorStats.MaxHealthPoints: output = MaxHealthPoints; break; case ActorStats.HealthPoints: output = HealthPoints; break; case ActorStats.MaxManaPoints: output = MaxManaPoints; break; case ActorStats.ManaPoints: output = ManaPoints; break; case ActorStats.Strength: output = Strength; break; case ActorStats.Dexterity: output = Dexterity; break; case ActorStats.Defense: output = Defense; break; case ActorStats.MagicPower: output = MagicPower; break; case ActorStats.MagicDefense: output = MagicDefense; break; case ActorStats.ActorLevel: output = ActorLevel; break; case ActorStats.ExperiencePoints: output = ExperiencePoints; break; default: break; } return(output); }
public void Start() { player1Stats = GameObject.FindGameObjectWithTag("Santa").GetComponent<ActorStats>(); player2Stats = GameObject.FindGameObjectWithTag("Turkey").GetComponent<ActorStats>(); priorHP1 = player1Stats.CurrentHealth; priorHP2 = player2Stats.CurrentHealth; timerText = GameObject.FindGameObjectWithTag("TimerText").GetComponent<Text>(); announcerText = GameObject.FindGameObjectWithTag("AnnouncerText").GetComponent<Text>(); }
public ActorStats(ActorStats a_other) { attack = a_other.attack; hitPointsMax = a_other.hitPointsMax; speed = a_other.speed; foreach (var spell in a_other.spellList) { spellList.Add(spell); } }
public ActorStats GetStatsForLevel(int a_level) { var stats = new ActorStats { attack = GetAttackForLevel(a_level), hitPointsMax = GetHitPointsForLevel(a_level), speed = GetSpeedForLevel(a_level) }; stats.level = a_level; return(stats); }
public void Start() { timer = START_TIMER_VAL; // initialize timer value timerText = gameObject.GetComponentsInChildren<Text>()[1]; // initialize timer's text (NOTE: value may change based on ordering in gameobject) mainDisplayText = gameObject.GetComponentsInChildren<Text>()[0]; // see line above player1 = GameObject.FindGameObjectWithTag("Santa"); player2 = GameObject.FindGameObjectWithTag("Turkey"); player1Stats = player1.GetComponent<ActorStats>(); player2Stats = player2.GetComponent<ActorStats>(); }
void Start() { _moverRef = GetComponent <ActorMovement>(); Debug.Assert(_moverRef != null, "Didn't manage to find a ActorMovement."); _statsRef = GetComponent <ActorStats>(); Debug.Assert(_statsRef != null, "Didn't manage to find a ActorStats."); _animatorRef = GetComponent <Animator>(); Debug.Assert(_animatorRef != null, "Didn't manage to find a Animator."); _animatorRef.SetFloat("AttackSpeedMultiplier", _statsRef.AttackSpeed * 2.0f); }
void Start() { _moverRef = GetComponent <ActorMovement>(); Debug.Assert(_moverRef != null, "Didn't manage to find a ActorMovement."); _actionRef = GetComponent <ActionManager>(); Debug.Assert(_moverRef != null, "Didn't manage to find a ActionManager."); _pathfinder = GameObject.FindObjectOfType <PathfinderManager>(); Debug.Assert(_pathfinder != null, "Didn't manage to find a PathfinderManager."); _statsRef = GetComponent <ActorStats>(); Debug.Assert(_statsRef != null, "Didn't manage to find a ActorStats."); }
void Awake() { actions = new InputActions(); bus = GetComponent <InputBus>(); currentStats = (ActorStats)baseStats.Clone(); actions.stats = currentStats; lastHealth = currentStats.health; SubscribeToEvents(); InitializeOnAwake(); }
public ActorStats Attack(int toAttackBy, ActorStats targetStats) { int attackByWithDefense = toAttackBy - targetStats.baseDefense; if (attackByWithDefense < 0) { attackByWithDefense = 0; } targetStats.currentHP = targetStats.currentHP - attackByWithDefense; if (targetStats.currentHP < 0) { targetStats.currentHP = 0; } return(targetStats); }
private void OnTriggerEnter(Collider other) { ActorStats stats = other.gameObject.GetComponent <ActorStats>(); if (stats != null) { if (stats.Health == stats.MaxHealth) { return; } stats.TakeDamage(-healthToHeal); AudioManager.Instance.PlaySoundEffect(SoundEffect.Pickup); Destroy(gameObject); } }
public void RemoveActorAura(ActorStats _actorStats) { actorStats = _actorStats; AuraStat stat = Aura.AuraStat; int val = Aura.AuraValue; if (stat == AuraStat.Skill) { actorStats.ModSkill(Aura.AuraSkill, -val); } else { actorStats.ModStat(stat.ToString(), -val); } Debug.Log("Removing aura " + Aura.AuraName + " to " + actorStats.gameObject.name); }
// Use this for initialization void Start() { gameTimer = START_TIMER_VAL; countdownTimer = COUNTDOWN_TIMER_VAL; currentState = nextState = GameState.Countdown; ui = GameObject.FindGameObjectWithTag("GUICanvas").GetComponent<UIScript>(); player1 = GameObject.FindGameObjectWithTag("Santa"); player2 = GameObject.FindGameObjectWithTag("Turkey"); player1Stats = player1.GetComponent<ActorStats>(); player2Stats = player2.GetComponent<ActorStats>(); player1.GetComponent<ActorController>().enabled = false; player2.GetComponent<ActorController>().enabled = false; }
public void AddSentence(Dialogue dialogue, string actorID, string text) { DialogueStats dialogueStats = Dialogues.GetOrAdd(dialogue.GetName(), (key) => new DialogueStats()); ActorStats actorStats = Actors.GetOrAdd(actorID, (key) => new ActorStats()); Packages.Add(dialogue.Package); string[] split = text.Split(DelimiterChars, StringSplitOptions.RemoveEmptyEntries); int words = split.Length; dialogueStats.SentenceWords += words; dialogueStats.Sentences += 1; SentenceWords += words; Sentences += 1; actorStats.Words += words; actorStats.Sentences += 1; }
private string GetStatLine(Stats stat, ActorStats stats) { float baseValue = stats.GetBaseStatValue(stat); float bonusValue = stats.GetStatBonusValue(stat); string name = stat.ToString() + ":"; string value = baseValue.ToString(); if (bonusValue > 0) { value += " (+" + stats.GetStatBonusValue(stat) + ")"; } else if (bonusValue < 0) { value += " (-" + stats.GetStatBonusValue(stat) + ")"; } return(string.Format("{0, -14} {1}", name, value)); }
public void SetActor(Actor actor) { ActorStats stats = actor.GetStats(); this.info.text = actor.GetType().ToString(); System.Text.StringBuilder sb1 = new System.Text.StringBuilder(); sb1.AppendLine(GetStatLine(Stats.Strength, stats)); sb1.AppendLine(GetStatLine(Stats.Dexterity, stats)); sb1.AppendLine(GetStatLine(Stats.Constitution, stats)); this.statsText1.text = sb1.ToString(); System.Text.StringBuilder sb2 = new System.Text.StringBuilder(); sb2.AppendLine(GetStatLine(Stats.Intelligence, stats)); sb2.AppendLine(GetStatLine(Stats.Wisdom, stats)); sb2.AppendLine(GetStatLine(Stats.Charisma, stats)); this.statsText2.text = sb2.ToString(); this.actorInfoPanel.SetActive(true); }
void Start() { _rigidbodyRef = GetComponent <Rigidbody2D>(); Debug.Assert(_rigidbodyRef != null, "Didn't manage to find a rigidbody."); _actionManager = GetComponent <ActionManager>(); Debug.Assert(_actionManager != null, "Didn't manage to find a ActionManager."); _statsRef = GetComponent <ActorStats>(); Debug.Assert(_statsRef != null, "Didn't manage to find a ActorStats."); _aiController = GetComponent <AIController>(); _animatorRef = GetComponent <Animator>(); Debug.Assert(_animatorRef != null, "Didn't manage to find a Animator."); if (_rigidbodyRef) { _rigidbodyRef.freezeRotation = true; _rigidbodyRef.drag = 10.0f; _rigidbodyRef.gravityScale = 0.0f; } }
private void ReadData() { playerData = Resources.Load <DataManager>("Data/PlayerData"); gameObject.name = playerData.entityName; inventories.inventory.itemsData = playerData.entityInventory; inventories.equippedItems.itemsData = playerData.entityEquippedItems; playerStats = playerData.entityStats; PlayerMovement pm = transform.GetComponent <PlayerMovement>(); if (pm.grid.SetupPlayer(playerData.loadingPosition)) { Debug.Log("Found node at valid position"); } else if (pm.grid.SetupPlayer()) { Debug.Log("No node found at valid position. Found node at generic scene starting position"); } else { Debug.Log("No nodes found. Perhaps the archives are incomplete"); } Check(); }