예제 #1
0
    public void SpawnSplash(int colorIndex, Color color, float x, float y, float scaleMultiplier)
    {
        if (Level.Get.levelID == 2)
        {
            color = ColorFromIndex(colorIndex);
        }

        Vector3    pos = new Vector3(x, y, GetNextZ());
        GameObject obj = Instantiate(
            Helper.Random(splashPrefab),
            pos, Quaternion.Euler(0, 0, Random.Range(-180, 180))) as GameObject;

        Level.Get.Attach(obj);         // For wrapping

        float scaling = obj.transform.localScale.x * Random.Range(0.8f, 1.3f) * scaleMultiplier;

        obj.transform.localScale = new Vector3(scaling, scaling, 1);

        obj.name = "PolyPaint_splash";
        Helper.SetActive(obj, true);         // Needed when prefabs are inactive modified clones instead

        PolyPaintQuad quad = new PolyPaintQuad(obj, color, 0.25f);

        paintQuads.Add(quad);

        // Check revealed parts on hidden paintings
        // Note : scaling is reduced a bit because the splash doesn't spread much paint on its edges
        CheckHiddenPaintings(pos, 0.6f * scaling, colorIndex);
    }
예제 #2
0
    public void SpawnCloudProjection(Color color, float x, float y, float angleDeg)
    {
        Vector3    pos = new Vector3(x, y, GetNextZ());
        GameObject obj = Instantiate(
            Helper.Random(projectionPrefab),
            pos, Quaternion.Euler(0, 0, angleDeg)) as GameObject;

        Level.Get.Attach(obj);         // For wrapping

        obj.name = "PolyPaint_projection";
        Helper.SetActive(obj, true);         // Needed when prefabs are inactive modified clones instead

        // Fix position
        float r = 8f;

        pos.x -= r * Mathf.Cos(angleDeg * Mathf.Deg2Rad);
        pos.y -= r * Mathf.Sin(angleDeg * Mathf.Deg2Rad);
        obj.transform.position = pos;

        PolyPaintQuad pp = new PolyPaintQuad(obj, color, 0.25f);

        paintQuads.Add(pp);

        // Cloud projection don't check revelations (maybe it should?)
    }
예제 #3
0
    public void SpawnDrip(Color color, float x, float y)
    {
        Vector3    pos = new Vector3(x, y, GetNextZ());
        GameObject obj = Instantiate(
            Helper.Random(dripPrefab),
            pos, Quaternion.Euler(0, 0, Random.Range(-180, 180))) as GameObject;

        Level.Get.Attach(obj);         // For wrapping

        float s = obj.transform.localScale.x * Random.Range(0.8f, 1.3f);

        obj.transform.localScale = new Vector3(s, s, 1);

        obj.name = "PolyPaint_drip";
        Helper.SetActive(obj, true);         // Needed when prefabs are inactive modified clones instead

        // Create new quad even if this one is not animated (spread = -1),
        // because it will now persist as for splashes
        PolyPaintQuad quad = new PolyPaintQuad(obj, color, -1);

        paintQuads.Add(quad);

        /* --- This is done in PolyPaintQuad
         * // Send color by mesh vertices
         * MeshFilter mf = obj.GetComponent<MeshFilter>();
         * //Color32[] colors = mf.mesh.colors32;
         * Color32[] colors = new Color32[4];//mf.mesh.colors32;
         * for(int i = 0; i < colors.Length; ++i)
         * {
         *      colors[i] = color;
         * }
         * mf.mesh.colors32 = colors;
         */

        // Drips don't check revelations (trails are more relevant)
    }