Ejemplo n.º 1
0
    void OnDrawGizmos()
    {
        if (drawpath)
        {
            Gizmos.color = Color.grey;

            if (flowpositions.Count > 0)
            {
                Vector3 lpos = Vector3.zero;
                for (int i = 0; i < flowpositions.Count; i++)
                {
                    MegaFlowPos fpos = flowpositions[i];
                    Gizmos.color = Color.white;
                    if (i > 0)
                    {
                        Gizmos.DrawLine(lpos, fpos.pos);
                    }

                    Gizmos.color = Color.green;
                    Gizmos.DrawSphere(fpos.pos, 0.1f);

                    lpos = fpos.pos;
                }
            }

            DrawMoveGizmo();
        }

        Gizmos.DrawIcon(transform.position, "MegaFlowIcon.png", true);
    }
Ejemplo n.º 2
0
    void AddPos(Vector3 pos, Vector3 vel, Matrix4x4 tm, Matrix4x4 tm1, float flowscale)
    {
        MegaFlowPos fpos = new MegaFlowPos();

        fpos.Set(pos, vel, tm, tm1, flowscale, flowtime);

        flowpositions.Add(fpos);
    }
Ejemplo n.º 3
0
    void ProcessPos()
    {
        for (int i = 0; i < flowpositions.Count; i++)
        {
            MegaFlowPos fpos = flowpositions[i];

            fpos.fpos += fpos.vel * Time.deltaTime;
            fpos.time -= Time.deltaTime;

            fpos.alpha = 1.0f - (fpos.time / fpos.stime);
            if (usefalloff)
            {
                fpos.falloff = falloffcrv.Evaluate(fpos.alpha);
            }
            else
            {
                fpos.falloff = 1.0f;
            }

            if (fpos.time < 0.0f)
            {
                flowpositions.RemoveAt(i);
                i--;
            }
            else
            {
                if (frames.Count > 0)
                {
                    fpos.frame = 0;

                    for (int f = frames.Count - 1; f >= 0; f--)
                    {
                        if (fpos.alpha > frames[f].time)
                        {
                            fpos.frame = f;
                            break;
                        }
                    }
                }
            }
        }
    }
Ejemplo n.º 4
0
    void UpdateLast(Vector3 pos, Vector3 vel, Matrix4x4 tm, Matrix4x4 tm1, float flowscale)
    {
        MegaFlowPos fpos = flowpositions[flowpositions.Count - 1];

        fpos.Set(pos, vel, tm, tm1, flowscale, flowtime);
    }
Ejemplo n.º 5
0
	void AddPos(Vector3 pos, Vector3 vel, Matrix4x4 tm, Matrix4x4 tm1, float flowscale)
	{
		MegaFlowPos fpos = new MegaFlowPos();
		fpos.Set(pos, vel, tm, tm1, flowscale, flowtime);

		flowpositions.Add(fpos);
	}