Ejemplo n.º 1
0
    /// <summary>
    /// This is entry point of program.
    /// </summary>

    void Start()
    {
        taker         = players[0];
        turnSequencer = FindObjectOfType <TurnSequencer>();
        turnSequencer.Init(this);

        dealingSoundSource      = GetComponent <AudioSource>();
        dealingSoundSource.clip = dealCardsProgress;
        tableImage = table.GetComponent <Image>();

        mainSource.clip = buttonClick;

        // add event listener to each button to play sound.
        Button[] btns = FindObjectsOfType <Button>();
        foreach (var btn in btns)
        {
            if (btn.gameObject.name != "UserAction")
            {
                btn.onClick.AddListener(PlayButtonSound);
            }
        }

        options = FindObjectOfType <Options>();
        options.Init(this);
        deck = FindObjectOfType <Deck>();
        deck.Init(this);
        ads = new ADS();


        ads.ShowBannerWhenReady();
    }
Ejemplo n.º 2
0
    public void Init(int index, TurnSequencer ts, Main main, float betDelay, float takeDelay, Sprite deckSprite)
    {
        m         = main;
        Index     = index;
        TakeDelay = takeDelay;
        BetDelay  = betDelay * Index;


        Image[]    images = gameObject.GetComponentsInChildren <Image>();
        TMP_Text[] texts  = gameObject.GetComponentsInChildren <TMP_Text>();

        foreach (var item in texts)
        {
            if (item.gameObject.name == "State")
            {
                stateText = item;
            }
            if (item.gameObject.name == "CardsLeft")
            {
                CardsLeftText = item;
            }
            if (item.gameObject.name == "PlayerNameText")
            {
                playerNameText = item;
            }
        }
        foreach (var item in images)
        {
            if (item.gameObject.name == "DrawPlace")
            {
                DrawPosition = item.transform.position;
                //turn off image so user don`t see red dots.
                item.enabled = false;
            }
            if (item.gameObject.name == "Deck")
            {
                Deck = item.gameObject;
                Deck.GetComponent <Image>().sprite = deckSprite;
            }
        }

        s           = ts;
        Initialized = true;
    }