public EventMoveTo(Game gameIn, mapManager mapIn, gameElement elementToMoveIn, Vector2 destinationIn, GameTime gameTimeIn) { this.SetEventName("Move To"); associatedMap = mapIn; associatedGame = gameIn; elementToMove = (ActorElement)elementToMoveIn; destination = destinationIn; gameTime = gameTimeIn; pathFound = false; flowMapProduced = false; noPathExists = false; movementWasPossible = false; nextListTarget = 0; reattemptCounter = 0; originalDestination = destination; moveGoingOn = false; currentPath = new List <Vector2>(); currentPath.Clear(); nodeList = new List <MapNode>(); nodeList.Clear(); //setup a bool array the size of the map to determine which places have already been reviewed checkedMap = new bool[associatedMap.getNumberTilesX(), associatedMap.getNumberTilesY()]; for (int x = 0; x < associatedMap.getNumberTilesX(); x++) { for (int y = 0; y < associatedMap.getNumberTilesY(); y++) { checkedMap[x, y] = false; } } }
public void startBattle() { resourceManager = GetComponent <resourceManager>(); logManager = GetComponent <logManager>(); cameraManager = GetComponent <cameraManager>(); mapManager = GetComponent <mapManager>(); unitPanelManager = GetComponent <unitPanelManager>(); topPanelManager = GetComponent <topPanelManager>(); equipmentPanelManager = GetComponent <equipmentPanelManager>(); mapManager.initialize(); mapManager.generateMap(); mapManager.avalibityMapReset(false); cameraManager.initilize(); unitPanelManager.intialize(); topPanelManager.initialize(); equipmentPanelManager.initialize(); //temponary location allUnits = resourceManager.getActiveRooster(); allUnits.AddRange(resourceManager.getEnemyRooster()); foreach (Unit unit in allUnits) { unit.setPawn(resourceManager.getPawnPrefab()); unit.setPawnPosition(grid.CellToWorld(new Vector3Int(unit.getPosition()[0], unit.getPosition()[1], 0))); unit.rollInitiative(); mapManager.placeUnit(unit.getPosition()); } mapManager.avalibityMapReset(false); unitsToGo = allUnits; GameState = gameState.endTurn; }
public EventAddRocks(Game gameIn, mapManager mapIn, int numberOfRocksIn) { this.SetEventName("Add Rocks"); numberOfRocks = numberOfRocksIn; associatedMap = mapIn; associatedGame = gameIn; }
public WaterElement(Game game, int worldPositionXIn, int worldPositionYIn, mapManager mapManagerIn) : base(game, worldPositionXIn, worldPositionYIn) { elementName = "Water"; associatedMap = mapManagerIn; maxHealth = 0; currentHealth = 0; yield = 0; associatedGame = game; this.SetMovable(false); waterNormalMap = game.Content.Load <Effect>("FX/WaterNormal"); //generate normal maps normalSource = game.Content.Load <Texture2D>("waterNormalv2"); normalMap1 = new Texture2D(associatedGame.GraphicsDevice, GlobalVariables.TILE_SIZE, GlobalVariables.TILE_SIZE); normalMap2 = new Texture2D(associatedGame.GraphicsDevice, GlobalVariables.TILE_SIZE, GlobalVariables.TILE_SIZE); //generate underwater tile Texture2D waterFloorTemp = game.Content.Load <Texture2D>("UnderwaterV1.0"); Rectangle sourceRectangle = new Rectangle(0, 32, GlobalVariables.TILE_SIZE, GlobalVariables.TILE_SIZE); texture = new Texture2D(associatedGame.GraphicsDevice, sourceRectangle.Width, sourceRectangle.Height); Color[] data = new Color[sourceRectangle.Width * sourceRectangle.Height]; waterFloorTemp.GetData(0, sourceRectangle, data, 0, data.Length); texture.SetData(data); //generate water wall Texture2D waterWallTemp = game.Content.Load <Texture2D>("UnderwaterV1.0"); Rectangle sourceRectangle2 = new Rectangle(0, 0, GlobalVariables.TILE_SIZE, GlobalVariables.TILE_SIZE); texture2 = new Texture2D(associatedGame.GraphicsDevice, sourceRectangle2.Width, sourceRectangle2.Height); Color[] data2 = new Color[sourceRectangle2.Width * sourceRectangle2.Height]; waterWallTemp.GetData(0, sourceRectangle2, data2, 0, data2.Length); texture2.SetData(data2); }
private void Awake() { _mapManager = FindObjectOfType <mapManager>(); _xPositionsForTreedAndCoins = new float[10] { -4.3f, -2.7f, -1.1f, 0.5f, 2.1f, 3.7f, 5.3f, 6.9f, 8.5f, 10.1f }; _usedPos = new List <float>(); }
// Use this for initialization void Start() { manager = GameObject.Find("Map Manager").GetComponent <mapManager>(); seek = GetComponent <Seeker>(); anim = transform.GetComponentInChildren <guyAnim>(); seek.pathCallback += OnPathComplete; // targetPos = findLeastOccupiedBuilding().transform; //seek.StartPath(transform.position, targetPos.position, OnPathComplete); }
void Start() { thisMat = GetComponentInChildren <MeshRenderer>().material; manager = GetComponentInParent <mapManager>(); entryPos = transform.GetChild(0); road = transform.parent.Find("roadPiece").gameObject; sidewalk = transform.parent.Find("sidewalkPiece").gameObject; sidewalkPos = sidewalk.transform.position; roadPos = road.transform.position; initModels(); }
public EventHarvestTrees(Game gameIn, mapManager mapIn, EventManager eventManagerIn, gameElement focusElementIn, GameTime gameTimeIn, bool repeatingIn) { repeating = repeatingIn; associatedGame = gameIn; associatedEventManager = eventManagerIn; associatedMap = mapIn; gameTime = gameTimeIn; focusElement = (ActorElement)focusElementIn; treeLocation = new Vector2(-1, -1); nextToTree = false; seekingTree = false; }
public EventGenerateWorld(Game gameIn, mapManager mapIn, int numberTreesIn, int treeCyclesIn, int treeSpreadIn, int numberRocksIn) { this.SetEventName("Generate World"); numberTrees = numberTreesIn; treeCycles = treeCyclesIn; treeSpread = treeSpreadIn; numberRocks = numberRocksIn; treesCreated = false; rocksCreated = false; associatedMap = mapIn; associatedGame = gameIn; }
public EventHarvestRocks(Game gameIn, mapManager mapIn, EventManager eventManagerIn, gameElement focusElementIn, GameTime gameTimeIn, bool repeatingIn) { repeating = repeatingIn; associatedGame = gameIn; associatedEventManager = eventManagerIn; associatedMap = mapIn; gameTime = gameTimeIn; focusElement = (ActorElement)focusElementIn; retryCounter = 0; rockLocation = new Vector2(-1, -1); nextToRock = false; seekingRock = false; }
public EventAddTrees(Game gameIn, mapManager mapIn, int numberOfTreesIn, int numberOfCyclesIn, int spreadIn) { this.SetEventName("Add Trees"); numberOfTrees = numberOfTreesIn; numberOfCycles = numberOfCyclesIn; currentCycle = 0; associatedMap = mapIn; associatedGame = gameIn; spread = spreadIn; if (numberOfTreesIn == 0 || numberOfCyclesIn == 0) { this.SetComplete(); } }
public override bool Process(Game gameIn, mapManager mapIn, EventManager eventManagerIn, gameElement focusElementIn, GameTime gameTimeIn) { if (PriorityCondition.MarkedTreesExist()) { Event newEvent = new EventHarvestTrees(gameIn, mapIn, eventManagerIn, focusElementIn, gameTimeIn, false); newEvent.SetAssociated((ActorElement)focusElementIn); eventManagerIn.AddEvent(newEvent); return(true); } else { return(false); } }
/// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. protected override void Initialize() { //Define Systems /////////////////////////////////////////////////////////////// //Define the render layer renderer = new Renderer(); //XNA Settings //Choose one time step setting this.TargetElapsedTime = TimeSpan.FromSeconds(1.0f / 300.0f); //Fixed time step IsFixedTimeStep = false; //Variable //Screen settings renderer.setScreenSize(graphics, 1024, 768); this.IsMouseVisible = true; //Setup Map currentMap = new mapManager(this, mapTilesX, mapTilesY); //Setup Events eventManager = new EventManager(this, currentMap); //Setup UI uiManager = new UIManager(this, renderer, graphics.GraphicsDevice); //Setup Input inputManager = new InputManager(currentMap, uiManager); //Manage focus elementFocus.Clear(); //Add testing character currentMap.setOccupied(new Vector2((int)currentMap.getNumberTilesX() / 2, (int)currentMap.getNumberTilesY() / 2), true); currentMap.setOccupyingElement(new Vector2((int)currentMap.getNumberTilesX() / 2, (int)currentMap.getNumberTilesY() / 2), new WorkerElement(this, (int)currentMap.getNumberTilesX() / 2, (int)currentMap.getNumberTilesY() / 2)); currentMap.setOccupied(new Vector2((int)currentMap.getNumberTilesX() / 2 + 1, (int)currentMap.getNumberTilesY() / 2), true); currentMap.setOccupyingElement(new Vector2((int)currentMap.getNumberTilesX() / 2 + 1, (int)currentMap.getNumberTilesY() / 2), new WorkerElement(this, (int)currentMap.getNumberTilesX() / 2 + 1, (int)currentMap.getNumberTilesY() / 2)); currentMap.setOccupied(new Vector2((int)currentMap.getNumberTilesX() / 2 - 1, (int)currentMap.getNumberTilesY() / 2), true); currentMap.setOccupyingElement(new Vector2((int)currentMap.getNumberTilesX() / 2 - 1, (int)currentMap.getNumberTilesY() / 2), new WorkerElement(this, (int)currentMap.getNumberTilesX() / 2 - 1, (int)currentMap.getNumberTilesY() / 2)); //Variable initialization ////////////////////////////////////////////////////////////// //Generate map eventManager.AddEvent(new EventGenerateWorld(this, currentMap, 4, 90, 3, 10)); waterOffset = new Vector2(0, 0); base.Initialize(); }
private void Awake() { _realSpawnPos = Random.Range(0, 2); _mapManager = FindObjectOfType <mapManager>(); }
void Start() { myWalker = GetComponent <Walker>(); manager = GameObject.Find("Map Manager").GetComponent <mapManager>(); }
//Check the next priority entry for this Job public void ProcessJobPriorities(Game gameIn, mapManager mapIn, EventManager eventManagerIn, gameElement focusElementIn, GameTime gameTimeIn) { jobTaskList.ProcessNext(gameIn, mapIn, eventManagerIn, focusElementIn, gameTimeIn); }
public virtual bool Process(Game gameIn, mapManager mapIn, EventManager eventManagerIn, gameElement focusElementIn, GameTime gameTimeIn) { return(false); }