Beispiel #1
0
    public void PlayFx(string name)
    {
        AudioClip audio = Resources.Load(CONSTANTS.get("SFX") + name) as AudioClip;

        if (audio != null)
        {
            this.GetComponent <AudioSource>().PlayOneShot(audio);
        }
    }
Beispiel #2
0
    void Start()
    {
        GlobalFunctions.isLoading = false;
        if (canvas != null)
        {
            if (canvas.activeInHierarchy)
            {
                canvas.SetActive(false);
            }
        }
        if (GameOverCanvas != null)
        {
            if (GameOverCanvas.activeInHierarchy)
            {
                GameOverCanvas.SetActive(false);
            }
        }
        customStyle = GlobalFunctions.getMenuButtonStyle();
        rules       = EasyLevelRules.LoadLevels(level);
        cardList.Clear();
        canSelect = true;
        clicks    = 0;
        for (int x = rules.maxCards; x > 0; x--)
        {
            string cardToUse = "card" + RNG.Next(1, CONSTANTS.TOTAL_CARD_NUMBERS).ToString();
            //To Avoid Repeated Images
            while (cardList.FindAll(find => find.name == cardToUse).Count != 0)
            {
                cardToUse = "card" + RNG.Next(1, CONSTANTS.TOTAL_CARD_NUMBERS).ToString();
            }

            EasyCard firstCard = new EasyCard();
            firstCard.id       = x.ToString();
            firstCard.name     = cardToUse;
            firstCard.backface = Resources.Load(CONSTANTS.get("CARD_IMG") + "cardback") as Texture2D;
            firstCard.image    = Resources.Load(CONSTANTS.get("CARD_IMG") + cardToUse) as Texture2D;
            firstCard.moveBackContent();
            firstCard.moveContent();
            firstCard.setTexture();
            addCardRandomly(firstCard);

            EasyCard secondCard = new EasyCard();
            secondCard.id       = x.ToString();
            secondCard.name     = cardToUse;
            secondCard.backface = Resources.Load(CONSTANTS.get("CARD_IMG") + "cardback") as Texture2D;
            secondCard.image    = Resources.Load(CONSTANTS.get("CARD_IMG") + cardToUse) as Texture2D;
            secondCard.moveBackContent();
            secondCard.moveContent();
            addCardRandomly(secondCard);
        }
    }
Beispiel #3
0
    public static GUIStyle getLabelStyle()
    {
        GUIStyle customStyle = new GUIStyle();

        customStyle.normal.background = Resources.Load(CONSTANTS.get("LBL") + "Label") as Texture2D;
        customStyle.hover.background  = Resources.Load(CONSTANTS.get("LBL") + "Label") as Texture2D;;
        customStyle.active.background = Resources.Load(CONSTANTS.get("LBL") + "Label") as Texture2D;;
        customStyle.font             = Resources.Load("UI/Font/SAOUITT-Bold") as Font;
        customStyle.fontSize         = 30;
        customStyle.normal.textColor = Color.white;
        customStyle.hover.textColor  = Color.yellow;
        customStyle.active.textColor = Color.red;
        customStyle.alignment        = TextAnchor.MiddleCenter;
        return(customStyle);
    }
Beispiel #4
0
 public void AddTexture(string imagename)
 {
     this.images.Add(Resources.Load(CONSTANTS.get("QUESTION_IMG") + imagename) as Texture2D);
 }