Exemplo n.º 1
0
        protected override void OnUpdate()
        {
            var calendarQuery = GetEntityQuery(ComponentType.ReadOnly <TimeTable>());
            var turnNumber    = GetComponent <TimeTable>(calendarQuery.GetSingletonEntity()).Turn;
            var pause         = GetComponent <TimeTable>(calendarQuery.GetSingletonEntity()).Pause;

            if (turnNumber == 0 || pause)
            {
                return;
            }

            Entities
            .WithAll <Fraud>()
            .ForEach((ref Deal deal) =>
            {
                if (deal.Turn != turnNumber)
                {
                    return;
                }
                if (deal.FirstMerchantType == MerchantTypes.Fraud)
                {
                    deal.FirstMerchantCleanDeal = DealError.GetDealType(ref deal.FirstMerchantRandom, false);
                }
                if (deal.SecondMerchantType == MerchantTypes.Fraud)
                {
                    deal.SecondMerchantCleanDeal = DealError.GetDealType(ref deal.SecondMerchantRandom, false);
                }
            }).ScheduleParallel();
        }
Exemplo n.º 2
0
        protected override void OnUpdate()
        {
            var calendarQuery = GetEntityQuery(ComponentType.ReadOnly <TimeTable>());
            var calendar      = GetComponent <TimeTable>(calendarQuery.GetSingletonEntity());

            if (calendar.Turn == 0 || calendar.Pause)
            {
                return;
            }

            Entities
            .WithAll <Altruist>()
            .ForEach((ref Deal deal) =>
            {
                if (deal.Turn != calendar.Turn)
                {
                    return;
                }
                if (deal.FirstMerchantType == MerchantTypes.Altruist)
                {
                    deal.FirstMerchantCleanDeal = DealError.GetDealType(ref deal.FirstMerchantRandom, true);
                }
                if (deal.SecondMerchantType == MerchantTypes.Altruist)
                {
                    deal.SecondMerchantCleanDeal = DealError.GetDealType(ref deal.SecondMerchantRandom, true);
                }
            }).ScheduleParallel();
        }
Exemplo n.º 3
0
        protected override void OnUpdate()
        {
            var calendarQuery = GetEntityQuery(ComponentType.ReadOnly <TimeTable>());
            var calendar      = GetComponent <TimeTable>(calendarQuery.GetSingletonEntity());

            if (calendar.Turn == 0 || calendar.Pause)
            {
                return;
            }

            Entities
            .WithoutBurst()
            .WithAll <Quirky>()
            .ForEach((ref Deal deal) =>
            {
                if (deal.Turn != calendar.Turn)
                {
                    return;
                }
                if (deal.FirstMerchantType == MerchantTypes.Quirky && deal.Turn <= 4)
                {
                    deal.FirstMerchantCleanDeal = DealError.GetDealType(ref deal.FirstMerchantRandom, Pattern[deal.Turn - 1]);
                }
                if (deal.SecondMerchantType == MerchantTypes.Quirky && deal.Turn <= 4)
                {
                    deal.SecondMerchantCleanDeal = DealError.GetDealType(ref deal.SecondMerchantRandom, Pattern[deal.Turn - 1]);
                }
                if (deal.FirstMerchantType == MerchantTypes.Quirky && deal.Turn > 4)
                {
                    if (AmIWasCheated(5, deal.FirstMerchantId, deal.SecondMerchantId, true))
                    {
                        deal.FirstMerchantCleanDeal = DealError.GetDealType(ref deal.FirstMerchantRandom, false);
                    }
                    else
                    {
                        deal.FirstMerchantCleanDeal = DealError.GetDealType(ref deal.FirstMerchantRandom, GetLastDealType(deal.Turn, deal.FirstMerchantId, deal.SecondMerchantId, true));
                    }
                }
                if (deal.SecondMerchantType == MerchantTypes.Quirky && deal.Turn > 4)
                {
                    if (AmIWasCheated(5, deal.FirstMerchantId, deal.SecondMerchantId, false))
                    {
                        deal.SecondMerchantCleanDeal = DealError.GetDealType(ref deal.FirstMerchantRandom, false);
                    }
                    else
                    {
                        deal.SecondMerchantCleanDeal = DealError.GetDealType(ref deal.FirstMerchantRandom, GetLastDealType(deal.Turn, deal.FirstMerchantId, deal.SecondMerchantId, false));
                    }
                }
            }).Run();
        }
Exemplo n.º 4
0
        protected override void OnUpdate()
        {
            var calendarQuery = GetEntityQuery(ComponentType.ReadOnly <TimeTable>());
            var calendar      = GetComponent <TimeTable>(calendarQuery.GetSingletonEntity());

            if (calendar.Turn == 0 || calendar.Pause)
            {
                return;
            }

            Entities
            .WithoutBurst()
            .WithAll <Uber>()
            .ForEach((ref Deal deal) =>
            {
                if (deal.Turn != calendar.Turn)
                {
                    return;
                }
                if (deal.FirstMerchantType == MerchantTypes.Uber && deal.Turn <= 2)
                {
                    deal.FirstMerchantCleanDeal = DealError.GetDealType(ref deal.FirstMerchantRandom, true);
                }
                if (deal.SecondMerchantType == MerchantTypes.Uber && deal.Turn <= 2)
                {
                    deal.SecondMerchantCleanDeal = DealError.GetDealType(ref deal.SecondMerchantRandom, true);
                }
                if (deal.FirstMerchantType == MerchantTypes.Uber && deal.Turn == 3)
                {
                    deal.FirstMerchantCleanDeal = DealError.GetDealType(ref deal.FirstMerchantRandom, !AmICheatedTwice(deal.FirstMerchantId, deal.SecondMerchantId, true));
                }
                if (deal.SecondMerchantType == MerchantTypes.Uber && deal.Turn == 3)
                {
                    deal.SecondMerchantCleanDeal = DealError.GetDealType(ref deal.SecondMerchantRandom, !AmICheatedTwice(deal.FirstMerchantId, deal.SecondMerchantId, false));
                }
                if (deal.FirstMerchantType == MerchantTypes.Uber && deal.Turn > 3)
                {
                    deal.FirstMerchantCleanDeal = DealError.GetDealType(ref deal.FirstMerchantRandom, !AmICheatedLast3Times(deal.Turn, deal.FirstMerchantId, deal.SecondMerchantId, true));
                }
                if (deal.SecondMerchantType == MerchantTypes.Uber && deal.Turn > 3)
                {
                    deal.SecondMerchantCleanDeal = DealError.GetDealType(ref deal.SecondMerchantRandom, !AmICheatedLast3Times(deal.Turn, deal.FirstMerchantId, deal.SecondMerchantId, false));
                }
            }).Run();
        }