// Start is called before the first frame update void Start() { foreach (Transform nested in transform) { foreach (Transform nested2 in nested) { foreach (Transform t in nested2) { if (t.name == crystalMeshName) { crystalRenderer = t.GetComponent <MeshRenderer>(); } } } if (nested.name == "Point Light") { light = nested.GetComponent <Light>(); } } EnergyTypeConfig conf = Configs.main.EnergyTypeConfigs[type]; crystalMaterial = conf.CrystalMaterial; crystalRenderer.material = crystalMaterial; light.color = conf.EffectColor; }
public void TakeDamage(EnergyTypeConfig energyConfig) { if (energyConfig.FreezeTime > 0) { freezeStarted = Time.fixedTime; freezed = energyConfig.FreezeTime; freezeMult = energyConfig.FreezeMultiplier; } health -= energyConfig.Damage; if (health <= 0) { health = 0; KillHPBar(); Die(); } hpBar.UpdateHp(health); }
private void UpdateEnergies() { if (!Connected) { Reset(); } else { EnergyTypes type = currentEnergies[0].EnergyType.Type; config = Configs.main.EnergyTypeConfigs[type]; if (currentEnergies.Count > 1) { config = config.GetCombo(currentEnergies[1].EnergyType.Type); } distanceIndicator.Show(transform.position); towerMesh.Activate(); Material[] materials = towerTopRenderer.materials; materials[1] = config.CrystalMaterial; towerTopRenderer.sharedMaterials = materials; towerTopRenderer.materials = materials; materials = towerBottomRenderer.materials; materials[1] = config.CrystalMaterial; towerBottomRenderer.sharedMaterials = materials; towerBottomRenderer.materials = materials; var main = topEffect.main; main.startColor = config.EffectColor; bottomEffect.trailMaterial = config.CrystalMaterial; topLight.color = config.EffectColor; topEffect.Play(); topLight.enabled = true; Color color = config.EffectColor; color.a = 0.05f; distanceIndicator.SetColor(color); } }
public void SetConfig(EnergyTypeConfig config) { energyTypeConfig = config; }