public void ModifyCurrentResource(EntityBeingResourceType resourceType, float amount) { switch (resourceType) { case EntityBeingResourceType.Health: currentHealth += amount; currentHealth = Mathf.Clamp(currentHealth, 0f, MaxHealth); break; case EntityBeingResourceType.Power: currentPower += amount; currentPower = Mathf.Clamp(currentPower, 0f, MaxPower); break; case EntityBeingResourceType.Stamina: currentStamina += amount; currentStamina = Mathf.Clamp(currentStamina, 0f, MaxStamina); break; case EntityBeingResourceType.Mana: currentMana += amount; currentMana = Mathf.Clamp(currentMana, 0f, MaxMana); break; } }
public void SetCurrentResource(EntityBeingResourceType resourceType, float value) { switch (resourceType) { case EntityBeingResourceType.Health: currentHealth = value; currentHealth = Mathf.Clamp(currentHealth, 0f, MaxHealth); break; case EntityBeingResourceType.Power: currentPower = value; currentPower = Mathf.Clamp(currentPower, 0f, MaxPower); break; case EntityBeingResourceType.Stamina: currentStamina = value; currentStamina = Mathf.Clamp(currentStamina, 0f, MaxStamina); break; case EntityBeingResourceType.Mana: currentMana = value; currentMana = Mathf.Clamp(currentMana, 0f, MaxMana); break; } }
public float EvaluateAbilitiesResourcesStat(EntityBeingResourceType resourceType, float resourceChange) { int index = PinouUtils.Maths.Pow2toIndex((int)resourceType); if (index < 0) { return(resourceChange); } else { bool sign = resourceChange < 0; resourceChange *= _abilitiesResourcesStatsFactors[index][0];//0 => Index of EntityAbilityResourceStat.GlobalFactor if (sign == true) { resourceChange *= _abilitiesResourcesStatsFactors[index][1];//1 => Index of EntityAbilityResourceStat.NegativeFactor resourceChange += _abilitiesResourcesStatsFlats[index][1]; } else { resourceChange *= _abilitiesResourcesStatsFactors[index][2];//2 => Index of EntityAbilityResourceStat.PositiveFactor resourceChange += _abilitiesResourcesStatsFlats[index][2]; } resourceChange += _abilitiesResourcesStatsFlats[index][0]; return(resourceChange); } }
public GameObject GetModel(EntityBeingResourceType resource, bool positive) { TextModelEntityResourcesParameters modelByResource = _modelPerResource[PinouUtils.Maths.Pow2toIndex((int)resource)]; return(positive ? (modelByResource.ShouldDisplayPositiveText ? modelByResource.PositiveReceivedTextModel : null) : (modelByResource.ShouldDisplayNegativeText ? modelByResource.NegativeReceivedTextModel : null)); }
private bool ValidateResourceType(EntityBeingResourceType resourceType) { if (PinouUtils.Maths.Pow2toIndex((int)resourceType) == -1) { _resourceType = 0; } return(true); }
public float GetResourceRegen(EntityBeingResourceType resourceType) { switch (resourceType) { default: return(0f); } throw new System.Exception("No " + resourceType + " resource found."); }
public float GetResourceChange(EntityBeingResourceType type) { for (int i = 0; i < _resourcesChanges.Count; i++) { if (_resourcesChanges[i].ResourceType == type) { return(_resourcesChanges[i].ResourceChange); } } return(0f); }
public float GetResourceImpact(EntityBeingResourceType type) { for (int i = 0; i < _baseResourcesImpacts.Length; i++) { if (_baseResourcesImpacts[i].ResourceType == type) { return(_baseResourcesImpacts[i].ResourceChange); } } return(0f); }
public float EvaluateBeingResourceStat(EntityBeingResourceType resource, EntityBeingResourceStat stat, float baseAmount) { int indexOne = PinouUtils.Maths.Pow2toIndex((int)resource); int indexTwo = PinouUtils.Maths.Pow2toIndex((int)stat); if (indexOne < 0 || indexTwo < 0) { return(baseAmount); } else { return((baseAmount * _beingResourcesStatsFactors[indexOne][indexTwo]) + _beingResourcesStatsFlats[indexOne][indexTwo]); } }
public bool GetResourceStartNotAtMax(EntityBeingResourceType resourceType) { switch (resourceType) { case EntityBeingResourceType.Health: return(startNotAtMaxHealth); case EntityBeingResourceType.Power: return(startNotAtMaxPower); case EntityBeingResourceType.Stamina: return(startNotAtMaxStamina); case EntityBeingResourceType.Mana: return(startNotAtMaxMana); } throw new System.Exception("No " + resourceType + " resource found."); }
public float GetResourceReceivedFactor(EntityBeingResourceType resourceType) { switch (resourceType) { case EntityBeingResourceType.Health: return(healthReceiveFactor); case EntityBeingResourceType.Power: return(powerReceiveFactor); case EntityBeingResourceType.Stamina: return(staminaReceiveFactor); case EntityBeingResourceType.Mana: return(manaReceiveFactor); } throw new System.Exception("No " + resourceType + " resource found."); }
public float GetMaxResource(EntityBeingResourceType resourceType) { switch (resourceType) { case EntityBeingResourceType.Health: return(maxHealth); case EntityBeingResourceType.Power: return(maxPower); case EntityBeingResourceType.Stamina: return(maxStamina); case EntityBeingResourceType.Mana: return(maxMana); } throw new System.Exception("No " + resourceType + " resource found."); }
public float GetResourceProgress(EntityBeingResourceType resourceType) { switch (resourceType) { case EntityBeingResourceType.Health: return(HealthProgress); case EntityBeingResourceType.Power: return(PowerProgress); case EntityBeingResourceType.Stamina: return(StaminaProgress); case EntityBeingResourceType.Mana: return(ManaProgress); } throw new System.Exception("No " + resourceType + " resource found."); }
public float GetResourceStartAmount(EntityBeingResourceType resourceType) { switch (resourceType) { case EntityBeingResourceType.Health: return(startHealth); case EntityBeingResourceType.Power: return(startPower); case EntityBeingResourceType.Stamina: return(startStamina); case EntityBeingResourceType.Mana: return(startMana); } throw new System.Exception("No " + resourceType + " resource found."); }
public void FillResourceChange(EntityBeingResourceType resource, float change) { AbilityResourceImpactData data = null; for (int i = 0; i < _resourcesChanges.Count; i++) { if (_resourcesChanges[i].ResourceType == resource) { data = _resourcesChanges[i]; } } if (data == null) { _resourcesChanges.Add(new AbilityResourceImpactData(resource, change)); } else { data.SetResourceChange(change); } _resourceChangesFilled = true; }
public TextModelEntityResourcesParameters(EntityBeingResourceType type) { _resourceType = type; }
private GameObject GetModel(EntityBeingResourceType resourceType, EntityType receivingType, EntityType inflictingType, bool positive) { return(positive ? _modelParameters[((int)receivingType) - 1].ModelPerEntityType[((int)inflictingType) - 1].ModelsPerResource[PinouUtils.Maths.Pow2toIndex((int)resourceType)].PositiveReceivedTextModel: _modelParameters[((int)receivingType) - 1].ModelPerEntityType[((int)inflictingType) - 1].ModelsPerResource[PinouUtils.Maths.Pow2toIndex((int)resourceType)].NegativeReceivedTextModel); }
private bool ShouldMakeText(EntityBeingResourceType resourceType, EntityType receivingType, EntityType inflictingType, bool positive) { return(positive ? _modelParameters[((int)receivingType) - 1].ModelPerEntityType[((int)inflictingType) - 1].ModelsPerResource[PinouUtils.Maths.Pow2toIndex((int)resourceType)].ShouldDisplayPositiveText: _modelParameters[((int)receivingType) - 1].ModelPerEntityType[((int)inflictingType) - 1].ModelsPerResource[PinouUtils.Maths.Pow2toIndex((int)resourceType)].ShouldDisplayNegativeText); }
public GameObject GetModel(EntityBeingResourceType resource, EntityType inflictingEntity, bool positive) { return(_modelPerEntityType[((int)inflictingEntity - 1)].GetModel(resource, positive)); }
public AbilitiesResourcesInfluenceData(EntityBeingResourceType resources, EntityAbilityResourceStat stats) { resourceInfluenced = resources; statInfluenced = stats; }
public AbilityResourceImpactData(EntityBeingResourceType resourceType, float change) { _resourceType = resourceType; _resourceChange = change; }