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; }
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; }
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; }
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; }
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; }
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; }