Beispiel #1
0
    void OnTriggerEnter2D(Collider2D collider)
    {
        ColorHuman human = collider.GetComponent <ColorHuman> ();
        ColorBoy   boy   = collider.GetComponent <ColorBoy> ();
        ColorGirl  girl  = collider.GetComponent <ColorGirl> ();

        if (boy != null)
        {
            StartCoroutine(ColorGirl.copy_girl.waitAndRun());
        }
        if (girl != null)
        {
            SceneManager.LoadScene("Level1");
        }
        if (human != null)
        {
            human.destroyHuman();
        }
    }
Beispiel #2
0
            private void OnEnable()
            {
                colorBoy = ((MonoBehaviour)target).gameObject.GetComponent <ColorBoy>();

                bannerTexture = new Texture2D(0, 0);
                bannerTexture.LoadImage(System.IO.File.ReadAllBytes(Application.dataPath + "/Stupid/Generic/Icons/Banner.png"));


                bayer2x2Texture = new Texture2D(0, 0);
                bayer2x2Texture.LoadImage(System.IO.File.ReadAllBytes(Application.dataPath + "/Stupid/Image Effects/ColorBoy/Textures/Bayer2x2.png"));

                bayer3x3Texture = new Texture2D(0, 0);
                bayer3x3Texture.LoadImage(System.IO.File.ReadAllBytes(Application.dataPath + "/Stupid/Image Effects/ColorBoy/Textures/Bayer3x3.png"));

                bayer4x4Texture = new Texture2D(0, 0);
                bayer4x4Texture.LoadImage(System.IO.File.ReadAllBytes(Application.dataPath + "/Stupid/Image Effects/ColorBoy/Textures/Bayer4x4.png"));

                bayer8x8Texture = new Texture2D(0, 0);
                bayer8x8Texture.LoadImage(System.IO.File.ReadAllBytes(Application.dataPath + "/Stupid/Image Effects/ColorBoy/Textures/Bayer8x8.png"));

                bnoise64x64Texture = new Texture2D(0, 0);
                bnoise64x64Texture.LoadImage(System.IO.File.ReadAllBytes(Application.dataPath + "/Stupid/Image Effects/ColorBoy/Textures/BlueNoise64.png"));

                if (colorBoy.ditherTexture == null)
                {
                    colorBoy.ditherTexture = bayer4x4Texture;
                }
                else
                {
                    //could not use a switch case for this, don't look at me like that
                    if (colorBoy.ditherTexture == bayer2x2Texture)
                    {
                        colorBoy.currentTexture = 0;
                    }
                    else if (colorBoy.ditherTexture == bayer3x3Texture)
                    {
                        colorBoy.currentTexture = 1;
                    }
                    else if (colorBoy.ditherTexture == bayer4x4Texture)
                    {
                        colorBoy.currentTexture = 2;
                    }
                    else if (colorBoy.ditherTexture == bayer8x8Texture)
                    {
                        colorBoy.currentTexture = 3;
                    }
                    else if (colorBoy.ditherTexture == bnoise64x64Texture)
                    {
                        colorBoy.currentTexture = 4;
                    }
                }


                //set palette if just added component
                if (colorBoy.paletteName == "" || colorBoy.paletteName == null)
                {
                    currentPalette = Random.Range(0, builtInPalettes.palettes.Length);

                    colorBoy.colorCount    = builtInPalettes.palettes[currentPalette].colors.Length;
                    colorBoy.paletteColors = builtInPalettes.palettes[currentPalette].GetColors();
                    colorBoy.paletteName   = builtInPalettes.palettes[currentPalette].name;
                }
                else
                {
                    //select the current palette
                    for (int p = 0; p < builtInPalettes.palettes.Length; p++)
                    {
                        if (colorBoy.paletteName == builtInPalettes.palettes[p].name)
                        {
                            currentPalette = p;
                        }
                    }
                }
            }