// Use this for initialization
 void Start()
 {
     Instance = this;
 }
	// Use this for initialization
	void Start () 
	{
		Instance = this;
	}
 public SharkAttackCallback(Shark shark, CharacterStatus characterStatus, GameSoundManager soundManager)
 {
     Shark           = shark;
     CharacterStatus = characterStatus;
     SoundManager    = soundManager;
 }
示例#4
0
 public void SoundOn()
 {
     GameSoundManager.ActiveSound();
 }
示例#5
0
 public void SoundOff()
 {
     GameSoundManager.MuteSound();
 }
示例#6
0
 private void Start()
 {
     musicManager = FindObjectOfType <GameSoundManager>();
     //  OptionsMenu.SetActive(false);
 }
示例#7
0
    /// <summary>
    ///
    /// </summary>
    void Start()
    {
        playDestruction = true;
        //Warning.
        if (tileHorizontal % 2 != 0 || tileVertical % 2 != 0)
        {
            Debug.LogWarning("Use power of 2 tile horizontal and vertical!");
        }

        destructAudio = GameSoundManager.GetClip("glass_destruction");
        hitAudio      = GameSoundManager.GetClip("glass_hit");

        if (audio == null)
        {
            gameObject.AddComponent <AudioSource>();
        }
        audio.loop        = false;
        audio.playOnAwake = false;

        //Intialize with false the first hit (used to change texture to breaked).
        firstHit = false;

        //Set base alpha texture size.
        sizeTextureX = (int)((textureBaseMarks[0].width / 4.0f) * tileHorizontal);
        sizeTextureY = (int)((textureBaseMarks[0].height / 4.0f) * tileVertical);

        textureCurrentAlpha = new Texture2D(2, 2, TextureFormat.ARGB32, true); //(Texture2D)renderer.material.GetTexture("_AlphaTex");
        renderer.material.SetTexture("_AlphaTex", textureCurrentAlpha);

        //Resize the base alpha color of glass.
        textureCurrentAlpha.Resize(sizeTextureX, sizeTextureY);

        //Set all glass with white color and apply.
        Color[] auxTexColors = new Color[(int)(textureCurrentAlpha.width * textureCurrentAlpha.height)];
        for (int i = 0; i < auxTexColors.Length; i++)
        {
            auxTexColors[i] = Color.white;
        }
        textureCurrentAlpha.SetPixels(0, 0, textureCurrentAlpha.width, textureCurrentAlpha.height, auxTexColors);
        textureCurrentAlpha.Apply();

        //Create the glass matrix.
        matrixOfGlass      = new bool[tileHorizontal + 2, tileVertical + 2];
        selectedMarkNumber = new int[tileHorizontal + 2, tileVertical + 2];

        for (int i = 0; i < matrixOfGlass.GetLength(0); i++)
        {
            for (int j = 0; j < matrixOfGlass.GetLength(1); j++)
            {
                matrixOfGlass[i, j]      = false;
                selectedMarkNumber[i, j] = -1;
            }
        }
        selectedMarkNumber = new int[tileHorizontal + 2, tileVertical + 2];


        //Create object that simulate colliding bullet.
        objectColliding = new GameObject("object_colliding");
        objectColliding.transform.parent        = transform;
        objectColliding.transform.localPosition = Vector3.zero;


        //Calculate the size of one recorte base alpha texture.
        baseQuadSizeX = (int)(textureBaseMarks[0].width * 0.25f);
        baseQuadSizeY = (int)(textureBaseMarks[0].height * 0.25f);


        //Start all marks squares.
        glassStruct = new GlassStruct[16];
        for (int i = 0; i < 4; i++)
        {
            for (int j = 0; j < 4; j++)
            {
                glassStruct[(i * 4) + j] = new GlassStruct((i * 4) + j,
                                                           new GlassMark(textureBaseMarks[0].GetPixels(i * baseQuadSizeX, j * baseQuadSizeY, baseQuadSizeX, baseQuadSizeY)),
                                                           new GlassMark(textureBaseMarks[1].GetPixels
                                                                             (i * baseQuadSizeX, j * baseQuadSizeY, baseQuadSizeX, baseQuadSizeY)));
            }
        }

        //Create a basic black square to fill intersections of four breaked points.
        GlassStruct.blackFillTexture = new Color[baseQuadSizeX * baseQuadSizeY];
        for (int i = 0; i < baseQuadSizeX; i++)
        {
            for (int j = 0; j < baseQuadSizeY; j++)
            {
                GlassStruct.blackFillTexture[(i * baseQuadSizeX) + j] = Color.black;
            }
        }


        //Set base marks with sides (left side, top side, right side, bottom side) -> True if breaked, False if not breaked.
        glassStruct[0].SetSides(true, false, true, true);
        glassStruct[1].SetSides(false, true, true, false);
        glassStruct[2].SetSides(false, true, false, false);
        glassStruct[3].SetSides(false, false, false, false);
        glassStruct[4].SetSides(true, true, false, true);
        glassStruct[5].SetSides(false, false, true, true);
        glassStruct[6].SetSides(true, false, true, false);
        glassStruct[7].SetSides(true, false, false, false);
        glassStruct[8].SetSides(true, true, true, false);
        glassStruct[9].SetSides(true, false, false, true);
        glassStruct[10].SetSides(false, true, false, true);
        glassStruct[11].SetSides(false, false, true, false);
        glassStruct[12].SetSides(true, true, true, true);
        glassStruct[13].SetSides(false, true, true, true);
        glassStruct[14].SetSides(true, true, false, false);
        glassStruct[15].SetSides(false, false, false, true);


        //Create particle system.
        parentEmmiters               = new GameObject("particle_emmiters").transform;
        parentEmmiters.parent        = transform;
        parentEmmiters.localPosition = Vector3.zero;
        parentEmmiters.rotation      = transform.rotation;
        parentEmmiters.localScale    = Vector3.one;

        matrixEmmiters = new ParticleEmitter[tileHorizontal, tileVertical];

        auxHorizontal = 10f / (float)tileHorizontal;
        auxVertical   = 10f / (float)tileVertical;

        /*
         * for (int i = 0; i < tileHorizontal; i++)
         * {
         * for (int j = 0; j < tileVertical; j++)
         * {
         * //Crate emmiters and set position.
         * matrixEmmiters[i, j] = ((GameObject)GameObject.Instantiate(particlePrefab, Vector3.zero, Quaternion.identity)).GetComponent<ParticleEmitter>();
         *
         * matrixEmmiters[i, j].name = string.Format("emmiter{0}{1}", i, j);
         * matrixEmmiters[i, j].transform.parent = parentEmmiters;
         *
         * matrixEmmiters[i, j].transform.forward = parentEmmiters.forward;
         * matrixEmmiters[i, j].transform.localPosition = new Vector3((auxHorizontal * (tileHorizontal - i - 1)) + (auxHorizontal * 0.5f) - 5f, 0.0f, (auxVertical * (tileVertical - j - 1)) + (auxVertical * 0.5f) - 5f);
         *
         *              matrixEmmiters[i, j].gameObject.active = false;
         * }
         * }
         * //*/

        //Initialize number of break points with 0.
        numberToBreak = 0;
    }