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 TDCPathmapper(TDGInstance mInstance, string mPathmapName) { _instance = mInstance; _pathmapName = mPathmapName; }
private void SetInstance(TDGInstance mInstance, int mPlayerX, int mPlayerY, int mPlayerDirection) { _instance = mInstance; _instance.CreatePlayer(mPlayerX, mPlayerY, mPlayerDirection); _instance.RunLoadChecks(); // Starting variables _currentTurn = 0; _playerAlive = true; // Reset and set undo stuff _undoValues.PlayerStartX = mPlayerX; _undoValues.PlayerStartY = mPlayerY; _undoValues.PlayerStartDirection = mPlayerDirection; }
private TDGInstance CreateInstance(TDSRoom mRoom, bool mTemporary = false) { var result = new TDGInstance(this, mTemporary); TDLFactory.Instance = result; // Initialize field and pathfinder result.Initialize(mRoom.Level.RoomWidth, mRoom.Level.RoomHeight); // Refresh texture size, if instance isn't temporary if (!mTemporary) RefreshGFX(TDUtils.TileSize*result.Width, TDUtils.TileSize*result.Height); // Fill the instance with floor for (var iY = 0; iY < result.Height; iY++) for (var iX = 0; iX < result.Width; iX++) { TDLFactory.Tile = result.GetTile(iX, iY); result.AddEntity(TDLFactory.Floor()); } // Get all tiles from the editor tilemanager and create corrispondent entities foreach (var tileManagerEntity in mRoom.TileManager.Entities) { var methodInfo = tileManagerEntity.Outline.MethodInfo; var parameterValues = new object[tileManagerEntity.Parameters.Count]; for (var i = 0; i < tileManagerEntity.Parameters.Count; i++) parameterValues[i] = tileManagerEntity.Parameters[i].Value; TDLFactory.Tile = result.GetTile(tileManagerEntity.Tile.X, tileManagerEntity.Tile.Y); var invokedEntity = (Entity) methodInfo.Invoke(null, parameterValues); result.AddEntity(invokedEntity); // If the room was cleared previously and the entity is required, destroy it instantly // This means that if the player returns to the room after it was cleared, there are no mobs if (mRoom.IsClear && invokedEntity.HasTag(TDLTags.RequiredKill)) invokedEntity.Destroy(); } result.CalculatePathmaps(); return result; }