public TDCPlayer(TDGGame mGame, TDCMovement mMovementComponent, TDCDirection mDirectionComponent, TDCWielder mWielderComponent) { _game = mGame; _movementComponent = mMovementComponent; _directionComponent = mDirectionComponent; _wielderComponent = mWielderComponent; }
public TDCWielderTargetAI(TDCTarget mTargetComponent, TDCMovement mMovementComponent, TDCDirection mDirectionComponent, TDCWielder mWielderComponent) { _targetComponent = mTargetComponent; _movementComponent = mMovementComponent; _directionComponent = mDirectionComponent; _wielderComponent = mWielderComponent; }
public TDCWielder(TDCMovement mMovementComponent, TDCDirection mDirectionComponent) { _movementComponent = mMovementComponent; _directionComponent = mDirectionComponent; _movementComponent.OnMovementSuccess += SyncWeaponWithWielder; _movementComponent.OnMovementFail += SyncWeaponWithWielder; }
public TDCBooster(TDCDirection mDirectionComponent, TDCSwitch mSwitchComponent, TDCSpecialSquare mSpecialSquareComponent) { _directionComponent = mDirectionComponent; _switchComponent = mSwitchComponent; _specialSquareComponent = mSpecialSquareComponent; _specialSquareComponent.OnMoveFromAllowed += SpecialSquareFrom; }
public TDCArrow(TDCSpecialSquare mSpecialSquareComponent, TDCDirection mDirectionComponent, TDCSwitch mSwitchComponent) { _directionComponent = mDirectionComponent; _switchComponent = mSwitchComponent; mSpecialSquareComponent.OnMoveFromAllowed += SpecialSquareMove; mSpecialSquareComponent.OnMoveToAllowed += SpecialSquareMove; }
public TDCTunnel(TDCRender mRenderComponent, TDCDirection mDirectionComponent, TDCSpecialSquare mSpecialSquareComponent) { _renderComponent = mRenderComponent; _directionComponent = mDirectionComponent; _specialSquareComponent = mSpecialSquareComponent; _renderComponent.OnDraw += Draw; _specialSquareComponent.OnMoveFromAllowed += SpecialSquareFrom; _specialSquareComponent.OnMoveToAllowed += SpecialSquareTo; }
public TDCRenderDirectionAI(TDCRender mRenderComponent, TDCDirection mDirectionComponent, string mTilesetName, string mPrefix = "", string mSuffix = "") { _renderComponent = mRenderComponent; _directionComponent = mDirectionComponent; TilesetName = mTilesetName; Prefix = mPrefix; Suffix = mSuffix; _renderComponent.OnDraw += () => _renderComponent.GetSprites().ForEach(x => x.TextureRect = Assets.GetTileset(TilesetName).GetTextureRect(Prefix + _directionComponent.DirectionString + Suffix)); }
public TDCMovementTargetAI(TDGInstance mInstance, TDCMovement mMovementComponent, TDCTarget mTargetComponent, TDCDirection mDirectionComponent, string mPathmapName, bool mSetsDirection = true, bool mIsPathfinder = false, bool mIsObstinate = true, bool mUsesPathmap = true, bool mIncludesStartNode = false) { _instance = mInstance; _movementComponent = mMovementComponent; _targetComponent = mTargetComponent; _directionComponent = mDirectionComponent; SetsDirection = mSetsDirection; IsPathfinder = mIsPathfinder; IsObstinate = mIsObstinate; UsesPathmap = mUsesPathmap; PathmapName = mPathmapName; IncludesStartNode = mIncludesStartNode; }
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 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; }
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; }
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; }
// 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; }
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; }
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; }