void InspireSphere() { stringButton.gameObject.SetActive(false); int length = combo.Length; for (int j = 0; j < length; j++) { buttons[j].GetComponent <Image>().sprite = null; var col = buttons[j].GetComponent <Image>().color; col.a = 0; buttons[j].GetComponent <Image>().color = col; } RefillScript.ChangeEnergylevel(40); Collider[] hitColliders = Physics.OverlapSphere(transform.position, radius, citizen); InsipirationFXCtrl ctrl = Instantiate(InspirationFX, transform.position + transform.up * (0.05f + Random.Range(0, 0.02f)), Quaternion.identity) as InsipirationFXCtrl; ctrl.gameObject.transform.parent = transform; ctrl._radius = 10; ctrl.Execute(); int i = 0; float reduceFactor = inspirationPower / hitColliders.Length; while (i < hitColliders.Length) { //hitColliders[i].gameObject.GetComponent<Renderer>().material.SetColor("_Color",Color.black); hitColliders[i].gameObject.GetComponent <HealthManager>().health += reduceFactor; if (hitColliders[i].gameObject.GetComponent <HealthManager>().health > 100) { hitColliders[i].gameObject.GetComponent <HealthManager>().health = 100; } //<Material>().SetColor Debug.Log(hitColliders[i].gameObject.name); i++; } }
private IEnumerator PurifyCoroutine() { //VFXManager.Instance._inspirationFXPrefab float purifyTime = _maxRange / _spreadSpeed; InsipirationFXCtrl wave = Instantiate(VFXManager.Instance._inspirationFXPrefab, _center.transform.position, Quaternion.identity) as InsipirationFXCtrl; wave._radius = _maxRange; wave._fxTime = purifyTime; wave.Execute(); float startTime = Time.time; float currTime = startTime; while (currTime - startTime < purifyTime) { float currRange = Mathf.Lerp(0f, _maxRange, Mathf.Clamp01((currTime - startTime) / purifyTime)); foreach (MeshRenderer ren in _meshRenderers) { ren.material.SetFloat("_ThresDist", currRange); } currTime = Time.time; yield return(null); } }