public void OnQRCode(string content)
        {
            if (qr != null)
            {
                return;
            }

            bool blackList = QrScannerEffect.SelectionType == QRScannerEffect.ListType.BlackList;
            bool contained = QrScannerEffect.ValidIds.Contains(content);

            if ((blackList && !contained) || (!blackList && contained))
            {
                qr = Game.Instance.GameState.FindElement <QR>(content);
                if (qr != null && ConditionChecker.check(qr.Conditions))
                {// Si existe y además cumple las condiciones
                    // Mostramos el contenido y el resto de efectos
                    var effects = new Effects();
                    if (qr.Content != "")
                    {
                        effects.Add(new SpeakPlayerEffect(qr.Content));
                    }
                    foreach (var effect in qr.Effects.getEffects())
                    {
                        effects.Add(effect);
                    }

                    effectHolder = new EffectHolder(effects);
                    this.transform.GetChild(0).gameObject.SetActive(false);
                    Game.Instance.PulseOnTime(effectHolder.effects[0], 0);
                }
            }
        }
示例#2
0
        protected override void OnCompleteWork(Worker worker)
        {
            Storage component1 = GetComponent <Storage>();

            SimUtil.DiseaseInfo disease_info1;
            float aggregate_temperature;

            component1.ConsumeAndGetDisease(SimHashes.Ethanol.CreateTag(), champagneFiller.ethanolMassPerUse, out disease_info1, out aggregate_temperature);
            SimUtil.DiseaseInfo disease_info2;
            component1.ConsumeAndGetDisease(champagneFiller.ingredientTag, champagneFiller.ingredientMassPerUse, out disease_info2, out aggregate_temperature);
            GermExposureMonitor.Instance smi = worker.GetSMI <GermExposureMonitor.Instance>();
            if (smi != null)
            {
                smi.TryInjectDisease(disease_info1.idx, disease_info1.count, SimHashes.Ethanol.CreateTag(), Sickness.InfectionVector.Digestion);
                smi.TryInjectDisease(disease_info2.idx, disease_info2.count, champagneFiller.ingredientTag, Sickness.InfectionVector.Digestion);
            }
            Effects component2 = worker.GetComponent <Effects>();

            if (!string.IsNullOrEmpty(champagneFiller.specificEffect))
            {
                component2.Add(champagneFiller.specificEffect, true);
            }
            if (string.IsNullOrEmpty(champagneFiller.trackingEffect))
            {
                return;
            }
            component2.Add(champagneFiller.trackingEffect, true);
        }
示例#3
0
        private void ShouldMelancholy(Instance smi)
        {
            //TODO: проверки на начало меланхолии
            Effects effects = smi.master.GetComponent <Effects>();

            // меланхолия не нужна если есть траур
            // или отсутствуют могилы с трупами
            if (!effects.HasEffect(DeathPatches.MOURNING) && HasNonEmptyGrave())
            {
                if (!effects.HasEffect(DeathPatches.MELANCHOLY))
                {
                    float time   = smi.sm.timeFromLastMelancholy.Get(smi);
                    float chance = Mathf.InverseLerp(smi.def.timeFromLastMinInterval, smi.def.timeFromLastMaxInterval, time);
                    if (Random.value < chance)
                    {
                        // случайный период перед плаканием
                        effects.Add(DeathPatches.MELANCHOLY_TRACKING, true).timeRemaining *= Random.Range(0.3f, 0.6f);
                        effects.Add(DeathPatches.MELANCHOLY, true);
                    }
                }
            }
            else
            {
                ResetTime(smi);
            }
        }
示例#4
0
    private void UpdateWoundEffects()
    {
        if ((bool)effects)
        {
            switch (State)
            {
            case HealthState.Perfect:
                effects.Remove("LightWounds");
                effects.Remove("ModerateWounds");
                effects.Remove("SevereWounds");
                break;

            case HealthState.Alright:
                effects.Remove("LightWounds");
                effects.Remove("ModerateWounds");
                effects.Remove("SevereWounds");
                break;

            case HealthState.Scuffed:
                effects.Remove("ModerateWounds");
                effects.Remove("SevereWounds");
                if (!effects.HasEffect("LightWounds"))
                {
                    effects.Add("LightWounds", true);
                }
                break;

            case HealthState.Injured:
                effects.Remove("LightWounds");
                effects.Remove("SevereWounds");
                if (!effects.HasEffect("ModerateWounds"))
                {
                    effects.Add("ModerateWounds", true);
                }
                break;

            case HealthState.Critical:
                effects.Remove("LightWounds");
                effects.Remove("ModerateWounds");
                if (!effects.HasEffect("SevereWounds"))
                {
                    effects.Add("SevereWounds", true);
                }
                break;

            case HealthState.Incapacitated:
                effects.Remove("LightWounds");
                effects.Remove("ModerateWounds");
                effects.Remove("SevereWounds");
                break;

            case HealthState.Dead:
                effects.Remove("LightWounds");
                effects.Remove("ModerateWounds");
                effects.Remove("SevereWounds");
                break;
            }
        }
    }
 private void CheckDrowning(object data = null)
 {
     if (!drowned)
     {
         int cell = Grid.PosToCell(base.gameObject.transform.GetPosition());
         if (!IsCellSafe(cell))
         {
             if (!drowning)
             {
                 drowning = true;
                 Trigger(1949704522, null);
                 GetComponent <KPrefabID>().AddTag(GameTags.Creatures.Drowning, false);
             }
             if (timeToDrown <= 0f && canDrownToDeath)
             {
                 this.GetSMI <DeathMonitor.Instance>()?.Kill(Db.Get().Deaths.Drowned);
                 Trigger(-750750377, null);
                 drowned = true;
             }
         }
         else if (drowning)
         {
             drowning = false;
             GetComponent <KPrefabID>().RemoveTag(GameTags.Creatures.Drowning);
             Trigger(99949694, null);
         }
         if (livesUnderWater)
         {
             selectable.ToggleStatusItem(Db.Get().CreatureStatusItems.Saturated, drowning, this);
         }
         else
         {
             selectable.ToggleStatusItem(Db.Get().CreatureStatusItems.Drowning, drowning, this);
         }
         if ((UnityEngine.Object)effects != (UnityEngine.Object)null)
         {
             if (drowning)
             {
                 if (livesUnderWater)
                 {
                     effects.Add(saturatedEffect, false);
                 }
                 else
                 {
                     effects.Add(drowningEffect, false);
                 }
             }
             else if (livesUnderWater)
             {
                 effects.Remove(saturatedEffect);
             }
             else
             {
                 effects.Remove(drowningEffect);
             }
         }
     }
 }
    protected override void OnCompleteWork(Worker worker)
    {
        Effects component = worker.GetComponent <Effects>();

        if (!string.IsNullOrEmpty(trackingEffect))
        {
            component.Add(trackingEffect, true);
        }
        if (!string.IsNullOrEmpty(specificEffect))
        {
            component.Add(specificEffect, true);
        }
    }
示例#7
0
 private void BeginFirstStage()
 {
     if (currentStage == null)
     {
         float currCycle = GameClock.Instance.GetCycle();
         float currTime  = GameClock.Instance.GetTime();
         currentStage = new LifeStage(LifeStagePreset.FirstState);
         if (currentStage.BeginsOn <= currCycle)
         {
             Effect e = currentStage.GetEffect(currTime * -1);
             effects.Add(e, true);
             currentStage.Started = true;
         }
     }
 }
    private void DeliverHit()
    {
        Health component = target.GetComponent <Health>();

        if ((bool)component)
        {
            target.Trigger(-787691065, properties.attacker.GetComponent <FactionAlignment>());
            float          num        = rollDamage();
            AttackableBase component2 = target.GetComponent <AttackableBase>();
            num *= 1f + component2.GetDamageMultiplier();
            component.Damage(num);
            if (properties.effects != null)
            {
                Effects component3 = target.GetComponent <Effects>();
                if ((bool)component3)
                {
                    foreach (AttackEffect effect in properties.effects)
                    {
                        if (Random.Range(0f, 100f) < effect.effectProbability * 100f)
                        {
                            component3.Add(effect.effectID, true);
                        }
                    }
                }
            }
        }
    }
示例#9
0
文件: Key.cs 项目: ajay53/Forms
        public Key()
        {
            TouchEffect effect = new TouchEffect();

            effect.TouchAction += OnTouchEffectAction;
            Effects.Add(effect);
        }
示例#10
0
        protected virtual void Initialize()
        {
            if ((m_moodEffect = (EffectInteger)
                                (Effects.FirstOrDefault(x => x.EffectId == EffectsEnum.Effect_LivingObjectMood))) == null)
            {
                m_moodEffect = new EffectInteger(EffectsEnum.Effect_LivingObjectMood, 0);
                Effects.Add(m_moodEffect);
            }

            if ((m_selectedLevelEffect = (EffectInteger)
                                         (Effects.FirstOrDefault(x => x.EffectId == EffectsEnum.Effect_LivingObjectSkin))) == null)
            {
                m_selectedLevelEffect = new EffectInteger(EffectsEnum.Effect_LivingObjectSkin, 1);
                Effects.Add(m_selectedLevelEffect);
            }

            if ((m_experienceEffect = (EffectInteger)
                                      (Effects.FirstOrDefault(x => x.EffectId == EffectsEnum.Effect_LivingObjectLevel))) == null)
            {
                m_experienceEffect = new EffectInteger(EffectsEnum.Effect_LivingObjectLevel, 0);
                Effects.Add(m_experienceEffect);
            }


            if ((m_categoryEffect = (EffectInteger)
                                    (Effects.FirstOrDefault(x => x.EffectId == EffectsEnum.Effect_LivingObjectCategory))) != null)
            {
                return;
            }
            m_categoryEffect = new EffectInteger(EffectsEnum.Effect_LivingObjectCategory, (short)m_record.ItemType);
            Effects.Add(m_categoryEffect);

            OnObjectModified();
        }
        public HotDot(int id, string type, double hp, double mp, double amount, DotType method, int time, int tick,
                      string name, string itemName, string tooltip, string iconName)
        {
            Id = id;
            Types rType;

            rType = Enum.TryParse(type, out rType) ? rType : Types.Unknown;
            Hp    = hp;
            Mp    = mp;
            Time  = time;
            Tick  = tick;
            Effects.Add(new Effect
            {
                Type   = rType,
                Amount = amount,
                Method = method,
            });
            Name       = name;
            ShortName  = name;
            ItemName   = itemName;
            Tooltip    = tooltip;
            IconName   = iconName;
            Debuff     = (rType == Types.Endurance || rType == Types.CritResist) && amount <= 1 || rType == Types.Mark || (rType == Types.DefPotion && amount > 1);
            HPMPChange = rType == Types.HPChange || rType == Types.MPChange;
            Buff       = rType != Types.HPChange && rType != Types.MPChange;
        }
示例#12
0
    public void DefenceEffect()
    {
        CDefenceEffect Effect = new CDefenceEffect();

        Effect.Init(Time.fixedTime, 0.6f, gameObject);
        Effects.Add(Effect);
    }
示例#13
0
 public PickUpItem(ItemType item)
 {
     Item = item;
     Preconditions.Add(new Tuple <string, object>("HasItem", item), false);
     Effects.Add(new Tuple <string, object>("HasItem", item), true);
     Cost = 1;
 }
示例#14
0
 public BaseTabsPage()
 {
     // for android
     InitializeForAndroid();
     // add effect
     Effects.Add(new NoShiftEffect());
 }
        public Core()
        {
            TextureHandle bufferTexture = new TextureHandle();

            SingleBuffer buffer = new SingleBuffer();

            buffer.Load    = true;
            buffer.Texture = bufferTexture;
            Effects.Add(buffer);

            ClearScreen clear = new ClearScreen();

            clear.ClearColor = new Color(0, 0, 0, 0.085f);
            Effects.Add(clear);

            Effects.Add(new RandomMovement());

            Effects.Add(new CustomScope());
            Effects.Add(new OrangeScope());

            buffer         = new SingleBuffer();
            buffer.Load    = false;
            buffer.Texture = bufferTexture;
            Effects.Add(buffer);

            Effects.Add(new CircularMovement());
        }
示例#16
0
        public override void Destroy()
        {
            Health--;
            if (Health <= 0)
            {
                IsDestroyed  = true;
                IsInvincible = true;

                Polyline leftSegment  = generateExplosionGeometry(0, 1);
                Polyline rightSegment = generateExplosionGeometry(1, 2);
                Polyline rearSegment  = generateExplosionGeometry(3, 4);

                Point leftC = new Point(Center.X, Center.Y), leftT = new Point(Center.X - .1, Center.Y - .1);
                Point rightC = new Point(Center.X, Center.Y), rightT = new Point(Center.X + .1, Center.Y + .1);
                Point rearC = new Point(Center.X, Center.Y), rearT = new Point(Center.X, Center.Y + .1);

                Effect left  = new ExplodeEffect(leftC, leftT, 100, 1, leftSegment);
                Effect right = new ExplodeEffect(rightC, rightT, 101, 1, rightSegment);
                Effect rear  = new ExplodeEffect(rearC, rearT, 102, 1, rearSegment);
                Effects.Add(left);
                Effects.Add(right);
                Effects.Add(rear);

                AddToDisplay(left);
                AddToDisplay(right);
                AddToDisplay(rear);

                Geometry.Visibility = Visibility.Hidden;
                DestroyedTimer      = 150;
            }
        }
示例#17
0
        public EffectRepositoryItem(string name)
        {
            Name = name;

            // Add support for TLS 1.2, so that HTTPS connection to GitHub succeeds
            ServicePointManager.SecurityProtocol |= SecurityProtocolType.Tls12;

            var request = WebRequest.Create("https://api.github.com/repos/" + name + "/contents/Shaders") as HttpWebRequest;

            request.Accept    = "application/json";
            request.UserAgent = "reshade";
            request.AutomaticDecompression = DecompressionMethods.GZip;

            using (var response = request.GetResponse() as HttpWebResponse)
                using (Stream stream = response.GetResponseStream())
                    using (StreamReader reader = new StreamReader(stream))
                    {
                        string json = reader.ReadToEnd();

                        foreach (Match match in new Regex("\"name\":\"(.*?)\",").Matches(json))
                        {
                            string filename = match.Groups[1].Value;

                            if (Path.GetExtension(filename) == ".fx")
                            {
                                Effects.Add(new EffectItem
                                {
                                    Name   = match.Groups[1].Value,
                                    Path   = name + "/Shaders/" + filename,
                                    Parent = this
                                });
                            }
                        }
                    }
        }
示例#18
0
            public virtual void ReadChildData(BinaryReader reader)
            {
                int x = 0;

                for (x = 0; (x < _oldMaterialsDONOTUSE.Count); x = (x + 1))
                {
                    OldMaterialsDONOTUSE.Add(new OldMaterialEffectMaterialBlockBlock());
                    OldMaterialsDONOTUSE[x].Read(reader);
                }
                for (x = 0; (x < _oldMaterialsDONOTUSE.Count); x = (x + 1))
                {
                    OldMaterialsDONOTUSE[x].ReadChildData(reader);
                }
                for (x = 0; (x < _sounds.Count); x = (x + 1))
                {
                    Sounds.Add(new MaterialEffectMaterialBlockBlock());
                    Sounds[x].Read(reader);
                }
                for (x = 0; (x < _sounds.Count); x = (x + 1))
                {
                    Sounds[x].ReadChildData(reader);
                }
                for (x = 0; (x < _effects.Count); x = (x + 1))
                {
                    Effects.Add(new MaterialEffectMaterialBlockBlock());
                    Effects[x].Read(reader);
                }
                for (x = 0; (x < _effects.Count); x = (x + 1))
                {
                    Effects[x].ReadChildData(reader);
                }
            }
示例#19
0
 public ButtonItem()
 {
     _touchEff = new TouchEffect();
     Effects.Add(_touchEff);
     _touchEff.StateChanged += TouchStateChanged;
     TouchEffect.SetCommand(this, new Command(InternalExecuteCommand));
 }
示例#20
0
 public Eat(int itemLayer)
 {
     ActionLayer = itemLayer;
     if (ActionLayer == 7)
     {
         Preconditions.Add(GameState.State.itemBerry);
         coreCost = -200;//gotta eat! so "cost" is lowest. and berry is best thing to eat so eat that
     }
     if (ActionLayer == 9)
     {
         Preconditions.Add(GameState.State.itemFungus);
         coreCost = -50;
     }
     if (ActionLayer == 10)
     {
         Preconditions.Add(GameState.State.itemBerryPoop);
         coreCost = 30;//eating poop is pretty bad so try not to do it but if you got no other choice...
     }
     if (ActionLayer == 16)
     {
         Preconditions.Add(GameState.State.itemFungusPoop);
         coreCost = 30;//eating poop is pretty bad so try not to do it  but if you got no other choice...
     }
     //eating allows ALL goals. MUST STAY NOURISHED!!!!
     Effects.Add(GameState.State.goalEat);
     // Effects.Add(GameState.State.goalFollowPlayer);
     // Effects.Add(GameState.State.goalGatherFood);
     // Effects.Add(GameState.State.goalGatherShrooms);
     // Effects.Add(GameState.State.goalHelpOthers);
     // Effects.Add(GameState.State.goalAttackEnemies);
     // Effects.Add(GameState.State.goalAttackCow);
     Effects.Add(GameState.State.itemNone);
 }
示例#21
0
文件: HotDot.cs 项目: tuita520/Tera
        public HotDot(int id, string type, double hp, double mp, double amount, DotType method, uint time, int tick,
                      string name, string itemName, string tooltip, string iconName, AbnormalityType abType, bool isBuff, bool isShow, string effectIcon)
        {
            Id = id;
            Types rType;

            rType  = Enum.TryParse(type, out rType) ? rType : Types.Unknown;
            AbType = abType;
            IsBuff = isBuff;
            IsShow = isShow || id == 10152050;//BF counter
            Hp     = hp;
            Mp     = mp;
            Time   = time;
            Tick   = tick;
            Effects.Add(new Effect
            {
                Type   = rType,
                Amount = amount,
                Method = method,
            });
            Name       = name;
            ShortName  = name;
            ItemName   = itemName;
            Tooltip    = tooltip;
            IconName   = String.Intern(iconName);
            EffectIcon = String.Intern(effectIcon);
            Debuff     = rType == Types.Endurance || rType == Types.CritResist && amount <= 1 || rType == Types.Mark || (rType == Types.DefPotion && amount > 1);
            HPMPChange = rType == Types.HPChange || rType == Types.MPChange;
            Buff       = rType != Types.HPChange;// && rType != Types.MPChange;//try to show MPChange abnormals
        }
示例#22
0
        public GreenFlower()
        {
            Effects.Add(new RandomMovement());

            ClearScreen clear = new ClearScreen();

            clear.ClearColor = new Color(0, 0, 0, 0.14f);
            Effects.Add(clear);

            Scope scope = new Scope();

            scope.Color     = new Color(0, 1, 0.06f, 0.5f);
            scope.LineWidth = 5;
            scope.Circular  = true;
            Effects.Add(scope);

            Effects.Add(new DiscMovement());

            BurstScope bscope = new BurstScope();

            bscope.Rays        = 128;
            bscope.Mode        = BurstScope.ColorMode.RayRandom;
            bscope.Sensitivity = 0.5f;
            bscope.MinRaySpeed = 0.1f;
            bscope.MaxRaySpeed = 0.15f;
            bscope.Wander      = 5;
            bscope.Rotate      = 0;
            Effects.Add(bscope);

            Mirror mirror = new Mirror();

            mirror.HorizontalMirror = Mirror.HorizontalMirrorType.RightToLeft;
            mirror.VerticalMirror   = Mirror.VerticalMirrorType.BottomToTop;
            Effects.Add(mirror);
        }
示例#23
0
 public DeliverIngredientAction(Ingredient ingredient)
 {
     _ingredient = ingredient;
     Preconditions.Add("isCarrying", _ingredient);
     Effects.Add(_ingredient + "Delivered", true);
     Effects.Add("isCarrying", Ingredient.None);
 }
示例#24
0
文件: Monster.cs 项目: madinsane/EREG
 public override void AddStatus(Constants.StatusTypes type, int statusPower, int duration = 2)
 {
     if (Effects == null)
     {
         Effects = new List <Effect>();
     }
     RemoveStatus();
     Effects.Add(new Effect(Constants.EffectType.Status, Constants.BuffTypes.None, type, statusPower, duration));
     if (type == Constants.StatusTypes.Berserk || type == Constants.StatusTypes.Confuse)
     {
         if (type == Constants.StatusTypes.Berserk)
         {
             Stats.AttackDefense /= Constants.BERSERK_MODIFIER;
             Stats.AttackPower   /= Constants.BERSERK_MODIFIER;
             Stats.MagicDefense  /= Constants.BERSERK_MODIFIER;
             unitManager.log.Add(NameStr + " Berserks");
         }
         else
         {
             Stats.Accuracy /= Constants.CONFUSE_MODIFIER;
             Stats.Evasion  /= Constants.CONFUSE_MODIFIER;
             unitManager.log.Add(NameStr + " is Confused");
         }
     }
     ColorChange();
 }
示例#25
0
    public void ParringEffect()
    {
        CParringEffect Effect = new CParringEffect();

        Effect.Init(Time.fixedTime, 0.3f, gameObject);
        Effects.Add(Effect);
    }
示例#26
0
 protected override void OnStopWork(Worker worker)
 {
     base.OnStopWork(worker);
     if ((Object)operational != (Object)null)
     {
         operational.SetActive(false, false);
     }
     if ((Object)worker != (Object)null)
     {
         Effects component = worker.GetComponent <Effects>();
         component.Remove(effectName);
         if (wakeEffects != null)
         {
             foreach (string wakeEffect in wakeEffects)
             {
                 component.Add(wakeEffect, true);
             }
         }
         if (stretchOnWake && Random.value < 0.33f)
         {
             new EmoteChore(worker.GetComponent <ChoreProvider>(), Db.Get().ChoreTypes.EmoteHighPriority, "anim_react_morning_stretch_kanim", new HashedString[1]
             {
                 "react"
             }, null);
         }
         if (worker.GetAmounts().Get(Db.Get().Amounts.Stamina).value < worker.GetAmounts().Get(Db.Get().Amounts.Stamina).GetMax())
         {
             worker.Trigger(1338475637, this);
         }
     }
 }
示例#27
0
 public void RegisterType(Type target, StaticRegistrationInfoAttribute info) {
     if (target.HasBase(typeof(GraphicEffect))) {
         foreach (var name in AssemblyRegister.GetInfo(target)) {
             Effects.Add(name.Name, target);
         }
     }
 }
示例#28
0
文件: PetItem.cs 项目: Mixi59/Stump
        private void InitializeEffects()
        {
            // new item
            if (Effects.OfType <EffectInteger>().All(x => x.EffectId != MealCountEffect))
            {
                Effects.RemoveAll(x => x.EffectId == EffectsEnum.Effect_LifePoints ||
                                  x.EffectId == EffectsEnum.Effect_LastMeal ||
                                  x.EffectId == EffectsEnum.Effect_LastMealDate ||
                                  x.EffectId == EffectsEnum.Effect_Corpulence);

                Effects.Add(LifePointsEffect = new EffectInteger(EffectsEnum.Effect_LifePoints, (short)MaxLifePoints));
                Effects.Add(new EffectInteger(EffectsEnum.Effect_MealCount, 0));

                Corpulence = 0;

                m_monsterKilledEffects = new Dictionary <int, EffectDice>();

                foreach (var monsterEffect in Effects.Where(x => x.EffectId == EffectsEnum.Effect_MonsterKilledCount).ToArray())
                {
                    Effects.Remove(monsterEffect);
                }
            }
            else
            {
                LifePointsEffect   = Effects.OfType <EffectInteger>().First(x => x.EffectId == EffectsEnum.Effect_LifePoints);
                LastMealDateEffect = Effects.OfType <EffectDate>().FirstOrDefault(x => x.EffectId == EffectsEnum.Effect_LastMealDate);
                LastMealEffect     = Effects.OfType <EffectInteger>().FirstOrDefault(x => x.EffectId == EffectsEnum.Effect_LastMeal);
                CorpulenceEffect   = Effects.OfType <EffectDice>().FirstOrDefault(x => x.EffectId == EffectsEnum.Effect_Corpulence);

                m_monsterKilledEffects = Effects.OfType <EffectDice>().Where(x => x.EffectId == EffectsEnum.Effect_MonsterKilledCount).DistinctBy(x => x.DiceNum).ToDictionary(x => (int)x.DiceNum);
                UpdateCorpulence();
            }
        }
    protected override void OnCompleteWork(Worker worker)
    {
        if (!string.IsNullOrEmpty(info.effect))
        {
            Effects        component      = worker.GetComponent <Effects>();
            EffectInstance effectInstance = component.Get(info.effect);
            if (effectInstance != null)
            {
                effectInstance.timeRemaining = effectInstance.effect.duration;
            }
            else
            {
                component.Add(info.effect, true);
            }
        }
        Sicknesses sicknesses = worker.GetSicknesses();

        foreach (string curedSickness in info.curedSicknesses)
        {
            SicknessInstance sicknessInstance = sicknesses.Get(curedSickness);
            if (sicknessInstance != null)
            {
                Game.Instance.savedInfo.curedDisease = true;
                sicknessInstance.Cure();
            }
        }
        base.gameObject.DeleteObject();
    }
示例#30
0
        readonly Timer PetTimer; //This timer will check if no touch action is used in the last 5 seconds. Any touch interaction will reset this timer

        public PetContainer(Pet pet)
        {
            //This changes the dimensions of the box size to match the page height and width.
            AbsoluteLayout.SetLayoutBounds(this, new Rectangle(0, 0, 1, 1));
            AbsoluteLayout.SetLayoutFlags(this, AbsoluteLayoutFlags.All);
            //Opacity = 0.25;//Remove when finalising
            //Color = Color.Black;//Remove when finalising
            HorizontalOptions = LayoutOptions.FillAndExpand;
            VerticalOptions   = LayoutOptions.FillAndExpand;

            //Variable initialisation
            CurrentPet     = pet;
            New_Position_X = 0;
            New_Position_Y = 0;

            UpdatePetStates();

            //Allow for touch input
            TouchEffect effect = new TouchEffect();

            effect.TouchAction += OnTouchEffectAction;
            Effects.Add(effect);

            PetTimer           = new Timer(5 * 1000);//5 Seconds
            PetTimer.Elapsed  += Step;
            PetTimer.AutoReset = true;
            PetTimer.Stop();
            PetTimer.Start();
        }