Esempio n. 1
0
    void OnTriggerEnter2D(Collider2D collision)
    {
        if (collision.tag == "Player")
        {
            playerScript.TakeDamage(dmg);
            Explode();
        }
        if (collision.tag == "Ground")
        {
            if (player != null)
            {
                Instantiate(Reward, transform.position, Quaternion.identity);

                Loot = Reward.GetComponent <RewardBlock>();

                Loot.lootAmount = reward;
            }

            Explode();
        }
        if (collision.tag == "NoRewardGround")
        {
            Explode();
        }
    }
        private PromoDynamicExpressionTree GetDynamicExpression()
        {
            var customerConditionBlock = new BlockCustomerCondition();

            customerConditionBlock.AvailableChildren = new DynamicExpression[] { new ConditionIsEveryone(), new ConditionIsFirstTimeBuyer(),
                                                                                 new ConditionIsRegisteredUser() }.ToList();

            var catalogConditionBlock = new BlockCatalogCondition();

            catalogConditionBlock.AvailableChildren = new DynamicExpression[] { new ConditionEntryIs(), new ConditionCurrencyIs(),
                                                                                new  ConditionCodeContains(), new ConditionCategoryIs(), }.ToList();

            var cartConditionBlock = new BlockCartCondition();

            cartConditionBlock.AvailableChildren = new DynamicExpression[] { new ConditionCartSubtotalLeast(), new ConditionAtNumItemsInCart(),
                                                                             new ConditionAtNumItemsInCategoryAreInCart(), new ConditionAtNumItemsOfEntryAreInCart() }.ToList();
            var rewardBlock = new RewardBlock();

            rewardBlock.AvailableChildren = new DynamicExpression[] { new RewardCartGetOfAbsSubtotal(), new RewardItemGetFreeNumItemOfProduct(), new RewardItemGetOfAbs(),
                                                                      new RewardItemGetOfAbsForNum(), new RewardItemGetOfRel(), new RewardItemGetOfRelForNum(),
                                                                      new RewardItemGiftNumItem(), new RewardShippingGetOfAbsShippingMethod(), new RewardShippingGetOfRelShippingMethod() }.ToList();

            var rootBlockExpressions = new DynamicExpression[] { customerConditionBlock, catalogConditionBlock, cartConditionBlock, rewardBlock }.ToList();
            var retVal = new PromoDynamicExpressionTree()
            {
                Children          = rootBlockExpressions,
                AvailableChildren = rootBlockExpressions
            };

            return(retVal);
        }
Esempio n. 3
0
        private static PromoDynamicExpressionTree GetPromotionDynamicExpression()
        {
            var customerConditionBlock = new BlockCustomerCondition
            {
                AvailableChildren = new DynamicExpression[]
                {
                    new ConditionIsEveryone(), new ConditionIsFirstTimeBuyer(),
                    new ConditionIsRegisteredUser(), new UserGroupsContainsCondition()
                }.ToList()
            };

            var catalogConditionBlock = new BlockCatalogCondition
            {
                AvailableChildren = new DynamicExpression[]
                {
                    new ConditionEntryIs(), new ConditionCurrencyIs(),
                    new ConditionCodeContains(), new ConditionCategoryIs(),
                    new ConditionInStockQuantity()
                }.ToList()
            };

            var cartConditionBlock = new BlockCartCondition
            {
                AvailableChildren = new DynamicExpression[]
                {
                    new ConditionCartSubtotalLeast(), new ConditionAtNumItemsInCart(),
                    new ConditionAtNumItemsInCategoryAreInCart(), new ConditionAtNumItemsOfEntryAreInCart(), new ConditionHasRecurringItems()
                }.ToList()
            };
            var rewardBlock = new RewardBlock
            {
                AvailableChildren = new DynamicExpression[]
                {
                    new RewardCartGetOfAbsSubtotal(), new RewardCartGetOfRelSubtotal(), new RewardItemGetFreeNumItemOfProduct(), new RewardItemGetOfAbs(),
                    new RewardItemGetOfAbsForNum(), new RewardItemGetOfRel(), new RewardItemGetOfRelForNum(),
                    new RewardItemGiftNumItem(), new RewardShippingGetOfAbsShippingMethod(), new RewardShippingGetOfRelShippingMethod(), new RewardPaymentGetOfAbs(),
                    new RewardPaymentGetOfRel(), new RewardItemForEveryNumInGetOfRel(), new RewardItemForEveryNumOtherItemInGetOfRel(),
                    new RewardRecurringItemGetOfRel(),
                }.ToList()
            };

            var rootBlocks = new DynamicExpression[] { customerConditionBlock, catalogConditionBlock, cartConditionBlock, rewardBlock }.ToList();
            var retVal = new PromoDynamicExpressionTree
            {
                Children = rootBlocks,
            };

            return(retVal);
        }