Inheritance: MarshalByRefObject
Beispiel #1
0
        /// <summary>
        /// Resets the properties value.
        /// </summary>
        public void Reset()
        {
            if (IsSet)
            {
                propertyInfo.ResetValue(parentObject.Instance);
                ResetInternal();

                ParentObject.OnPropertyChanged(this);

                if (IsSetChanged != null)
                {
                    IsSetChanged(this, EventArgs.Empty);
                }
                if (ValueChanged != null)
                {
                    ValueChanged(this, EventArgs.Empty);
                }
            }
        }
        void StopMoveAnimation()
        {
            if (m_locomotor_component.IsAnimationBlocked)
            {
                return;
            }
            AnimationComponent animation_component = ParentObject.GetComponent(AnimationComponent.ID) as AnimationComponent;

            if (animation_component != null)
            {
                animation_component.PlayerAnimation(AnimationName.IDLE, true);
            }
            AnimatorComponent animator_component = ParentObject.GetComponent(AnimatorComponent.ID) as AnimatorComponent;

            if (animator_component != null)
            {
                animator_component.PlayAnimation(AnimationName.IDLE);
            }
        }
        public GameObject CreateSeed()
        {
            if (Seed != null)
            {
                return(GameObject.create(Seed));
            }
            GameObject   seed     = GameObject.create("Seed");
            acegiak_Seed seedpart = seed.GetPart <acegiak_Seed>();

            seedpart.Result          = ParentObject.GetBlueprint().Name;
            seedpart.ResultName      = ParentObject.GetBlueprint().DisplayName().Replace(" Tree", "");
            seedpart.displayname     = "seed";
            seedpart.description     = "A seed from " + ParentObject.a + ParentObject.DisplayNameOnly + ".";
            seed.pRender.DisplayName = seedpart.ResultName + " " + seedpart.displayname;
            seed.pRender.ColorString = ParentObject.pRender.ColorString;
            seed.pRender.TileColor   = ParentObject.pRender.TileColor;
            seed.pRender.DetailColor = ParentObject.pRender.DetailColor;
            return(seed);
        }
        public override void Awake()
        {
            Parent = ReinterpretObject <DatabaseObject>(ParentObject);
            SynchronizedContexts = new ConcurrentDictionary <int, DatabaseContext>();
            RemovableIdentifiers = new ConcurrentStack <int>();

            var visualUpdater = ParentObject.GetComponent <DatabaseVisualUpdaterComponent>();

            if (visualUpdater != null)
            {
                visualUpdater.AddUpdatabableControl(new UpdatableControl("SyncContextsInfoLabel", (control) =>
                {
                    control.Text = $"Synchronized contexts: {SynchronizedContexts.Count}";
                }));

                visualUpdater.AddUpdatabableControl(new UpdatableControl("QueriesProgress", (control) =>
                {
                    if (control is Guna2ProgressBar progress)
                    {
                        progress.Maximum = Settings.Read <int>("max_queries_limiter", "statistics");
                        progress.Value   = CurrentQueriesSummaryInfo;
                    }
                }));
                visualUpdater.AddUpdatabableControl(new UpdatableControl("QueriesCountLabel", (control) =>
                {
                    control.Text = $"{CurrentQueriesSummaryInfo} / {Settings.Read<int>("max_queries_limiter", "statistics")}";
                }));

                visualUpdater.AddUpdatabableControl(new UpdatableControl("AccessesProgress", (control) =>
                {
                    if (control is Guna2ProgressBar progress)
                    {
                        progress.Maximum = Settings.Read <int>("max_accesses_limiter", "statistics");
                        progress.Value   = CurrentAccessesSummaryInfo;
                    }
                }));
                visualUpdater.AddUpdatabableControl(new UpdatableControl("AccessesCountLabel", (control) =>
                {
                    control.Text = $"{CurrentAccessesSummaryInfo} / {Settings.Read<int>("max_accesses_limiter", "statistics")}";
                }));
            }
        }
Beispiel #5
0
        public bool SmokeThis(GameObject who, bool FromDialog)
        {
            string     verb         = "take";
            string     preposition  = "a puff on";
            GameObject parentObject = ParentObject;
            bool       fromDialog   = FromDialog;

            IPart.XDidYToZ(who, verb, preposition, parentObject);
            for (int i = 2; i < 5; i++)
            {
                ParentObject.Smoke(150, 180);
            }
            // if (who.IsPlayer())
            // {
            //  MetricsManager.LogEvent("HookahsSmoked");
            // }
            who.UseEnergy(1000, "Item");
            who.FireEvent(Event.New("Smoked", "Object", ParentObject));
            return(true);
        }
        void PlayMoveAnimation(Vector3 direction)
        {
            if (m_locomotor_component.IsAnimationBlocked)
            {
                return;
            }
            m_model_component.SetBaseAngle(Mathf.Atan2(-direction.z, direction.x) * 180 / Mathf.PI);
            AnimationComponent animation_component = ParentObject.GetComponent(AnimationComponent.ID) as AnimationComponent;

            if (animation_component != null)
            {
                animation_component.PlayerAnimation(animation_component.LocomotorAnimationName, true);
            }
            AnimatorComponent animator_component = ParentObject.GetComponent(AnimatorComponent.ID) as AnimatorComponent;

            if (animator_component != null)
            {
                animator_component.PlayAnimation(animator_component.LocomotorAnimationName);
            }
        }
Beispiel #7
0
        public override bool FireEvent(Event E)
        {
            if (E.ID == "AttackerGetWeaponPenModifier")
            {
                if (E.HasParameter("Properties") && E.GetStringParameter("Properties") != null && E.GetStringParameter("Properties").Contains("Charging") && E.HasParameter("Hand") && E.GetStringParameter("Hand") == "Primary")
                {
                    E.SetParameter("PenBonus", E.GetIntParameter("PenBonus") + 1);
                    E.SetParameter("CapBonus", E.GetIntParameter("CapBonus") + 1);
                }
            }

            if (E.ID == "GetShortDescription")
            {
                if (ParentObject.GetPart <acegiak_ModExtended>() == null)
                {
                    E.SetParameter("Postfix", E.GetParameter("Postfix") + "\n&CPolearm: Can be used to fight with additional reach.");
                }
            }
            return(base.FireEvent(E));
        }
Beispiel #8
0
        public void HandleEggHatching()
        {
            {
                // string Hatched = "Crack!";
                OvipositorHandler = ParentObject;

                GameObject Droneling = Cloning.GenerateClone(Mother, C: currentCell);
                var        CheckOvi  = Droneling.GetPart <Mutations>();
                var        GetOvi    = CheckOvi.GetMutation("Ovipositor");
                CheckOvi.RemoveMutation(GetOvi);
                Droneling.DisplayName = Names.MutantNameMaker.MakeMutantName();
                Droneling.GetPart <Description>().Short = "One of your loyal drones.";
                Droneling.RemoveIntProperty("ProperNoun");
                // ParentObject.ParticleText(Hatched, 1.0f, 1, false);
                ParentObject.ReplaceWith(Droneling);

                int PlaceHolder = 300;
                IncubationPeriodDuration = PlaceHolder;
            }
        }
Beispiel #9
0
        public override bool Mutate(GameObject GO, int Level)
        {
            Mutations GainPSiFocus = GO.GetPart <Mutations>();

            if (!GainPSiFocus.HasMutation("FocusPsi"))
            {
                GainPSiFocus.AddMutation("FocusPsi", 1);
            }
            if (!ParentObject.HasPart("ShimmeringShroudHandler"))
            {
                ParentObject.AddPart <ShimmeringShroudHandler>();
            }
            ActivateShimmeringShroudAbilityID = base.AddMyActivatedAbility("Activate Shroud", "CommandShimmeringShroud", "Mental Mutation", null, "*", null, false, false, false, false, false);
            ChargePotentialAbilityID          = base.AddMyActivatedAbility("Charge Potential", "CommandChargePotencyShroud", "Mental Mutation", null, "*", null, true, false, true, false, false);
            PotencyForChargesAbility          = base.AddMyActivatedAbility("Recharge Battery", "ChargeBatteryEvent", "Electrokinesis", null, "~", null, false, false, true, false, false);
            ElectrokinesisGauge = base.AddMyActivatedAbility("Electrokinesis", "ElectroToggleEvent", "Mutation");

            this.ChangeLevel(Level);
            return(base.Mutate(GO, Level));
        }
        public void UpdateCounter()
        {
            try
            {
                var MMAAccess       = ParentObject.GetPart <WM_MMA_PathDawnGlider>();
                int SureStrikeBonus = MMAAccess.BonusSureStrike;

                var AA = MyActivatedAbility(this.SureStrikesActivatedAbilityID);

                if (AA != null && SureStrikeBonus <= 0)
                {
                    AA.DisplayName = "{{white|Sure Strikes}}";
                }
                else
                {
                    AA.DisplayName = "{{yellow|Sure Strikes x(" + (SureStrikeBonus) + ")}}";
                }
            }
            catch { }
        }
 public bool GrantsWater(GameObject Who, bool DoPopup = true)
 {
     if (GetFactionReputationFeeling(Who) < UnfriendlyRepThreshold)
     {
         if (DoPopup && Who.IsPlayer())
         {
             Popup.Show(ParentObject.The + ParentObject.DisplayNameOnlyDirect + "&y" + ParentObject.GetVerb("recognize") + " your hostility towards slimes and refuses you access to its water.");
         }
         return(false);
     }
     if ((ParentObject.GetPart("LiquidVolume") as LiquidVolume).Volume == 0)
     {
         if (DoPopup && Who.IsPlayer())
         {
             Popup.Show(ParentObject.The + ParentObject.DisplayNameOnlyDirect + "&y" + ParentObject.GetVerb("has") + " no more fresh water for you to drink.");
         }
         return(false);
     }
     return(true);
 }
        FixPoint CalculateFinalDamageAmount(Damage damage, Entity attacker)
        {
            FixPoint damage_amount = damage.m_damage_amount;

            if (attacker != null)
            {
                DamageModificationComponent attacker_cmp = attacker.GetComponent(DamageModificationComponent.ID) as DamageModificationComponent;
                if (attacker_cmp != null)
                {
                    damage_amount = attacker_cmp.ApplyModifiersToDamage(damage, damage_amount, ParentObject, true);
                }
            }
            DamageModificationComponent self_cmp = ParentObject.GetComponent(DamageModificationComponent.ID) as DamageModificationComponent;

            if (self_cmp != null)
            {
                damage_amount = self_cmp.ApplyModifiersToDamage(damage, damage_amount, attacker, false);
            }
            return(damage_amount);
        }
Beispiel #13
0
        //********描画時のリソース変更********//
        internal override void ChangeResourceOnDraw(AdvGraphicInfo graphic, float fadeTime)
        {
            Material = graphic.RenderTextureSetting.GetRenderMaterialIfEnable(Material);

            //既に描画されている場合は、クロスフェード用のイメージを作成
            bool crossFade = TryCreateCrossFadeImage(fadeTime, graphic);

            if (!crossFade)
            {
                ReleaseCrossFadeReference();
                this.gameObject.RemoveComponent <UguiCrossFadeRawImage>();
            }
            //新しくリソースを設定
            RawImage.texture = graphic.File.Texture;
            RawImage.SetNativeSize();
            if (!crossFade)
            {
                ParentObject.FadeIn(fadeTime, () => { });
            }
        }
Beispiel #14
0
        void OnCollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
        {
            // If implicit collection that is now empty we remove markup for the property if still there.
            if (collectionElements.Count == 0 && propertyValue == null && _propertyElement != null)
            {
                _propertyElement.ParentNode.RemoveChild(_propertyElement);
                _propertyElement = null;

                ParentObject.OnPropertyChanged(this);

                if (IsSetChanged != null)
                {
                    IsSetChanged(this, EventArgs.Empty);
                }
                if (ValueChanged != null)
                {
                    ValueChanged(this, EventArgs.Empty);
                }
            }
        }
        public void ChainFuntion()
        {
            var MMAAccess = ParentObject.GetPart <WM_MMA_CombinationStrikesI>();
            var ParentAgi = ParentObject.StatMod("Agility");

            AwardSureStrikes = ParentAgi;
            var Attacker = _ParentObject;

            if (Stat.Random(1, 100) <= 20 + (MMAAccess.CurrentComboICounter * 2))
            {
                --AwardSureStrikes;
                // AddPlayerMessage("inititate chaining strike event");
                Attacker.FireEvent(Event.New("ChainingSureStrikes", "Defender", eDefender, "Attacker", Attacker));
            }
            else
            {
                --AwardSureStrikes;
                Attacker.FireEvent(Event.New("FailedChainingSureStrikes", "Defender", eDefender, "Attacker", Attacker));
            }
        }
 public override bool AddSkill(GameObject GO)
 {
     if (!ParentObject.HasPart("KO_On_Finish"))
     {
         // AddPlayerMessage("AddingKOPart from Skill Tree");
         ParentObject.AddPart <KO_On_Finish>();
         // AddPlayerMessage("Part KO added to " + ParentObject);
     }
     if (!ParentObject.HasPart("MartialBody"))
     {
         // AddPlayerMessage("Adding MartialbodPart from Skill Tree");
         ParentObject.AddPart <MartialBody>();
         // AddPlayerMessage("Part MB added to " + ParentObject);
     }
     if (!ParentObject.HasSkill("WM_MMA_MartialConI"))
     {
         ParentObject.AddSkill("WM_MMA_MartialConI");
     }
     return(true);
 }
Beispiel #17
0
        public override bool FireEvent(Event E)
        {
            if (E.ID == "UpdateFistProperties")
            {
                // AddPlayerMessage("Updating fist?");
                MeleeWeapon FistProperties = this.ParentObject.GetPart("MeleeWeapon") as MeleeWeapon;

                FistProperties.BaseDamage = (string)E.GetParameter("Dice");

                if (!ParentObject.HasPart("KO_On_Finish"))
                {
                    ParentObject.AddPart <KO_On_Finish>();

                    // AddPlayerMessage("Part added to " + ParentObject);
                }

                // AddPlayerMessage(FistProperties.BaseDamage);
            }
            return(base.FireEvent(E));
        }
Beispiel #18
0
        public override bool FireEvent(Event E)
        {
            if (E.ID == "EntityHasSwappedBodies")
            {
                if (!ParentObject.HasSkill("Survival"))
                {
                    ParentObject.AddSkill("Survival");
                    if (!ParentObject.HasSkill("Survival_Camp"))
                    {
                        ParentObject.AddSkill("Survival_Camp");
                    }
                }
                if (IsOriginalEntity == false)
                {
                    IsOriginalEntity = true;
                }
            }

            return(base.FireEvent(E));
        }
        protected override void PostInitializeComponent()
        {
            m_model_component = ParentObject.GetComponent(ModelComponent.ID) as ModelComponent;
            if (m_model_component == null)
            {
                return;
            }
            GameObject go = m_model_component.GetUnityGameObject();

            if (go == null)
            {
                return;
            }
            m_interpolation_tr = go.transform;
            m_model_component.SetPredictComponent(this);
            Entity entity = GetLogicEntity();

            m_position_component  = entity.GetComponent(PositionComponent.ID) as PositionComponent;
            m_locomotor_component = entity.GetComponent(LocomotorComponent.ID) as LocomotorComponent;
        }
Beispiel #20
0
        public void EventBubblingChildObjectInAList()
        {
            //same situation but now with a child in a list
            ParentObject parent      = new ParentObject();
            int          changeCount = 0;

            //add the child in a list
            ChildObject child = new ChildObject();

            parent.Children.Add(child);

            Post.Cast <ParentObject, INotifyPropertyChanged>(parent).PropertyChanged +=
                delegate(object sender, PropertyChangedEventArgs e)
            {
                Assert.AreEqual("Name", e.PropertyName);
                changeCount++;
            };
            child.Name = "newName";
            Assert.AreEqual(1, changeCount);
        }
Beispiel #21
0
        //********描画時のリソース変更********//
        internal override void ChangeResourceOnDraw(AdvGraphicInfo graphic, float fadeTime)
        {
            //既に描画されている場合は、クロスフェード用のイメージを作成
            bool crossFade = TryCreateCrossFadeImage(fadeTime, graphic);

            if (!crossFade)
            {
                ReleaseTemporary();
            }
            //新しくリソースを設定
            RawImage.texture = RenderTextureSpace.RenderTexture;
            var setting = RenderTextureSpace.Setting;

            RawImage.rectTransform.SetWidth(setting.RenderTextureSize.x / setting.RenderTextureScale);
            RawImage.rectTransform.SetHeight(setting.RenderTextureSize.y / setting.RenderTextureScale);
            if (!crossFade && LastResource == null)
            {
                ParentObject.FadeIn(fadeTime);
            }
        }
Beispiel #22
0
        public override bool Unmutate(GameObject GO)
        {
            try
            {
                Body SourceBody = GO.GetPart <Body>();
                if (SourceBody != null)
                {
                    var body = ParentObject.GetPart <Body>();
                    var core = body.GetBody();
                    var tail = core.GetFirstPart("Tail");
                    tail.Equipped.ForceUnequipAndRemove();
                    core.RemovePart(tail);
                }
            }
            catch
            {
            }

            return(base.Unmutate(GO));
        }
Beispiel #23
0
        void SetPropertyValue(XamlPropertyValue value)
        {
            // Binding...
            //if (IsCollection) {
            //    throw new InvalidOperationException("Cannot set the value of collection properties.");
            //}

            bool wasSet = this.IsSet;

            PossiblyNameChanged(propertyValue, value);

            //reset expression
            var xamlObject = propertyValue as XamlObject;

            if (xamlObject != null && xamlObject.IsMarkupExtension)
            {
                propertyInfo.ResetValue(parentObject.Instance);
            }

            ResetInternal();

            propertyValue = value;
            propertyValue.ParentProperty = this;
            propertyValue.AddNodeTo(this);
            UpdateValueOnInstance();

            ParentObject.OnPropertyChanged(this);

            if (!wasSet)
            {
                if (IsSetChanged != null)
                {
                    IsSetChanged(this, EventArgs.Empty);
                }
            }

            if (ValueChanged != null)
            {
                ValueChanged(this, EventArgs.Empty);
            }
        }
Beispiel #24
0
        public void Harness(GameObject harnesser, GameObject harnessee)
        {
            IPart.AddPlayerMessage(harnesser.It + harnesser.GetVerb("attempt") + " to harness " + harnessee.the + harnessee.ShortDisplayName + " with the saddle!");

            if (harnessee.pBrain != null)
            {
                harnessee.pBrain.AdjustFeeling(harnesser, -100);
            }
            if (harnessee.MakeSave("Strength", 8, harnesser, "Strength", "Saddle Harness"))
            {
                IPart.AddPlayerMessage(harnessee.The + harnessee.ShortDisplayName + harnessee.GetVerb("avoid") + " the saddle harness!");
            }
            else
            {
                ParentObject.ForceUnequipAndRemove(true);
                harnessee.ForceEquipObject(ParentObject, "Riding", true);
                IPart.AddPlayerMessage(harnesser.It + harnesser.GetVerb("harness") + " " + harnessee.the + harnessee.ShortDisplayName + " with the saddle!");

                harnessee.ParticleText("*" + harnessee.ShortDisplayName + " Harnessed*");
            }
        }
        public void Check()
        {
            if (ParentObject.HasPart(typeof(Brain)))
            {
                var conversationScript =
                    ParentObject.GetPart <ConversationScript>();

                if (conversationScript == null)
                {
                    ParentObject.AddPart(
                        new ConversationScript(ConversationID)
                        );
                }
                else
                {
                    conversationScript.ConversationID = ConversationID;
                }

                ParentObject.RemovePart(this);
            }
        }
        public bool Store()
        {
            var zone = ParentObject.CurrentZone;

            foreach (var obj in zone.GetObjects())
            {
                if (obj.IsPlayerLed() || obj.HasEffect <SummonedEffect>())
                {
                    obj.CurrentCell.RemoveObject(obj);
                    obj.MakeInactive();
                    storage.Add(obj);
                }
            }

            CooldownMyActivatedAbility(activatedAbilityId, cooldown);
            ParentObject.UseEnergy(turnCost, $"Skill {name}");

            Mod.Debug($"Stored {storage.Count}: {string.Join(",", storage.Select(x => x.DebugName))}");

            return(true);
        }
Beispiel #27
0
        public virtual void generateRecoilerPartonObject()
        {
            List <JournalMapNote> mapNotes = JournalAPI.GetMapNotes((JournalMapNote note) => note.Has("ruins") || note.Has("historic"));

            if (mapNotes.Count > 0)
            {
                //MessageQueue.AddPlayerMessage($"Adding Recoilondeath part!");
                ZoneManager    zoneManager   = XRLCore.Core.Game.ZoneManager;
                JournalMapNote randomElement = mapNotes.GetRandomElement();
                RecoilOnDeath  teleporter    = ParentObject.RequirePart <RecoilOnDeath>();

                Zone        destinationZone     = zoneManager.GetZone(randomElement.zoneid);
                List <Cell> emptyReachableCells = destinationZone.GetEmptyReachableCells();
                Cell        destinationcell     = ((emptyReachableCells.Count <= 0) ? destinationZone.GetCell(40, 20) : emptyReachableCells.GetRandomElement());

                teleporter.DestinationZone = randomElement.zoneid;
                teleporter.DestinationX    = destinationcell.X;
                teleporter.DestinationY    = destinationcell.Y;
                //MessageQueue.AddPlayerMessage($"DestinationZone: {randomElement.zoneid}!");
            }
        }
Beispiel #28
0
        public void domutate()
        {
            int roll = Stat.Random(1, 100);

            //IPart.AddPlayerMessage("Titroll:"+roll.ToString()+"/"+Chance.ToString());
            if (roll <= Chance)
            {
                Mutations mutations = ParentObject.GetPart("Mutations") as Mutations;
                if (mutations == null)
                {
                    //IPart.AddPlayerMessage("Can mutate, no mutations part");
                    return;
                }
                if (!MutationFactory.MutationsByName.ContainsKey(Mutation))
                {
                    //IPart.AddPlayerMessage("Mutation "+Mutation+" isn't recognised");
                }
                mutations.AddMutation(MutationFactory.MutationsByName[Mutation].CreateInstance(), Level);
                //IPart.AddPlayerMessage("mutated");
            }
        }
 public override bool FireEvent(Event E)
 {
     //...
     if (E.ID == "BeginMove")
     {
         Cell Cell = E.GetParameter("DestinationCell") as Cell;
         if (Cell.HasObject(X => WaterThatHurts.Contains(X.Blueprint)) && !ParentObject.HasEffect("Dissolving") && ParentObject.IsPlayer())
         {
             if (Popup.ShowYesNo("This liquid is harmful to you, continue") != 0)
             {
                 AutoAct.Interrupt();
                 return(false);
             }
             else
             {
             }
         }
     }
     //...
     return(base.FireEvent(E));
 }
Beispiel #30
0
        public override bool FireEvent(Event E)
        {
            if (E.ID == "Dropped")
            {
                boot = true;
            }

            if (E.ID == "EnteredCell" && boot)
            {
                boot = false;
                if (ParentObject.GetPart <Brain>() == null)
                {
                    return(false);
                }

                ParentObject.GetPart <Brain>().PerformReequip();

                ParentObject.GetPart <Brain>().BecomeCompanionOf(ParentObject.ThePlayer);
                ParentObject.GetPart <Brain>().IsLedBy(ParentObject.ThePlayer);
                ParentObject.GetPart <Brain>().SetFeeling(ParentObject.ThePlayer, 100);
                ParentObject.GetPart <Brain>().Goals.Clear();
                ParentObject.GetPart <Brain>().Calm        = false;
                ParentObject.GetPart <Brain>().Hibernating = false;
                ParentObject.GetPart <Brain>().FactionMembership.Clear();

                ParentObject.AddPart(new Combat());

                XRLCore.Core.Game.ActionManager.AddActiveObject(ParentObject);
            }
            if (E.ID == "GetShortDescription")
            {
                string str = "\n&CAwoken: This corpse has been reanimated with cybernetic technologies.";
                E.SetParameter("Postfix", E.GetStringParameter("Postfix") + str);
            }
            else if ((E.ID == "GetDisplayName" || E.ID == "GetShortDisplayName") && (!ParentObject.Understood() || !ParentObject.HasProperName))
            {
                E.GetParameter <StringBuilder>("Prefix").Append("awoken ");
            }
            return(base.FireEvent(E));
        }