Beispiel #1
0
        protected override void OnCreate()
        {
            base.OnCreate();

            if (Character != null)
            {
                var scene = CreateScene(false);
                scene.DisplayPhysicalObjects = true;

                instanceInScene = (Component_Character)Character.Clone();
                scene.AddComponent(instanceInScene);

                scene.Enabled = true;

                if (Document != null)
                {
                    Document.UndoSystem.ListOfActionsChanged += UndoSystem_ListOfActionsChanged;
                }

                if (ObjectOfEditor != null)
                {
                    SelectObjects(new object[] { ObjectOfEditor });
                }
            }
        }
Beispiel #2
0
        protected override void OnViewportUpdateBeforeOutput()
        {
            base.OnViewportUpdateBeforeOutput();

            if (Character != null && needRecreateInstance)
            {
                instanceInScene?.Dispose();

                instanceInScene = (Component_Character)Character.Clone();
                Scene.AddComponent(instanceInScene);

                needRecreateInstance = false;
            }
        }
        public void GetWeapon(Component_Scene sc, Component_Character chr, bool hasWeapon)
        {
            var wpn = (Component_Weapon)sc?.GetComponentByPath("Weapon");

            if (hasWeapon)
            {
                chr.ItemTake(wpn);
                chr.ItemActivate(wpn);
            }
            else
            {
                if (chr.ItemGetEnabledFirst() != null)
                {
                    chr.ItemDrop(chr.ItemGetEnabledFirst());
                }
            }
        }