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; } } }
private Task ReadTask(XmlNode _taskNode) { Task task = new Task(); task.taskContnent = ((XmlElement)_taskNode.SelectSingleNode("TaskText")).InnerText; task.targetGameObject = ((XmlElement)_taskNode.SelectSingleNode("TaskText")).GetAttribute("targetGameObject"); foreach (XmlNode Xmlreward in _taskNode.SelectSingleNode("RewardList").ChildNodes) { Tool reward = new Tool(); reward.ToolName = ((XmlElement)Xmlreward).InnerText; reward.ToolType = ((XmlElement)Xmlreward).GetAttribute("ToolType"); string s = ((XmlElement)Xmlreward).GetAttribute("Value"); if (((XmlElement)Xmlreward).GetAttribute("Value") == "") { reward.value = 0; } else { reward.value = float.Parse(((XmlElement)Xmlreward).GetAttribute("Value")); } task.rewardList.Add(reward); } XmlNode commandNode = _taskNode.SelectSingleNode("storyCommand"); if (commandNode != null) { storyCommand story_command = new storyCommand(); story_command.commandType = ((XmlElement)commandNode).GetAttribute("commandType"); List <gameElement> gameObjList = new List <gameElement>(); XmlNodeList xmlgameList = commandNode.SelectSingleNode("gameObjectList").ChildNodes; foreach (XmlNode node in xmlgameList) { gameElement game = new gameElement(); XmlElement game_element = (XmlElement)node; game.gameObj = game_element.InnerText; game.position.x = float.Parse(game_element.GetAttribute("PositionX")); game.position.y = float.Parse(game_element.GetAttribute("PositionY")); game.position.z = float.Parse(game_element.GetAttribute("PositionZ")); gameObjList.Add(game); } story_command.gameList = gameObjList; task.story_command = story_command; } else { task.story_command = null; } return(task); }
GameObject[] GetGameElements() { GameObject[] array = FindObjectsOfType <GameObject>(); List <GameObject> result = new List <GameObject>(); for (int i = 0; i < array.Length; i++) { try { gameElement ga = array[i].GetComponent <gameElement>(); ga.test(); if (array[i].activeInHierarchy && ga != null) { result.Add(array[i]); } } catch (NullReferenceException a) { } } return(result.ToArray()); }
public void DrawCurrentFocusActionIcons(gameElement focusElement, InputManager inputManager) { //No icons if (focusElement.GetIconTypes() == 0) { } // Icons if (focusElement.GetIconTypes() == 1) { associatedRenderer.drawTexturedRectangle(harvestIconX - (harvestIconDiameter / 2), harvestIconY - (harvestIconDiameter / 2), harvestIconDiameter, harvestIconDiameter, harvestIcon); associatedRenderer.drawTexturedRectangle(mineIconX - (mineIconDiameter / 2), mineIconY - (mineIconDiameter / 2), mineIconDiameter, mineIconDiameter, mineIcon); //check for focus //Harvest icon if (this.OverHarvestIcon(inputManager)) { associatedRenderer.drawTexturedRectangle(harvestIconX - (harvestIconDiameter / 2), harvestIconY - (harvestIconDiameter / 2), harvestIconDiameter, harvestIconDiameter, iconFocus); } //Mining icon if (this.OverMineIcon(inputManager)) { associatedRenderer.drawTexturedRectangle(mineIconX - (mineIconDiameter / 2), mineIconY - (mineIconDiameter / 2), mineIconDiameter, mineIconDiameter, iconFocus); } } }
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 virtual bool Process(Game gameIn, mapManager mapIn, EventManager eventManagerIn, gameElement focusElementIn, GameTime gameTimeIn) { return(false); }
//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 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); } }
public void setOccupyingElement(Vector2 focusTile, gameElement element) { occupyingElement[(int)focusTile.X + ((int)focusTile.Y * sizeX)] = element; }
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 void DrawCurrentObjectFocus(gameElement focusElement) { associatedRenderer.drawTexturedRectangle((int)focusElement.GetAnimationOffset().X + focusElement.getWorldPositionX() * GlobalVariables.TILE_SIZE, (int)focusElement.GetAnimationOffset().Y + focusElement.getWorldPositionY() * GlobalVariables.TILE_SIZE, GlobalVariables.TILE_SIZE, GlobalVariables.TILE_SIZE, focus2); }