Example #1
0
    void OnTriggerEnter(Collider other)
    {
        if (other.tag == Constants._PlayerTag)
        {
            // AllPlayerPrefs.piece += piece;

            GlobalManager.Ui.TakeCoin();

            GetComponent <CapsuleCollider>().enabled = false;

            Debug.Log(GetComponent <MeshRenderer>().material.name);

            if (GetComponent <MeshRenderer>().material.name == "Piece (Instance)")
            {
                AllPlayerPrefs.SetIntValue(Constants.Coin, 1);
            }
            else
            {
                AllPlayerPrefs.SetIntValue(Constants.Coin, 5);
            }

            GlobalManager.Ui.MoneyPoints.text = "" + AllPlayerPrefs.GetIntValue(Constants.Coin);

            transform.DOLocalRotate(new Vector3(0, 2000, 0), 1f, RotateMode.FastBeyond360);

            Destroy(this.gameObject, 1f);
        }
    }
Example #2
0
    protected override void InitializeUi()
    {
        currCatSeled  = DefCatSelected;
        currItemSeled = currCatSeled.DefautItem;


        fixBackShop       = transform.parent.Find("GlobalBackGround/Shop").gameObject;
        moneyNumberPlayer = fixBackShop.transform.Find("MoneyMutation/MoneyNumber").GetComponent <Text> ( );

        moneyNumberPlayer.text = "" + AllPlayerPrefs.GetIntValue(Constants.Coin);

        ItemModif[] checkAllItem = GetComponentsInChildren <ItemModif> (true);
        ItemModif   currItem;

        string getCons = Constants.ItemBought;
        Dictionary <string, ItemModif> getItemConf = new Dictionary <string, ItemModif> ( );

        allTempItem = new List <ItemModif> ( );

        for (int a = 0; a < checkAllItem.Length; a++)
        {
            if (AllPlayerPrefs.GetBoolValue(getCons + checkAllItem [a].CatName + checkAllItem [a].ItemName))
            {
                currItem = checkAllItem [a];

                try{
                    getItemConf.Add(getCons + checkAllItem [a].CatName, currItem);
                }catch { Debug.Log("key same"); }

                currItem.GetComponent <Image> ( ).sprite = currItem.SpriteConfirm;

                if (currItem.UseColor)
                {
                    currItem.GetComponent <Image> ( ).color = currItem.ColorConfirm;
                }
            }
        }

        CheckSelectItem(true);

        allConfirm = getItemConf;
        GlobalManager.GameCont.AllModifItem = getItemConf;
        GlobalManager.GameCont.AllTempsItem = allTempItem;
    }
Example #3
0
    void InieUI( )
    {
        //	InvokeRepeating ( "checkCurosr", 0, 0.5f );

        System.Action <HomeEvent> checkLevel = delegate(HomeEvent thisEvnt)
        {
            onMainScene = thisEvnt.onMenuHome;
        };

        GlobalManager.Event.Register(checkLevel);

        MoneyPoints.text = "" + AllPlayerPrefs.GetIntValue(Constants.Coin);

        if (PatternBackground != null)
        {
            PatternBackground.transform.DOLocalMoveY(-60, 5f).SetEase(Ease.Linear).OnComplete(() => {
                PatternBackground.transform.DOLocalMoveY(1092, 0);
            }).SetLoops(-1, LoopType.Restart);
        }
    }
Example #4
0
    // achete ou confirme un item
    public void BuyItem( )
    {
        string getCons = Constants.ItemBought + currItemSeled.CatName;
        Dictionary <string, ItemModif> getAllBuy = allConfirm;

        if (AllPlayerPrefs.GetBoolValue(getCons + currItemSeled.ItemName))
        {
            AllPlayerPrefs.SetStringValue(getCons + currItemSeled.ItemName, "Confirm");
            ItemModif getThis;

            if (getAllBuy.TryGetValue(getCons, out getThis))
            {
                AllPlayerPrefs.SetStringValue(getCons + getThis.ItemName, "ok");

                if (getThis.UseOtherSprite)
                {
                    getThis.GetComponent <Image> ( ).sprite = currItemSeled.BoughtSpriteUnselected;
                }
                else
                {
                    getThis.GetComponent <Image> ( ).sprite = currItemSeled.SpriteUnselected;
                }

                if (getThis.UseColor)
                {
                    if (getThis.UseOtherColor)
                    {
                        getThis.GetComponent <Image> ( ).color = currItemSeled.BoughtColorUnSelected;
                    }
                    else
                    {
                        getThis.GetComponent <Image> ( ).color = currItemSeled.ColorUnSelected;
                    }
                }

                getAllBuy.Remove(getCons);
            }

            getThis = currItemSeled;
            getThis.GetComponent <Image> ( ).sprite = getThis.SpriteConfirm;

            if (getThis.UseColor)
            {
                getThis.GetComponent <Image> ( ).color = getThis.ColorConfirm;
            }

            getAllBuy.Add(getCons, getThis);
        }
        else
        {
            bool      checkProg = false;
            ItemModif currIT    = currItemSeled;

            if (currCatSeled.Progression)
            {
                if (currIT.UpItem.ItemBought || currIT.DownItem.ItemBought || currIT.LeftItem.ItemBought || currIT.RightItem.ItemBought)
                {
                    checkProg = true;
                }
            }
            else
            {
                checkProg = true;
            }

            if (checkProg && AllPlayerPrefs.GetIntValue(Constants.Coin) > currIT.Price)
            {
                Debug.Log("buy");
                AllPlayerPrefs.SetIntValue(Constants.Coin, -currIT.Price);

                if (currCatSeled.BuyForLife)
                {
                    getAllBuy.Add(getCons, currItemSeled);
                    AllPlayerPrefs.SetStringValue(getCons + currIT.ItemName);
                }
                else
                {
                    allTempItem.Add(currItemSeled);
                }
            }
        }

        moneyNumberPlayer.text = "" + AllPlayerPrefs.GetIntValue(Constants.Coin);
    }