void FixedUpdate() { if (vT != null) { transform.LookAt(vT.transform); transform.Translate(Vector3.forward * Time.deltaTime * vSpeed); if ((vT.transform.position - transform.position).sqrMagnitude <= 0.2) { vT.DMG(vDmg); if (vT.vParticles == 1) { vDMGParticles.transform.parent = null; DieOnCall a1 = vDMGParticles.GetComponent <DieOnCall>(); a1.Die(); vDMGParticles.particleSystem.Play(); } Die(); } vRemapped = Mathfx.Remap((vT.transform.position - transform.position).sqrMagnitude, 1f, 400f, 1f, 0f); lerpedColor = Color.Lerp(red, blue, vRemapped); vEM.vMeshes[vEM.vCurrent].renderer.material.color = lerpedColor; if (Input.GetKeyDown("z")) { Debug.Log(vEM.vMeshes[vEM.vCurrent].renderer.material.color); } } }
public void DMG(int d) { vHealth -= d; if (vHealth <= 0) { //die vT.EARN(vExp, vMoney); if (vT.vParticles == 1) { DieOnCall a2 = vDMGParticles.GetComponent <DieOnCall>(); a2.Die(); vParticles.transform.parent = null; vParticles.particleSystem.Play(); } Die(); } }