protected override void InnerReplaceValues(Dictionary <Value, Value> originalReplace) { if (originalReplace.ContainsKey(targetHealth)) { targetHealth = originalReplace[targetHealth] as HealthValue; } }
protected override void InnerReplaceValues(Dictionary <Value, Value> originalReplace) { if (originalReplace.TryGetValue(target, out Value gottenHealth)) { target = gottenHealth as HealthValue; } }
// Shoots with gun void Shoot() { shootingNoise.Play(); RaycastHit hit; // Mult value for light intensity of flash float multFlash = returnLightIntensityMult(); innerLight.intensity = multFlash * innerLightDefault; outerLight.intensity = multFlash * outerLightDefault; spotLight.intensity = multFlash * spotLightDefault; if (Physics.Raycast(cameraObject.transform.position, cameraObject.transform.forward, out hit, range)) { HealthValue enemy = hit.transform.GetComponent <HealthValue>(); if (enemy != null) { spotLight.transform.position = cameraObject.transform.position; spotLight.transform.forward = cameraObject.transform.forward; // formula allows gun to deal more damage if it have not been used in a little while enemy.ChangeHealth(-damage * ((multTime > timeMax) ? maxPower : 1 + (maxPower - 1) * multTime / timeMax)); } } }
protected override void InnerReplaceValues(Dictionary <Value, Value> originalReplace) { if (originalReplace.TryGetValue(lookTarget, out Value newLookTarget)) { lookTarget = (Vector2Value)newLookTarget; } if (originalReplace.TryGetValue(healthTarget, out Value newHealthTarget)) { healthTarget = (HealthValue)newHealthTarget; } }
protected override void InnerReplaceValues(Dictionary <Value, Value> originalReplace) { if (originalReplace.TryGetValue(target, out Value replaceTarget)) { target = replaceTarget as HealthValue; } if (originalReplace.TryGetValue(outPath, out Value replacePath)) { outPath = replacePath as PathValue; } }
public float CalculateCurrentHealth() { float health = 0; foreach (var module in Modules) { health += module.CurrentHealth; } return(health); }
public void UpdateHealthList() { Modules.Clear(); Health[] healthChildren = transform.GetComponentsInChildren <Health>(); for (int i = 0; i < healthChildren.Length; i++) { if (i == 0) { continue; } HealthValue value = healthChildren[i].health; value.Owner = healthChildren[i].name; Modules.Add(healthChildren[i].health); } }
private void Awake() { healthValue = GetComponentInChildren <HealthValue>(); }