コード例 #1
0
        public static GameObject CreateFromData(DoorComponent component)
        {
            var go = Instantiate(Resources.Load <GameObject>("Prefabs/Windows/Editor/MapModelEditor/DoorMapModelEditor"), GameObject.Find("GlobalCanvas").transform);

            go.GetComponent <DoorMapModelEditor>().ConfigureFromData(component);
            return(go);
        }
コード例 #2
0
 public DoorComponentState(DoorComponent door)
 {
     DoorState         = door.State;
     CurrentlyCrushing = door.CurrentlyCrushing;
     NextStateChange   = door.NextStateChange;
     Partial           = door.Partial;
 }
コード例 #3
0
    /// <summary>
    ///     Pry open a door. This does not check if the user is holding the required tool.
    /// </summary>
    private bool TryPryDoor(EntityUid target, EntityUid tool, EntityUid user, DoorComponent door)
    {
        if (door.State == DoorState.Welded)
        {
            return(false);
        }

        var canEv = new BeforeDoorPryEvent(user);

        RaiseLocalEvent(target, canEv, false);

        if (canEv.Cancelled)
        {
            // mark handled, as airlock component will cancel after generating a pop-up & you don't want to pry a tile
            // under a windoor.
            return(true);
        }

        var modEv = new DoorGetPryTimeModifierEvent();

        RaiseLocalEvent(target, modEv, false);

        _toolSystem.UseTool(tool, user, target, 0f, modEv.PryTimeModifier * door.PryTime, door.PryingQuality,
                            new PryFinishedEvent(), new PryCancelledEvent(), target);

        return(true); // we might not actually succeeded, but a do-after has started
    }
コード例 #4
0
ファイル: CreateLogic.cs プロジェクト: liuzhenting/NToolTest
    public void CreateRight(int x, int y, float h)
    {
        GameObject obj = new GameObject();

        obj.transform.parent = Stage.gameObject.transform;
        obj.name             = "right";
        float hreal = h * rato;

        DoorComponent door = CreateDoor(eDoorType.Right, new Vector3(hreal * 0.1f, 2 * hreal));

        door.transform.parent = obj.transform;

        door.transform.localPosition = new Vector3((x / 2 - 1) * hreal * 1f, hreal * 1.5f - centeroffset, 0);
        door.mWallObjects            = new System.Collections.Generic.List <GameObject> ();
        Stage.rightDoor = door;

        for (int i = 1; i < y - 1; i++)
        {
            float      px   = (x / 2) * hreal * 1f;
            float      py   = 0.5f * hreal + i * hreal - centeroffset;
            GameObject wall = CreateItem(new Vector3(px, py, 0f), h, GetSpriteName(), obj.transform);
            if (i == 1 || i == 2)
            {
                door.mWallObjects.Add(wall);
            }
        }
    }
コード例 #5
0
ファイル: TesEngine.cs プロジェクト: BclEx/object-assets
 private void OpenDoor(DoorComponent component)
 {
     if (!component.doorData.leadsToAnotherCell)
     {
         component.Interact();
     }
     else
     {
         // The door leads to another cell, so destroy all currently loaded cells.
         _cellManager.DestroyAllCells();
         // Move the player.
         _playerTransform.position         = component.doorData.doorExitPos;
         _playerTransform.localEulerAngles = new Vector3(0, component.doorData.doorExitOrientation.eulerAngles.y, 0);
         // Load the new cell.
         CELLRecord newCell;
         if (component.doorData.leadsToInteriorCell)
         {
             var cellInfo = _cellManager.StartCreatingInteriorCell(component.doorData.doorExitName);
             _temporalLoadBalancer.WaitForTask(cellInfo.objectsCreationCoroutine);
             newCell = (CELLRecord)cellInfo.cellRecord;
             OnInteriorCell(newCell);
         }
         else
         {
             var cellIndices = _cellManager.GetExteriorCellIndices(component.doorData.doorExitPos);
             newCell = _data.FindExteriorCellRecord(cellIndices);
             _cellManager.UpdateExteriorCells(_playerCameraObj.transform.position, true, CellRadiusOnLoad);
             OnExteriorCell(newCell);
         }
         _currentCell = newCell;
     }
 }
コード例 #6
0
 public void CloseWindow()
 {
     FindObjectOfType <MapBuilder>().OpenWindowMap.Remove(_component);
     _component = null;
     Debug.Log("Closing window!");
     Destroy(gameObject);
 }
コード例 #7
0
        public async Task OpenCloseDestroyTest()
        {
            await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings { NoClient = true, ExtraPrototypes = Prototypes });

            var server = pairTracker.Pair.Server;

            var mapManager    = server.ResolveDependency <IMapManager>();
            var entityManager = server.ResolveDependency <IEntityManager>();

            EntityUid     airlock       = default;
            DoorComponent doorComponent = null;

            await server.WaitAssertion(() =>
            {
                mapManager.CreateNewMapEntity(MapId.Nullspace);

                airlock = entityManager.SpawnEntity("AirlockDummy", MapCoordinates.Nullspace);

                Assert.True(entityManager.TryGetComponent(airlock, out doorComponent));
                Assert.That(doorComponent.State, Is.EqualTo(DoorState.Closed));
            });

            await server.WaitIdleAsync();

            await server.WaitAssertion(() =>
            {
                EntitySystem.Get <DoorSystem>().StartOpening(airlock);
                Assert.That(doorComponent.State, Is.EqualTo(DoorState.Opening));
            });

            await server.WaitIdleAsync();

            await PoolManager.WaitUntil(server, () => doorComponent.State == DoorState.Open);

            Assert.That(doorComponent.State, Is.EqualTo(DoorState.Open));

            await server.WaitAssertion(() =>
            {
                EntitySystem.Get <DoorSystem>().TryClose((EntityUid)airlock);
                Assert.That(doorComponent.State, Is.EqualTo(DoorState.Closing));
            });

            await PoolManager.WaitUntil(server, () => doorComponent.State == DoorState.Closed);

            Assert.That(doorComponent.State, Is.EqualTo(DoorState.Closed));

            await server.WaitAssertion(() =>
            {
                Assert.DoesNotThrow(() =>
                {
                    entityManager.DeleteEntity(airlock);
                });
            });

            server.RunTicks(5);

            await pairTracker.CleanReturnAsync();
        }
コード例 #8
0
        public static void Prefix(object __instance)
        {
            DoorComponent component = (DoorComponent)TargetField.GetValue(__instance);

            if (component.door.lockLevel != 0 && component.door.Prototype.lockerKey == null)
            {
                ItemProto fake = ScriptableObject.CreateInstance <ItemProto>();
                fake.name = FakeName;
                component.door.Prototype.lockerKey = fake;
            }
        }
コード例 #9
0
    protected override void OnActivate(EntityUid uid, DoorComponent door, ActivateInWorldEvent args)
    {
        // TODO once access permissions are shared, move this back to shared.
        if (args.Handled || !door.ClickOpen)
        {
            return;
        }

        TryToggleDoor(uid, door, args.User);
        args.Handled = true;
    }
コード例 #10
0
 private void OnWeldChanged(EntityUid uid, DoorComponent component, WeldableChangedEvent args)
 {
     if (component.State == DoorState.Closed)
     {
         SetState(uid, DoorState.Welded, component);
     }
     else if (component.State == DoorState.Welded)
     {
         SetState(uid, DoorState.Closed, component);
     }
 }
コード例 #11
0
 private void OnWeldAttempt(EntityUid uid, DoorComponent component, WeldableAttemptEvent args)
 {
     if (component.CurrentlyCrushing.Count > 0)
     {
         args.Cancel();
         return;
     }
     if (component.State != DoorState.Closed && component.State != DoorState.Welded)
     {
         args.Cancel();
     }
 }
コード例 #12
0
    private void OnPryFinished(EntityUid uid, DoorComponent door, PryFinishedEvent args)
    {
        door.BeingPried = false;

        if (door.State == DoorState.Closed)
        {
            StartOpening(uid, door);
        }
        else if (door.State == DoorState.Open)
        {
            StartClosing(uid, door);
        }
    }
コード例 #13
0
    private void OnDoorAltVerb(EntityUid uid, DoorComponent component, GetVerbsEvent <AlternativeVerb> args)
    {
        if (!args.CanInteract || !TryComp <ToolComponent>(args.User, out var tool) || !tool.Qualities.Contains(component.PryingQuality))
        {
            return;
        }

        args.Verbs.Add(new AlternativeVerb()
        {
            Text   = "Pry door",
            Impact = LogImpact.Low,
            Act    = () => TryPryDoor(uid, args.User, args.User, component, true),
        });
    }
コード例 #14
0
ファイル: CreateLogic.cs プロジェクト: liuzhenting/NToolTest
    public DoorComponent CreateDoor(eDoorType type, Vector3 size)
    {
        GameObject obj = new GameObject();

        obj.name  = "door";
        obj.layer = LayerMask.NameToLayer("door");
        BoxCollider collider = obj.AddComponent <BoxCollider> ();

        collider.size = size;

        DoorComponent door = obj.AddComponent <DoorComponent> ();

        door.mDoorType = type;
        return(door);
    }
コード例 #15
0
        public void ConfigureFromData(DoorComponent component)
        {
            //_component = component;

            //Debug.Log(_component.CanUseDoor);
            //Debug.Log(_component.LoadOtherLevelOnUse);
            //Debug.Log(_component.IsOpen);

            //CloseButton.onClick.AddListener(CloseWindow);
            //IdentifierText.text = component.Identifier;
            //PositionText.text = component.gameObject.transform.position.ToString();

            //var references = string.Empty;
            //for (var i = 0; i < component.References.Count; i++)
            //{
            //    if (i == component.References.Count - 1)
            //    {
            //        references += component.References[i];
            //    }
            //    else
            //    {
            //        references += component.References[i] + "\n";
            //    }
            //}

            //ReferenceInputField.text = references;
            //ReferenceInputField.onEndEdit.AddListener(ReferenceOnEndEdit);

            //IsOpenToggle.isOn = component.IsOpen;
            //IsOpenToggle.onValueChanged.AddListener(IsOpenOnToggle);

            //CanUseDoor.isOn = component.CanUseDoor;
            //CanUseDoor.onValueChanged.AddListener(CanUseDoorOnToggle);

            //LoadOtherLevelOnUse.isOn = component.LoadOtherLevelOnUse;
            //LoadOtherLevelOnUse.onValueChanged.AddListener(LoadOtherLevelOnToggle);

            //MapReference.text = component.MapReference;
            //MapReference.onEndEdit.AddListener(MapReferenceOnEndEdit);

            //SpawnReference.text = component.SpawnPointReference;
            //SpawnReference.onEndEdit.AddListener(SpawnReferenceOnEndEdit);

            //KeyGroupInputField.text = component.KeyGroup;
            //KeyGroupInputField.onEndEdit.AddListener(KeyGroupOnEndEdit);
        }
コード例 #16
0
    /// <summary>
    ///     Weld or pry open a door.
    /// </summary>
    private void OnInteractUsing(EntityUid uid, DoorComponent door, InteractUsingEvent args)
    {
        if (args.Handled)
        {
            return;
        }

        if (!TryComp(args.Used, out ToolComponent? tool))
        {
            return;
        }

        if (tool.Qualities.Contains(door.PryingQuality))
        {
            args.Handled = TryPryDoor(uid, args.Used, args.User, door);
            return;
        }
    }
コード例 #17
0
    private void OnWeldFinished(EntityUid uid, DoorComponent door, WeldFinishedEvent args)
    {
        door.BeingWelded = false;

        if (!door.Weldable)
        {
            return;
        }

        if (door.State == DoorState.Closed)
        {
            SetState(uid, DoorState.Welded, door);
        }
        else if (door.State == DoorState.Welded)
        {
            SetState(uid, DoorState.Closed, door);
        }
    }
コード例 #18
0
        private void RightClickDoorButtonBuilder(DoorComponent doorComponent, int verticalPositionOffSet)
        {
            var go = Instantiate(Resources.Load <GameObject>("Prefabs/SampleButton"));

            go.transform.SetParent(_rightClickMenu.transform, false);
            go.transform.localScale = Vector3.one;
            var b = go.GetComponent <Button>();

            b.onClick.AddListener(() =>
            {
                doorComponent.ToggleDoor();
                ClearRightClickMenu();
            });
            b.GetComponentInChildren <Text>().text = doorComponent.IsOpen ? "Close Door" : "Open Door";

            var rt = go.GetComponent <RectTransform>();

            rt.transform.position = new Vector3(rt.transform.position.x, rt.transform.position.y - verticalPositionOffSet);
        }
コード例 #19
0
        private void OpenDoor(DoorComponent component)
        {
            if (!component.doorData.leadsToAnotherCell)
            {
                component.Interact();
            }
            else
            {
                // The door leads to another cell, so destroy all currently loaded cells.
                DestroyAllCells();

                // Move the player.
                playerTransform.position         = component.doorData.doorExitPos;
                playerTransform.localEulerAngles = new Vector3(0, component.doorData.doorExitOrientation.eulerAngles.y, 0);

                // Load the new cell.
                CELLRecord newCell;

                if (component.doorData.leadsToInteriorCell)
                {
                    newCell = dataReader.FindInteriorCellRecord(component.doorData.doorExitName);

                    var cellInfo = InstantiateCell(newCell);
                    temporalLoadBalancer.WaitForTask(cellInfo.creationCoroutine);

                    cellObjects[Vector2i.zero] = cellInfo;

                    OnInteriorCell(newCell);
                }
                else
                {
                    var cellIndices = GetExteriorCellIndices(component.doorData.doorExitPos);
                    newCell = dataReader.FindExteriorCellRecord(cellIndices);

                    UpdateExteriorCells(true, cellRadiusOnLoad);

                    OnExteriorCell(newCell);
                }

                _currentCell = newCell;
            }
        }
コード例 #20
0
    /// <summary>
    ///     Attempt to weld a door shut, or unweld it if it is already welded. This does not actually check if the user
    ///     is holding the correct tool.
    /// </summary>
    private bool TryWeldDoor(EntityUid target, EntityUid used, EntityUid user, DoorComponent door)
    {
        if (!door.Weldable || door.BeingWelded || door.CurrentlyCrushing.Count > 0)
        {
            return(false);
        }

        // is the door in a weld-able state?
        if (door.State != DoorState.Closed && door.State != DoorState.Welded)
        {
            return(false);
        }

        // perform a do-after delay
        door.BeingWelded = true;
        _toolSystem.UseTool(used, user, target, 3f, 3f, door.WeldingQuality,
                            new WeldFinishedEvent(), new WeldCancelledEvent(), target);

        return(true); // we might not actually succeeded, but a do-after has started
    }
コード例 #21
0
        public async Task OpenCloseDestroyTest()
        {
            var options = new ServerIntegrationOptions {
                ExtraPrototypes = Prototypes
            };
            var server = StartServer(options);

            await server.WaitIdleAsync();

            var mapManager    = server.ResolveDependency <IMapManager>();
            var entityManager = server.ResolveDependency <IEntityManager>();

            EntityUid     airlock       = default;
            DoorComponent doorComponent = null;

            server.Assert(() =>
            {
                mapManager.CreateNewMapEntity(MapId.Nullspace);

                airlock = entityManager.SpawnEntity("AirlockDummy", MapCoordinates.Nullspace);

                Assert.True(entityManager.TryGetComponent(airlock, out doorComponent));
                Assert.That(doorComponent.State, Is.EqualTo(DoorState.Closed));
            });

            await server.WaitIdleAsync();

            server.Assert(() =>
            {
                EntitySystem.Get <DoorSystem>().StartOpening(airlock);
                Assert.That(doorComponent.State, Is.EqualTo(DoorState.Opening));
            });

            await server.WaitIdleAsync();

            await WaitUntil(server, () => doorComponent.State == DoorState.Open);

            Assert.That(doorComponent.State, Is.EqualTo(DoorState.Open));

            server.Assert(() =>
            {
                EntitySystem.Get <DoorSystem>().TryClose((EntityUid)airlock);
                Assert.That(doorComponent.State, Is.EqualTo(DoorState.Closing));
            });

            await WaitUntil(server, () => doorComponent.State == DoorState.Closed);

            Assert.That(doorComponent.State, Is.EqualTo(DoorState.Closed));

            server.Assert(() =>
            {
                Assert.DoesNotThrow(() =>
                {
                    entityManager.DeleteEntity(airlock);
                });
            });

            server.RunTicks(5);

            await server.WaitIdleAsync();
        }
コード例 #22
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            AggregateFactory = new AggregateFactory(this);
            WeaponFactory = new WeaponFactory(this);
            DoorFactory = new DoorFactory(this);
            RoomFactory = new RoomFactory(this);
            CollectableFactory = new CollectibleFactory(this);
            WallFactory = new WallFactory(this);
            EnemyFactory = new EnemyFactory(this);
            SkillEntityFactory = new SkillEntityFactory(this);
            NPCFactory = new NPCFactory(this);

            // Initialize Components
            PlayerComponent = new PlayerComponent();
            LocalComponent = new LocalComponent();
            RemoteComponent = new RemoteComponent();
            PositionComponent = new PositionComponent();
            MovementComponent = new MovementComponent();
            MovementSpriteComponent = new MovementSpriteComponent();
            SpriteComponent = new SpriteComponent();
            DoorComponent = new DoorComponent();
            RoomComponent = new RoomComponent();
            HUDSpriteComponent = new HUDSpriteComponent();
            HUDComponent = new HUDComponent();
            InventoryComponent = new InventoryComponent();
            InventorySpriteComponent = new InventorySpriteComponent();
            ContinueNewGameScreen = new ContinueNewGameScreen(graphics, this);
            EquipmentComponent = new EquipmentComponent();
            WeaponComponent = new WeaponComponent();
            BulletComponent = new BulletComponent();
            PlayerInfoComponent = new PlayerInfoComponent();
            WeaponSpriteComponent = new WeaponSpriteComponent();
            StatsComponent = new StatsComponent();
            EnemyAIComponent = new EnemyAIComponent();
            NpcAIComponent = new NpcAIComponent();

            CollectibleComponent = new CollectibleComponent();
            CollisionComponent = new CollisionComponent();
            TriggerComponent = new TriggerComponent();
            EnemyComponent = new EnemyComponent();
            NPCComponent = new NPCComponent();
            //QuestComponent = new QuestComponent();
            LevelManager = new LevelManager(this);
            SpriteAnimationComponent = new SpriteAnimationComponent();
            SkillProjectileComponent = new SkillProjectileComponent();
            SkillAoEComponent = new SkillAoEComponent();
            SkillDeployableComponent = new SkillDeployableComponent();
            SoundComponent = new SoundComponent();
            ActorTextComponent = new ActorTextComponent();
            TurretComponent = new TurretComponent();
            TrapComponent = new TrapComponent();
            ExplodingDroidComponent = new ExplodingDroidComponent();
            HealingStationComponent = new HealingStationComponent();
            PortableShieldComponent = new PortableShieldComponent();
            PortableStoreComponent = new PortableStoreComponent();
            ActiveSkillComponent = new ActiveSkillComponent();
            PlayerSkillInfoComponent = new PlayerSkillInfoComponent();

            Quests = new List<Quest>();

            #region Initialize Effect Components
            AgroDropComponent = new AgroDropComponent();
            AgroGainComponent = new AgroGainComponent();
            BuffComponent = new BuffComponent();
            ChanceToSucceedComponent = new ChanceToSucceedComponent();
            ChangeVisibilityComponent = new ChangeVisibilityComponent();
            CoolDownComponent = new CoolDownComponent();
            DamageOverTimeComponent = new DamageOverTimeComponent();
            DirectDamageComponent = new DirectDamageComponent();
            DirectHealComponent = new DirectHealComponent();
            FearComponent = new FearComponent();
            HealOverTimeComponent = new HealOverTimeComponent();
            InstantEffectComponent = new InstantEffectComponent();
            KnockBackComponent = new KnockBackComponent();
            TargetedKnockBackComponent = new TargetedKnockBackComponent();
            ReduceAgroRangeComponent = new ReduceAgroRangeComponent();
            ResurrectComponent = new ResurrectComponent();
            StunComponent = new StunComponent();
            TimedEffectComponent = new TimedEffectComponent();
            EnslaveComponent = new EnslaveComponent();
            CloakComponent = new CloakComponent();
            #endregion

            base.Initialize();
        }
コード例 #23
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            AggregateFactory = new AggregateFactory(this);
            WeaponFactory = new WeaponFactory(this);
            DoorFactory = new DoorFactory(this);
            RoomFactory = new RoomFactory(this);
            CollectableFactory = new CollectibleFactory(this);
            WallFactory = new WallFactory(this);
            EnemyFactory = new EnemyFactory(this);

            // Initialize Components
            PlayerComponent = new PlayerComponent();
            LocalComponent = new LocalComponent();
            RemoteComponent = new RemoteComponent();
            PositionComponent = new PositionComponent();
            MovementComponent = new MovementComponent();
            MovementSpriteComponent = new MovementSpriteComponent();
            SpriteComponent = new SpriteComponent();
            DoorComponent = new DoorComponent();
            RoomComponent = new RoomComponent();
            HUDSpriteComponent = new HUDSpriteComponent();
            HUDComponent = new HUDComponent();
            InventoryComponent = new InventoryComponent();
            InventorySpriteComponent = new InventorySpriteComponent();
            ContinueNewGameScreen = new ContinueNewGameScreen(graphics, this);
            EquipmentComponent = new EquipmentComponent();
            WeaponComponent = new WeaponComponent();
            BulletComponent = new BulletComponent();
            PlayerInfoComponent = new PlayerInfoComponent();
            WeaponSpriteComponent = new WeaponSpriteComponent();
            StatsComponent = new StatsComponent();
            EnemyAIComponent = new EnemyAIComponent();
            CollectibleComponent = new CollectibleComponent();
            CollisionComponent = new CollisionComponent();
            TriggerComponent = new TriggerComponent();
            EnemyComponent = new EnemyComponent();
            QuestComponent = new QuestComponent();
            LevelManager = new LevelManager(this);
            SpriteAnimationComponent = new SpriteAnimationComponent();
            SkillProjectileComponent = new SkillProjectileComponent();
            SkillAoEComponent = new SkillAoEComponent();
            SkillDeployableComponent = new SkillDeployableComponent();

            //TurretComponent = new TurretComponent();
            //TrapComponent = new TrapComponent();
            //PortableShopComponent = new PortableShopComponent();
            //PortableShieldComponent = new PortableShieldComponent();
            //MotivateComponent =  new MotivateComponent();
            //FallbackComponent = new FallbackComponent();
            //ChargeComponent = new ChargeComponent();
            //HealingStationComponent = new HealingStationComponent();
            //ExplodingDroidComponent = new ExplodingDroidComponent();

            base.Initialize();
        }
コード例 #24
0
        public async Task AirlockBlockTest()
        {
            await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings { NoClient = true, ExtraPrototypes = Prototypes });

            var server = pairTracker.Pair.Server;

            await server.WaitIdleAsync();

            var mapManager    = server.ResolveDependency <IMapManager>();
            var entityManager = server.ResolveDependency <IEntityManager>();

            IPhysBody     physBody      = null;
            EntityUid     physicsDummy  = default;
            EntityUid     airlock       = default;
            DoorComponent doorComponent = null;

            var physicsDummyStartingX = -1;

            await server.WaitAssertion(() =>
            {
                var mapId = mapManager.CreateMap();

                var humanCoordinates = new MapCoordinates((physicsDummyStartingX, 0), mapId);
                physicsDummy         = entityManager.SpawnEntity("PhysicsDummy", humanCoordinates);

                airlock = entityManager.SpawnEntity("AirlockDummy", new MapCoordinates((0, 0), mapId));

                Assert.True(entityManager.TryGetComponent(physicsDummy, out physBody));

                Assert.True(entityManager.TryGetComponent(airlock, out doorComponent));
                Assert.That(doorComponent.State, Is.EqualTo(DoorState.Closed));
            });

            await server.WaitIdleAsync();

            // Push the human towards the airlock
            await server.WaitAssertion(() => Assert.That(physBody != null));

            await server.WaitPost(() => physBody.LinearVelocity = (0.5f, 0));

            for (var i = 0; i < 240; i += 10)
            {
                // Keep the airlock awake so they collide
                await server.WaitPost(() => entityManager.GetComponent <IPhysBody>(airlock).WakeBody());

                await server.WaitRunTicks(10);

                await server.WaitIdleAsync();
            }

            // Sanity check
            // Sloth: Okay I'm sorry but I hate having to rewrite tests for every refactor
            // If you see this yell at me in discord so I can continue to pretend this didn't happen.
            // REMINDER THAT I STILL HAVE TO FIX THIS TEST EVERY OTHER PHYSICS PR
            // Assert.That(physicsDummy.Transform.MapPosition.X, Is.GreaterThan(physicsDummyStartingX));

            // Blocked by the airlock
            await server.WaitAssertion(() => Assert.That(Math.Abs(entityManager.GetComponent <TransformComponent>(physicsDummy).MapPosition.X - 1) > 0.01f));

            await pairTracker.CleanReturnAsync();
        }
コード例 #25
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            AggregateFactory   = new AggregateFactory(this);
            WeaponFactory      = new WeaponFactory(this);
            DoorFactory        = new DoorFactory(this);
            RoomFactory        = new RoomFactory(this);
            CollectableFactory = new CollectibleFactory(this);
            WallFactory        = new WallFactory(this);
            EnemyFactory       = new EnemyFactory(this);
            SkillEntityFactory = new SkillEntityFactory(this);
            NPCFactory         = new NPCFactory(this);

            // Initialize Components
            PlayerComponent          = new PlayerComponent();
            LocalComponent           = new LocalComponent();
            RemoteComponent          = new RemoteComponent();
            PositionComponent        = new PositionComponent();
            MovementComponent        = new MovementComponent();
            MovementSpriteComponent  = new MovementSpriteComponent();
            SpriteComponent          = new SpriteComponent();
            DoorComponent            = new DoorComponent();
            RoomComponent            = new RoomComponent();
            HUDSpriteComponent       = new HUDSpriteComponent();
            HUDComponent             = new HUDComponent();
            InventoryComponent       = new InventoryComponent();
            InventorySpriteComponent = new InventorySpriteComponent();
            ContinueNewGameScreen    = new ContinueNewGameScreen(graphics, this);
            EquipmentComponent       = new EquipmentComponent();
            WeaponComponent          = new WeaponComponent();
            BulletComponent          = new BulletComponent();
            PlayerInfoComponent      = new PlayerInfoComponent();
            WeaponSpriteComponent    = new WeaponSpriteComponent();
            StatsComponent           = new StatsComponent();
            EnemyAIComponent         = new EnemyAIComponent();
            NpcAIComponent           = new NpcAIComponent();

            CollectibleComponent = new CollectibleComponent();
            CollisionComponent   = new CollisionComponent();
            TriggerComponent     = new TriggerComponent();
            EnemyComponent       = new EnemyComponent();
            NPCComponent         = new NPCComponent();
            //QuestComponent = new QuestComponent();
            LevelManager             = new LevelManager(this);
            SpriteAnimationComponent = new SpriteAnimationComponent();
            SkillProjectileComponent = new SkillProjectileComponent();
            SkillAoEComponent        = new SkillAoEComponent();
            SkillDeployableComponent = new SkillDeployableComponent();
            SoundComponent           = new SoundComponent();
            ActorTextComponent       = new ActorTextComponent();
            TurretComponent          = new TurretComponent();
            TrapComponent            = new TrapComponent();
            ExplodingDroidComponent  = new ExplodingDroidComponent();
            HealingStationComponent  = new HealingStationComponent();
            PortableShieldComponent  = new PortableShieldComponent();
            PortableStoreComponent   = new PortableStoreComponent();
            ActiveSkillComponent     = new ActiveSkillComponent();
            PlayerSkillInfoComponent = new PlayerSkillInfoComponent();
            MatchingPuzzleComponent  = new MatchingPuzzleComponent();
            pI = new PlayerInfo();

            Quests = new List <Quest>();


            #region Initialize Effect Components
            AgroDropComponent          = new AgroDropComponent();
            AgroGainComponent          = new AgroGainComponent();
            BuffComponent              = new BuffComponent();
            ChanceToSucceedComponent   = new ChanceToSucceedComponent();
            ChangeVisibilityComponent  = new ChangeVisibilityComponent();
            CoolDownComponent          = new CoolDownComponent();
            DamageOverTimeComponent    = new DamageOverTimeComponent();
            DirectDamageComponent      = new DirectDamageComponent();
            DirectHealComponent        = new DirectHealComponent();
            FearComponent              = new FearComponent();
            HealOverTimeComponent      = new HealOverTimeComponent();
            PsiOrFatigueRegenComponent = new PsiOrFatigueRegenComponent();
            InstantEffectComponent     = new InstantEffectComponent();
            KnockBackComponent         = new KnockBackComponent();
            TargetedKnockBackComponent = new TargetedKnockBackComponent();
            ReduceAgroRangeComponent   = new ReduceAgroRangeComponent();
            ResurrectComponent         = new ResurrectComponent();
            StunComponent              = new StunComponent();
            TimedEffectComponent       = new TimedEffectComponent();
            EnslaveComponent           = new EnslaveComponent();
            CloakComponent             = new CloakComponent();
            #endregion

            base.Initialize();
        }
コード例 #26
0
 public static Boolean Prefix(DoorComponent __instance, CharacterComponent character)
 {
     return(LockerComponentOpener.Open(__instance, __instance.door.Prototype.lockerKey, character));
 }
コード例 #27
0
 public void OpenEditorWindow(DoorComponent doorComponent)
 {
 }
コード例 #28
0
 private void OnPryCancelled(EntityUid uid, DoorComponent door, PryCancelledEvent args)
 {
     door.BeingPried = false;
 }
コード例 #29
0
 private void OnWeldCancelled(EntityUid uid, DoorComponent door, WeldCancelledEvent args)
 {
     door.BeingWelded = false;
 }
コード例 #30
0
 public static Boolean Patch_DoorComponent_Use_Prefix_AutoLockpick(DoorComponent __instance, CharacterComponent character)
 {
     return(AutoLockpick(__instance, character));
 }
コード例 #31
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            AggregateFactory = new AggregateFactory(this);

            // Initialize Components
            PlayerComponent = new PlayerComponent();
            LocalComponent = new LocalComponent();
            RemoteComponent = new RemoteComponent();
            PositionComponent = new PositionComponent();
            MovementComponent = new MovementComponent();
            MovementSpriteComponent = new MovementSpriteComponent();
            SpriteComponent = new SpriteComponent();
            DoorComponent = new DoorComponent();
            RoomComponent = new RoomComponent();
            HUDSpriteComponent = new HUDSpriteComponent();
            HUDComponent = new HUDComponent();

            CharacterSelectionScreen = new CharacterSelectionScreen(graphics, this);

            LevelManager = new LevelManager(this);

            base.Initialize();
        }