Example #1
0
    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);
            }
        }
    }