Exemplo n.º 1
0
 protected override void InnerReplaceValues(Dictionary <Value, Value> originalReplace)
 {
     if (originalReplace.ContainsKey(targetHealth))
     {
         targetHealth = originalReplace[targetHealth] as HealthValue;
     }
 }
Exemplo n.º 2
0
 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));
            }
        }
    }
Exemplo n.º 4
0
 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;
     }
 }
Exemplo n.º 5
0
 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;
     }
 }
Exemplo n.º 6
0
    public float CalculateCurrentHealth()
    {
        float health = 0;

        foreach (var module in Modules)
        {
            health += module.CurrentHealth;
        }

        return(health);
    }
Exemplo n.º 7
0
 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);
     }
 }
Exemplo n.º 8
0
 private void Awake()
 {
     healthValue = GetComponentInChildren <HealthValue>();
 }