Ejemplo n.º 1
0
        public static Entity BlueDoor(bool mIsOff = false)
        {
            var result = new Entity(Tile) {Layer = TDLLayers.Door};

            var cRender = TDLComponentFactory.Render(@"environment\door\blue\closed", "doortiles", "single");
            var cRecalculateSprites = new TDCRecalculateSprites(TDLTags.DoorClosed, TDLRecalculations.RecalculateDoorSprite);
            var cSwitch = TDLComponentFactory.SwitchTexture(cRender, mIsOff, @"environment\door\blue\open", @"environment\door\blue\closed");
            cSwitch.OnlyOffTags.Add(TDLTags.BlueDoorOpen);
            cSwitch.OnlyOnTags.AddRange(new[] {TDLTags.BlueDoorClosed, TDLTags.Solid, TDLTags.GroundPathmapObstacle});
            var cSwitchRecalculateTagAI = new TDCSwitchRecalculateTagAI(cSwitch, cRecalculateSprites, TDLTags.BlueDoorOpen, TDLTags.BlueDoorClosed);
            var cDoor = new TDCDoor(TDCDoor.DoorType.Blue, mIsOff, Game, cSwitch, cRecalculateSprites);

            result.AddTags(TDLTags.BlueDoor);
            result.AddComponents(cRender, cSwitch, cSwitchRecalculateTagAI, cRecalculateSprites, cDoor);

            return result;
        }
Ejemplo n.º 2
0
        public static Entity Door(bool mIsBroken = false, bool mIsOff = false, List<int> mIDs = default(List<int>))
        {
            var result = new Entity(Tile) {Layer = TDLLayers.Door};

            var cRender = TDLComponentFactory.Render(@"environment\door\yellow\closed", "doortiles", "single");
            var cSwitch = TDLComponentFactory.SwitchTexture(cRender, mIsOff, @"environment\door\yellow\open", @"environment\door\yellow\closed");
            cSwitch.OnlyOffTags.Add(TDLTags.DoorOpen);
            cSwitch.OnlyOnTags.AddRange(new[] {TDLTags.DoorClosed, TDLTags.Solid, TDLTags.GroundPathmapObstacle});
            var cHitByWeapon = new TDCHitByWeapon(TDCHitByWeapon.HitActions.BreakIfOff);
            var cID = TDLComponentFactory.ID(mIDs);
            var cRecalculateSprites = new TDCRecalculateSprites(TDLTags.DoorClosed, TDLRecalculations.RecalculateDoorSprite, cID.SameIDsCondition);
            var cIDSwitchAI = new TDCIDSwitchAI(cSwitch, cID);
            var cSwitchRecalculateTagAI = new TDCSwitchRecalculateTagAI(cSwitch, cRecalculateSprites, TDLTags.DoorOpen, TDLTags.DoorClosed);
            var cDoor = new TDCDoor(TDCDoor.DoorType.Yellow, mIsOff, Game, cSwitch, cRecalculateSprites);

            result.AddTags(TDLTags.Door, TDLTags.HitByWeapon);
            result.AddComponents(cRender, cID, cSwitch, cSwitchRecalculateTagAI, cRecalculateSprites,
                                 cIDSwitchAI, cDoor);
            if (mIsBroken)
            {
                result.AddComponents(cHitByWeapon);
                TDLMethods.AttachBrokenOverlay(cRender);
            }

            return result;
        }