Example #1
0
        public Entity Decoration(int mX, int mY, string mTextureName, string mTilesetName, string mLabelName,
                                 float mRotation = 0)
        {
            var result = new Entity(_manager);

            var cBody = Body(new SSVector2I(mX, mY), 1600, 1600, true);
            var cRender = Render(cBody, mTextureName, mTilesetName, mLabelName, mRotation);

            cBody.Body.AddGroups(Groups.Decoration);

            result.AddComponents(cBody, cRender);
            result.AddTags(Tags.Decoration);

            return result;
        }
Example #2
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;
        }
Example #3
0
        public Entity BreakableWall(int mX, int mY)
        {
            var result = new Entity(_manager);

            var cHealth = new CHealth(85);
            var cBody = Body(new SSVector2I(mX, mY), 16.ToUnits(), 16.ToUnits(), true);
            var cRender = Render(cBody, Textures.Wall, Tilesets.Wall, "breakable");

            cBody.Body.AddGroups(Groups.Obstacle);

            result.AddComponents(cHealth, cBody, cRender);
            result.AddTags(Tags.Wall, Tags.DamagedByAny);

            cRender.Sprite.Rotation = Utils.Random.Next(0, 4)*90;

            return result;
        }
Example #4
0
        public Entity BigEnemy(int mX, int mY)
        {
            var result = new Entity(_manager);

            var cHealth = Health(12);
            var cBody = Body(new SSVector2I(mX, mY), 2000, 2000);
            var cMovement = Movement(cBody);
            var cTargeter = Targeter(cBody, Tags.Friendly);
            var cRender = Render(cBody, Textures.BigCharBlack, Tilesets.BigChar, "normal");
            var cAI = AI(cBody, cMovement, cTargeter, cRender, true);

            cBody.Body.AddGroups(Groups.Character, Groups.Enemy);
            cBody.Body.AddGroupsToCheck(Groups.Obstacle);

            result.AddComponents(cHealth, cBody, cMovement, cTargeter, cRender, cAI);
            result.AddTags(Tags.Char, Tags.Enemy, Tags.DamagedByWhite);

            Aura(result, mX, mY, true);

            return result;
        }
Example #5
0
        public static Entity Arrow(int mDirection = 0, bool mIsOff = false, List<int> mIDs = default(List<int>))
        {
            var result = new Entity(Tile) {Layer = TDLLayers.Arrow, UpdateOrder = TDLOrders.Trapdoor};

            var cRender = TDLComponentFactory.Render(@"environment\arrow", "onoffdirtiles", "on_n");
            var cDirection = new TDCDirection(mDirection);
            var cSpecialSquare = new TDCSpecialSquare(TDLPriorities.Arrow);
            var cID = TDLComponentFactory.ID(mIDs);
            var cSwitch = new TDCSwitch(cRender, mIsOff);
            cSwitch.SetOffTextureRect(Assets.GetTileset("onoffdirtiles").GetTextureRect("off_" + cDirection.DirectionString));
            cSwitch.SetOnTextureRect(Assets.GetTileset("onoffdirtiles").GetTextureRect("on_" + cDirection.DirectionString));
            var cIDSwitchAI = new TDCIDSwitchAI(cSwitch, cID);
            var cArrow = new TDCArrow(cSpecialSquare, cDirection, cSwitch);

            cSwitch.OnlyOnTags.Add(TDLTags.GroundPathmapObstacle);

            result.AddTags(TDLTags.Arrow);
            result.AddComponents(cRender, cDirection, cSpecialSquare, cID, cSwitch, cIDSwitchAI, cArrow);

            return result;
        }
Example #6
0
        public static Entity WoodenSword()
        {
            var result = new Entity(Tile) {Layer = TDLLayers.Weapon};

            var cRender = TDLComponentFactory.Render(@"weapon\woodensword", "dirtiles", "n", true);
            var cDirection = new TDCDirection(0);
            var cWeapon = new TDCWeapon();
            var cRenderDirectionAI = new TDCRenderDirectionAI(cRender, cDirection, "dirtiles");

            result.AddTags(TDLTags.Solid, TDLTags.Weapon, TDLTags.DoesNotTriggerPlate);
            result.AddComponents(cRender, cDirection, cWeapon, cRenderDirectionAI);

            Instance.AddEntity(result);
            return result;
        }
Example #7
0
        public static Entity Water()
        {
            var result = new Entity(Tile) {Layer = TDLLayers.Pit};

            var cRender = TDLComponentFactory.Render(@"environment\water", "doortiles", "single");
            var cRecalculateSprites = new TDCRecalculateSprites(TDLTags.Water, TDLRecalculations.RecalculateDoorSprite);

            result.AddTags(TDLTags.Solid, TDLTags.Water, TDLTags.GroundPathmapObstacle);
            result.AddComponents(cRender, cRecalculateSprites);

            return result;
        }
Example #8
0
        public static Entity Tunnel(int mDirection = 0)
        {
            var result = new Entity(Tile) {Layer = TDLLayers.Arrow};

            var cRender = TDLComponentFactory.Render(@"elements\tunnel");
            var cDirection = new TDCDirection(mDirection);
            var cSpecialSquare = new TDCSpecialSquare(TDLPriorities.Trapdoor);
            var cTunnel = new TDCTunnel(cRender, cDirection, cSpecialSquare);

            result.AddTags(TDLTags.Tunnel, TDLTags.GroundPathmapObstacle);
            result.AddComponents(cRender, cSpecialSquare, cDirection, cTunnel);

            return result;
        }
Example #9
0
        public static Entity RoachQueen(int mDirection = 0, int mSpawnTurns = 30)
        {
            var result = new Entity(Tile) {Layer = TDLLayers.Roach, UpdateOrder = TDLOrders.Roach};

            var cRender = TDLComponentFactory.Render(@"monster\roachqueen", "roachtiles", "n", true);
            var cDirection = new TDCDirection(mDirection);
            var cTarget = new TDCTarget(TDLTags.MonsterTargetTags);
            var cHitByWeapon = new TDCHitByWeapon(TDCHitByWeapon.HitActions.Kill);
            var cMovement = new TDCMovement(TDCMovement.MovementType.BeelineNormal, TDLTags.GroundAllowedTags, TDLTags.GroundObstacleTags, TDLTags.GroundExceptionTags) {IsReverse = true};
            var cMovementTargetAI = new TDCMovementTargetAI(Instance, cMovement, cTarget, cDirection, TDLPathmaps.SideGood);
            var cRenderDirectionAI = new TDCRenderDirectionAI(cRender, cDirection, "roachtiles");
            var cPathmapper = new TDCPathmapper(Instance, TDLPathmaps.SideBad);
            var cRoachQueen = new TDCRoachQueen(false, mSpawnTurns);

            result.AddTags(TDLTags.Solid, TDLTags.SideBad, TDLTags.HitByWeapon,
                           TDLTags.RequiredKill, TDLTags.BoosterUser, TDLTags.WeightLow, TDLTags.AffectedByBrain);
            result.AddComponents(cRender, cDirection, cTarget, cHitByWeapon,
                                 cMovementTargetAI, cMovement, cRenderDirectionAI, cPathmapper, cRoachQueen);

            return result;
        }
Example #10
0
        // WEAPONS
        public static Entity ReallyBigSword()
        {
            var result = new Entity(Tile) {Layer = TDLLayers.Weapon};

            var cRender = TDLComponentFactory.Render(@"weapon\reallybigsword", "dirtiles", "n", true);
            var cDirection = new TDCDirection(0);
            var cWeapon = new TDCWeapon();
            var cRenderDirectionAI = new TDCRenderDirectionAI(cRender, cDirection, "dirtiles");

            cWeapon.OnEquip += mWielder => mWielder.Entity.AddTags(TDLTags.WeightHigh);
            cWeapon.OnUnEquip += mWielder => mWielder.Entity.RemoveTags(TDLTags.WeightHigh);

            result.AddTags(TDLTags.Solid, TDLTags.Weapon, TDLTags.DoesNotTriggerPlate, TDLTags.AffectedByOremites);
            result.AddComponents(cRender, cDirection, cWeapon, cRenderDirectionAI);

            Instance.AddEntity(result);
            return result;
        }
Example #11
0
        public static Entity Brain()
        {
            var result = new Entity(Tile) {Layer = TDLLayers.Roach, UpdateOrder = TDLOrders.Roach};

            var cRender = TDLComponentFactory.Render(@"monster\brain", true);
            var cHitByWeapon = new TDCHitByWeapon(TDCHitByWeapon.HitActions.KillBrain);
            var cPathmapper = new TDCPathmapper(Instance, TDLPathmaps.SideBad);

            result.AddTags(TDLTags.Solid, TDLTags.SideBad, TDLTags.HitByWeapon,
                           TDLTags.RequiredKill, TDLTags.WeightLow, TDLTags.Brain);
            result.AddComponents(cRender, cHitByWeapon, cPathmapper);

            result.Field.TurnActions[TDLTurnActions.StartBrainCheck] += () => TDLMethods.CheckForBrains(result.Field);

            return result;
        }
Example #12
0
        public Entity Enemy(int mX, int mY)
        {
            var result = new Entity(_manager);

            var cStats = new CStats(1, 1, 1, 75);
            var cHealth = new CHealth(cStats);
            var cBody = Body(new SSVector2I(mX, mY), 10.ToUnits(), 10.ToUnits());
            var cMovement = Movement(cBody);
            var cRender = Render(cBody, Textures.CharEnemy, Tilesets.Char, "normal");
            var cShadower = new CShadower(_game, cBody, false, new Color(125, 255, 125, 125));
            var cLineOfSight = new CLineOfSight(_game, cBody, cShadower) {TargetTag = Tags.Friendly, Angle = 90, Amplitude = 65};
            var cAI = AI(cStats, cBody, cMovement, cRender, cLineOfSight);

            cBody.Body.AddGroups(Groups.Character, Groups.Enemy);
            cBody.Body.AddGroupsToCheck(Groups.Obstacle);

            result.AddComponents(cHealth, cBody, cMovement, cRender, cShadower, cLineOfSight, cAI);
            result.AddTags(Tags.Char, Tags.Enemy, Tags.DamagedByFriendly);

            return result;
        }
Example #13
0
        private Entity BulletBase(int mX, int mY, float mDegrees, int mSpeed, string mTextureName, bool mEnemy)
        {
            var result = new Entity(_manager);

            var cBody = Body(new SSVector2I(mX, mY), 250, 250);
            var cMovement = Movement(cBody);
            var cRender = Render(cBody, mTextureName);

            cBody.Body.AddGroupsToCheck(Groups.Obstacle, Groups.Character);
            cBody.Body.AddGroupsToIgnoreResolve(Groups.Obstacle, Groups.Character);
            cBody.OnCollision += (mCollisionInfo) =>
                                 {
                                     var entity = (Entity) mCollisionInfo.UserData;
                                     var cHealth = entity.GetComponent<CHealth>();

                                     if (entity.HasTag(Tags.DamagedByAny))
                                     {
                                         cHealth.Health--;
                                         result.Destroy();
                                     }
                                     else if (result.HasTag(Tags.BulletFriendly) &&
                                              entity.HasTag(Tags.DamagedByFriendly))
                                     {
                                         cHealth.Health--;
                                         result.Destroy();
                                     }
                                     else if (result.HasTag(Tags.BulletEnemy) &&
                                              entity.HasTag(Tags.DamagedByEnemy))
                                     {
                                         cHealth.Health--;
                                         result.Destroy();
                                     }

                                     if (entity.HasTag(Tags.DestroysBullets)) result.Destroy();
                                 };

            cMovement.Angle = mDegrees;
            cMovement.Speed = mSpeed;

            cRender.Torque = 8;

            result.AddComponents(cBody, cMovement, cRender);
            result.AddTags(Tags.Bullet);

            return result;
        }
Example #14
0
        public Entity Wall(int mX, int mY, string mLabelName = "fill", float mRotation = 0)
        {
            var result = new Entity(_manager);

            var cBody = Body(new SSVector2I(mX, mY), 16.ToUnits(), 16.ToUnits(), true);
            var cRender = Render(cBody, Textures.Wall, Tilesets.Wall, mLabelName, mRotation);

            cBody.Body.AddGroups(Groups.Obstacle);

            result.AddComponents(cBody, cRender);
            result.AddTags(Tags.Wall, Tags.DestroysBullets);

            return result;
        }
Example #15
0
        public Entity Player(int mX, int mY)
        {
            var result = new Entity(_manager);

            var cStats = new CStats(1, 1, 1, 50);
            var cHealth = new CHealth(cStats);
            var cBody = Body(new SSVector2I(mX, mY), 10.ToUnits(), 10.ToUnits());
            var cMovement = Movement(cBody);
            var cRender = Render(cBody, Textures.CharPlayer, Tilesets.Char, "normal");
            var cControl = Control(cBody, cStats, cMovement, cRender);
            var cShadower = new CShadower(_game, cBody, true, new Color(77, 77, 175, 255), 1);

            cBody.Body.AddGroups(Groups.Character, Groups.Friendly);
            cBody.Body.AddGroupsToCheck(Groups.Obstacle);

            result.AddComponents(cStats, cHealth, cBody, cMovement, cControl, cRender, cShadower);
            result.AddTags(Tags.Char, Tags.Friendly, Tags.DamagedByEnemy);

            return result;
        }
Example #16
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;
        }
Example #17
0
        public static Entity PressurePlateSingleUse(List<int> mTargetIDs = default(List<int>), List<int> mTargetEffects = default(List<int>))
        {
            var result = new Entity(Tile) {Layer = TDLLayers.Floor, UpdateOrder = TDLOrders.Trapdoor};

            var cRender = TDLComponentFactory.Render(@"environment\pressureplate", "pressureplatetiles", "single");
            var cSpecialSquare = new TDCSpecialSquare(TDLPriorities.Trapdoor);
            var cIDCaller = new TDCIDCaller(mTargetIDs, mTargetEffects);
            var cFloodFiller = new TDCFloodFiller(TDLTags.PressurePlateSingleUse);
            var cPressurePlate = new TDCPressurePlate(TDCPressurePlate.PressurePlateType.Single, cRender, cFloodFiller, cIDCaller, cSpecialSquare, "triggered_single", "single");

            result.AddTags(TDLTags.PressurePlateSingleUse);
            result.AddComponents(cRender, cPressurePlate, cSpecialSquare, cIDCaller, cFloodFiller);

            return result;
        }
Example #18
0
        public static Entity Guard(int mDirection = 0)
        {
            var result = new Entity(Tile) {Layer = TDLLayers.Roach, UpdateOrder = TDLOrders.Guard};

            var outline1 = new TDCRenderSpriteOutline("humanoidtiles", @"humanoid\body\red", "n");
            var outline2 = new TDCRenderSpriteOutline("humanoidtiles", @"humanoid\hands\pink", "n");
            var outline3 = new TDCRenderSpriteOutline("humanoidtiles", @"humanoid\head\pink", "n");

            var cRender = new TDCRender(outline1, outline2, outline3) {IsLerped = true};
            var cDirection = new TDCDirection(mDirection);
            var cTarget = new TDCTarget(TDLTags.MonsterTargetTags);
            var cHitByWeapon = new TDCHitByWeapon(TDCHitByWeapon.HitActions.Kill);
            var cMovement = new TDCMovement(TDCMovement.MovementType.FlexibleNormal, TDLTags.GroundAllowedTags, TDLTags.GroundObstacleTags, TDLTags.GroundExceptionTags);
            var cRenderDirectionAI = new TDCRenderDirectionAI(cRender, cDirection, "humanoidtiles");
            var cWielder = new TDCWielder(cMovement, cDirection);
            var cWielderTargetAI = new TDCWielderTargetAI(cTarget, cMovement, cDirection, cWielder);
            var cMovementTargetAI = new TDCMovementTargetAI(Instance, cMovement, cTarget, cDirection, TDLPathmaps.SideGood, false, true);
            var cPathmapper = new TDCPathmapper(Instance, TDLPathmaps.SideBad);
            var cWielderRenderAI = new TDCWielderRenderAI(cWielder, cRender, cRenderDirectionAI);

            result.AddTags(TDLTags.Solid, TDLTags.Humanoid, TDLTags.SideBad, TDLTags.HitByWeapon,
                           TDLTags.WeightLow, TDLTags.BoosterUser, TDLTags.RequiredKill, TDLTags.Guard);
            result.AddComponents(cRender, cDirection, cTarget, cHitByWeapon,
                                 cWielderTargetAI, cMovementTargetAI, cMovement, cRenderDirectionAI, cWielder, cPathmapper,
                                 cWielderRenderAI);

            cWielder.SetWeapon(WoodenSword());

            return result;
        }
Example #19
0
        public static Entity RoachEgg()
        {
            var result = new Entity(Tile) {Layer = TDLLayers.Roach, UpdateOrder = TDLOrders.Roach};

            var cRender = TDLComponentFactory.Render(@"monster\roachegg", "roachtiles", "n", true);
            var cHitByWeapon = new TDCHitByWeapon(TDCHitByWeapon.HitActions.Kill);
            var cEgg = new TDCEgg(cRender, 4);
            var cPathmapper = new TDCPathmapper(Instance, TDLPathmaps.SideBad);

            result.AddTags(TDLTags.Solid, TDLTags.SideBad, TDLTags.HitByWeapon, TDLTags.RequiredKill);
            result.AddComponents(cRender, cHitByWeapon, cEgg, cPathmapper);

            return result;
        }
Example #20
0
        public static Entity HotTile(int mTurnsToBurn = 2)
        {
            var result = new Entity(Tile) {UpdateOrder = TDLOrders.Trapdoor, Layer = TDLLayers.Trapdoor};

            var cRender = TDLComponentFactory.Render(@"environment\hottile", "doortiles", "single");
            var cRecalculateSprites = new TDCRecalculateSprites(TDLTags.HotTile, TDLRecalculations.RecalculateDoorSprite);
            var cSpecialSquare = new TDCSpecialSquare(TDLPriorities.Trapdoor);
            var cHotTile = new TDCHotTile(cSpecialSquare, mTurnsToBurn);

            result.AddTags(TDLTags.HotTile);
            result.AddComponents(cRender, cSpecialSquare, cRecalculateSprites, cHotTile);

            return result;
        }
Example #21
0
        public static Entity Scroll(string mText = "")
        {
            var result = new Entity(Tile) {Layer = TDLLayers.Arrow, UpdateOrder = TDLOrders.Trapdoor};

            var cRender = TDLComponentFactory.Render(@"elements\scroll");
            var cScroll = new TDCScroll(Game, mText);

            result.AddComponents(cRender, cScroll);

            return result;
        }
Example #22
0
        public static Entity Orb(List<int> mTargetIDs = default(List<int>), List<int> mTargetEffects = default(List<int>), bool mIsBroken = false, int mHealth = 2)
        {
            var result = new Entity(Tile) {Layer = TDLLayers.Orb};

            var cRender = TDLComponentFactory.Render(@"elements\orb", "orbtiles", "on");
            var cIDCaller = new TDCIDCaller(mTargetIDs, mTargetEffects);
            var cOrb = new TDCOrb(mIsBroken, mHealth, cRender, cIDCaller);
            var cHitByWeapon = new TDCHitByWeapon(cOrb.Struck);

            if (mIsBroken) TDLMethods.AttachCrackedOverlay(cRender, mHealth >= 2 ? 0 : 1);

            result.AddTags(TDLTags.Solid, TDLTags.HitByWeapon, TDLTags.GroundPathmapObstacle);
            result.AddComponents(cRender, cHitByWeapon, cIDCaller, cOrb);

            return result;
        }
Example #23
0
        public static Entity Trapdoor(bool mIsOff = false, List<int> mIDs = default(List<int>), bool mIsOnWater = false, bool mIsBroken = false)
        {
            var result = new Entity(Tile) {Layer = TDLLayers.Trapdoor, UpdateOrder = TDLOrders.Trapdoor};

            var trapdoorTexture = @"environment\trapdoor";
            if (mIsOnWater) trapdoorTexture = @"environment\watertrapdoor";

            var cRender = TDLComponentFactory.Render(trapdoorTexture, "onofftiles", "on");
            var cID = TDLComponentFactory.ID(mIDs);
            var cSwitch = TDLComponentFactory.Switch(cRender, mIsOff);
            var cIDSwitchAI = new TDCIDSwitchAI(cSwitch, cID);
            var cSpecialSquare = new TDCSpecialSquare(TDLPriorities.Trapdoor);
            var cTrapdoor = new TDCTrapdoor(mIsOnWater, mIsBroken, cSpecialSquare, cSwitch);

            if (mIsBroken) TDLMethods.AttachCrackedOverlay(cRender, 0);

            result.AddTags(TDLTags.GroundWalkable, TDLTags.Trapdoor);
            result.AddComponents(cRender, cID, cSwitch, cIDSwitchAI, cSpecialSquare, cTrapdoor);

            return result;
        }
Example #24
0
        public static Entity Oremites()
        {
            var result = new Entity(Tile) {Layer = TDLLayers.Trapdoor};

            var cRender = TDLComponentFactory.Render(@"environment\oremites", "doortiles", "single");
            var cRecalculateSprites = new TDCRecalculateSprites(TDLTags.Oremites, TDLRecalculations.RecalculateDoorSprite);
            var cSpecialSquare = new TDCSpecialSquare(TDLPriorities.Oremites);
            var cOremites = new TDCOremites(cSpecialSquare);

            result.AddTags(TDLTags.Oremites);
            result.AddComponents(cRender, cSpecialSquare, cOremites, cRecalculateSprites);

            return result;
        }
Example #25
0
        public static Entity Wall(bool mIsBroken = false)
        {
            var result = new Entity(Tile) {Layer = TDLLayers.Wall};

            var cRender = TDLComponentFactory.Render(@"environment\wall\purple", "walltiles", "single");
            var cHitByWeapon = new TDCHitByWeapon(TDCHitByWeapon.HitActions.Break);
            var cRecalculateSprites = new TDCRecalculateSprites(TDLTags.Wall, TDLRecalculations.RecalculateWallSprite);

            result.AddTags(TDLTags.Solid, TDLTags.Wall, TDLTags.HitByWeapon, TDLTags.GroundPathmapObstacle);
            result.AddComponents(cRender, cRecalculateSprites);
            if (mIsBroken)
            {
                TDLMethods.AttachBrokenOverlay(cRender);
                result.AddComponents(cHitByWeapon);
            }

            return result;
        }
Example #26
0
        public static Entity OrthogonalSquare(bool mIsOff = false, List<int> mIDs = default(List<int>))
        {
            var result = new Entity(Tile) {Layer = TDLLayers.Arrow, UpdateOrder = TDLOrders.Trapdoor};

            var cRender = TDLComponentFactory.Render(@"environment\orthogonalsquare", "onofftiles", "on");
            var cSpecialSquare = new TDCSpecialSquare(TDLPriorities.Arrow);
            var cID = TDLComponentFactory.ID(mIDs);
            var cSwitch = TDLComponentFactory.Switch(cRender, mIsOff);
            var cIDSwitchAI = new TDCIDSwitchAI(cSwitch, cID);
            var cOrthogonalSquare = new TDCOrthogonalSquare(cSpecialSquare, cSwitch);

            result.AddTags(TDLTags.OrthogonalSquare);
            result.AddComponents(cRender, cSpecialSquare, cID, cSwitch, cIDSwitchAI, cOrthogonalSquare);

            return result;
        }
Example #27
0
        public static Entity WeaponSlot(bool mIsOff = false, List<int> mIDs = default(List<int>), string mWeapon = "")
        {
            var result = new Entity(Tile) {Layer = TDLLayers.Arrow, UpdateOrder = TDLOrders.Trapdoor};

            var cRender = TDLComponentFactory.Render(@"elements\weaponslot", "onofftiles", "on");
            var cSpecialSquare = new TDCSpecialSquare(TDLPriorities.Trapdoor);
            var cID = TDLComponentFactory.ID(mIDs);
            var cSwitch = TDLComponentFactory.Switch(cRender, mIsOff);
            var cIDSwitchAI = new TDCIDSwitchAI(cSwitch, cID);
            var cWeaponSlot = new TDCWeaponSlot(cSpecialSquare, cRender);

            cRender.AddBlankSprite();

            if (mWeapon == "reallybigsword") cWeaponSlot.Weapon = ReallyBigSword();
            else if (mWeapon == "shortsword") cWeaponSlot.Weapon = ShortSword();
            else if (mWeapon == "woodensword") cWeaponSlot.Weapon = WoodenSword();

            if (cWeaponSlot.Weapon != null) cWeaponSlot.Weapon.IsOutOfField = true;
            cWeaponSlot.RecalculateWeaponSprite();

            result.AddTags(TDLTags.WeaponSlot);
            result.AddComponents(cRender, cSpecialSquare, cID, cSwitch, cIDSwitchAI, cWeaponSlot);

            return result;
        }
Example #28
0
        public static Entity Player(int mDirection = 0)
        {
            var result = new Entity(Tile) {Layer = TDLLayers.Roach, UpdateOrder = TDLOrders.Player};

            var outline1 = new TDCRenderSpriteOutline("humanoidtiles", @"humanoid\body\yellow", "n");
            var outline2 = new TDCRenderSpriteOutline("humanoidtiles", @"humanoid\hands\pink", "n");
            var outline3 = new TDCRenderSpriteOutline("humanoidtiles", @"humanoid\head\pink", "n");

            var cRender = new TDCRender(outline1, outline2, outline3) {IsLerped = true};
            var cDirection = new TDCDirection(mDirection);
            var cTarget = new TDCTarget();
            var cHitByWeapon = new TDCHitByWeapon(TDCHitByWeapon.HitActions.Kill);
            var cMovement = new TDCMovement(TDCMovement.MovementType.Direct, TDLTags.GroundAllowedTags, TDLTags.GroundObstacleTags, TDLTags.GroundExceptionTags);
            var cRenderDirectionAI = new TDCRenderDirectionAI(cRender, cDirection, "humanoidtiles");
            var cWielder = new TDCWielder(cMovement, cDirection);
            var cPathmapper = new TDCPathmapper(Instance, TDLPathmaps.SideGood);
            var cPlayer = new TDCPlayer(Game, cMovement, cDirection, cWielder);
            var cRoomSwitch = new TDCRoomSwitch(Game, cMovement);
            var cWielderRenderAI = new TDCWielderRenderAI(cWielder, cRender, cRenderDirectionAI);

            result.AddTags(TDLTags.Solid, TDLTags.Humanoid, TDLTags.SideGood, TDLTags.HitByWeapon,
                           TDLTags.Player, TDLTags.TunnelUser, TDLTags.WeightLow, TDLTags.BoosterUser);
            result.AddComponents(cRender, cDirection, cTarget, cHitByWeapon, cPlayer, cMovement, cRenderDirectionAI,
                                 cWielder, cPathmapper, cRoomSwitch, cWielderRenderAI);

            cWielder.SetWeapon(ReallyBigSword());

            /*cMovement.OnMovementFail += () =>
                                        {
                                            // This is only to prevent wall bump sounds if using a tunnel or a booster
                                            var x = cMovement.TargetX;
                                            var y = cMovement.TargetY;

                                            if (result.Field.HasEntityByTag(result.X, result.Y, TDLTags.Tunnel)) return;
                                            if (result.Field.HasEntityByTag(result.X, result.Y, TDLTags.Booster)) return;

                                            if (result.Field.HasEntityByTag(x, y, TDLTags.Wall)) TDLSounds.Play("SoundWallBump");
                                            else if (result.Field.HasEntityByTag(x, y, TDLTags.Pit)) TDLSounds.Play("SoundPitBump");
                                        };*/

            return result;
        }
Example #29
0
        public static Entity Booster(int mDirection = 0, bool mIsOff = false, List<int> mIDs = default(List<int>))
        {
            var result = new Entity(Tile) {Layer = TDLLayers.Arrow};

            var cRender = TDLComponentFactory.Render(@"elements\booster", "onoffdirtiles", "on_n");
            var cDirection = new TDCDirection(mDirection);
            var cSpecialSquare = new TDCSpecialSquare(TDLPriorities.Trapdoor);
            var cID = TDLComponentFactory.ID(mIDs);
            var cSwitch = new TDCSwitch(cRender, mIsOff);
            cSwitch.SetOffTextureRect(Assets.GetTileset("onoffdirtiles").GetTextureRect("off_" + cDirection.DirectionString));
            cSwitch.SetOnTextureRect(Assets.GetTileset("onoffdirtiles").GetTextureRect("on_" + cDirection.DirectionString));
            var cIDSwitchAI = new TDCIDSwitchAI(cSwitch, cID);
            var cBooster = new TDCBooster(cDirection, cSwitch, cSpecialSquare);

            result.AddTags(TDLTags.Booster);
            result.AddComponents(cRender, cSpecialSquare, cDirection, cID, cSwitch, cIDSwitchAI, cBooster);

            return result;
        }
Example #30
0
        private Entity SporeBase(int mX, int mY, float mDegrees, int mSpeed, string mTextureName, bool mEnemy)
        {
            var result = new Entity(_manager);

            var cBody = Body(new SSVector2I(mX, mY), 250, 250);
            var cMovement = Movement(cBody);
            var cRender = Render(cBody, mTextureName);

            cBody.Body.AddGroupsToCheck(Groups.Obstacle, Groups.Character);
            cBody.Body.AddGroupsToIgnoreResolve(Groups.Obstacle, Groups.Character);
            cBody.OnCollision += (mCollisionInfo) =>
                                 {
                                     var entity = (Entity)mCollisionInfo.UserData;

                                     var cHealth = entity.GetComponent<CHealth>();

                                     if (result.HasTag(Tags.SporeBlack) && entity.HasTag(Tags.DamagedByWhite))
                                     {
                                         cHealth++;
                                         result.Destroy();
                                     }
                                     else if (result.HasTag(Tags.SporeWhite) && entity.HasTag(Tags.DamagedByBlack))
                                     {
                                         cHealth++;
                                         result.Destroy();
                                     }

                                     if (entity.HasTag(Tags.DestroysBullets)) result.Destroy();
                                 };

            cMovement.Angle = mDegrees;
            cMovement.Speed = mSpeed;
            cMovement.Acceleration = -0.1f;

            cRender.Torque = 8;

            result.AddComponents(cBody, cMovement, cRender);
            result.AddTags(Tags.Spore);

            cRender.Sprite.Color = new Color(255, 255, 255, 125);

            return result;
        }