Exemplo n.º 1
0
    void OnSceneGUI()
    {
        Undo.RecordObject(target, "Resize TC Particle emitter");
        var emitter = target as TCShapeEmitter;

        TCDrawFunctions.DrawEmitterShape(emitter.ShapeData, emitter.transform, m_drawer);
    }
Exemplo n.º 2
0
    public void OnSceneGUI()
    {
        var c = target as TCCollider;

        if (c == null)
        {
            return;
        }

        switch (c.shape)
        {
        case ColliderShape.Disc:
            if (c.radius == null)
            {
                return;
            }

            float rmin = c.radius.IsConstant ? 0.0f : c.radius.Min;
            float rmax = c.radius.Max;

            float round;
            TCDrawFunctions.DiscHandle(c.transform, rmin, rmax, c.discHeight, c.rounding, (int)c.discType, out rmin, out rmax, out round);

            c.rounding = round;

            c.radius.Min = rmin;
            c.radius.Max = rmax;

            break;

        case ColliderShape.Hemisphere:
            c.radius.Max = TCDrawFunctions.HemisphereHandle(c.transform, c.radius.Value);
            break;

        case ColliderShape.RoundedBox:
            Vector3 sz = c.boxSize;

            float r = c.rounding;
            c.rounding = Mathf.Clamp(c.rounding, 0.0f, Mathf.Min(c.boxSize.x, c.boxSize.y, c.boxSize.z) * 0.5f);
            c.boxSize  = TCDrawFunctions.RoundedCubeHandle(sz, r, c.transform);

            break;
        }
    }
    public void OnSceneGUI()
    {
        var system = target as TCParticleSystem;

        if (system == null)
        {
            return;
        }
        var emitter = system.Emitter as ParticleEmitter;

        if (emitter == null)
        {
            return;
        }

        var pes = emitter.GetEmitterShapeData();

        var transform = system.transform;
        var drawer    = m_drawers[system];

        Undo.RecordObject(target, "Resize TC Particle emitter");
        TCDrawFunctions.DrawEmitterShape(pes, transform, drawer);
    }
Exemplo n.º 4
0
    public void OnSceneGUI()
    {
        var f = target as TCForce;

        if (m_primeForce.IsGlobalShape && f != m_primeForce || f == null || f.radius == null)
        {
            return;
        }

        switch (f.shape)
        {
        case ForceShape.Sphere:
            f.radius.Max = TCDrawFunctions.RadiusHandle(f.transform, f.radius.Max);

            if (!f.radius.IsConstant)
            {
                f.radius.Min = TCDrawFunctions.RadiusHandle(f.transform, f.radius.Min);
            }

            break;

        case ForceShape.Box:
            f.boxSize = TCDrawFunctions.CubeHandle(f.transform, f.boxSize);
            break;


        case ForceShape.Capsule:
            float   r = f.radius.IsConstant ? f.radius.Value : f.radius.Max;
            Vector2 c = TCDrawFunctions.CapsuleHandle(f.transform, r, f.height);

            if (f.radius.IsConstant)
            {
                f.radius.Value = c.x;
            }
            else
            {
                f.radius.Max = c.x;
            }
            f.height = c.y;
            break;

        case ForceShape.Disc:
            float rmin = f.radius.IsConstant ? 0.0f : f.radius.Min;
            float rmax = f.radius.Max;
            float round;
            TCDrawFunctions.DiscHandle(f.transform, rmin, rmax, f.discHeight, f.discRounding, (int)f.discType, out rmin, out rmax,
                                       out round);
            f.discRounding = round;
            f.radius.Min   = rmin;
            f.radius.Max   = rmax;
            break;

        case ForceShape.Hemisphere:

            f.radius.Max = TCDrawFunctions.HemisphereHandle(f.transform, f.radius.Max);

            break;
        }

        if (f.forceType == ForceType.Turbulence || f.forceType == ForceType.TurbulenceTexture)
        {
            m_forceGenerator.DrawTurbulencePreview();
        }
    }