//---- used to 'teleport' creatures across the map-------------- public void moveModel(GameObject[] path = null, int currentX = 0, int currentY = 0, int currentZ = 0, int endX = 1, int endY = 1, int endZ = 1) {//(wip) this function will move the model across the grid Grid_Character_Movement Grid_Character_Movement = new Grid_Character_Movement(); g = Grid_Character_Movement.findGridUnitByCordinate(endX, endY, endZ); if (g == null) { print("There seems to be a problem"); } else { creature.transform.position = g.transform.position; // is just a place holder for now // animate character moving // must read the array and animate the model accordingling } }
public void ai_mouseHover(int x, int y, int z, bool unselect = false) {//(wip) this function will update the mouse selection if (unselect == false) { Grid_Character_Movement Grid_Character_Movement = new Grid_Character_Movement(); GameObject g = Grid_Character_Movement.findGridUnitByCordinate(x, y, z); script = g.GetComponent <Grid_Unit_Script>(); selectedGridUnit.x = script.x; selectedGridUnit.y = script.y; selectedGridUnit.z = script.z; script.selection.SetActive(true); } if (unselect == true) { script.selection.SetActive(false); } print("The enemy has selected a space"); }
// ------------------- action processing ----------------------------- public void outgoingActionProcessing(int[] creaturePos, int[,] targetPos, Action act = null) {//(wip) this script will find the creature to do the action to and will send the needed data to that given creature if (isTurn) { if (numOfAvailibleActions > 0) { Grid_Character_Movement Grid_Character_Movement = new Grid_Character_Movement(); if (currentAct != null) { act = currentAct; } if (act == null) { print("this creature needs an action selected first"); } else { print("processing the action " + act.name); Grid_Character_Movement.resetAreaOfMovement(); Grid_Character_Movement.findAreaOfMovement(currentX: creaturePos[0], currentY: creaturePos[1], currentZ: creaturePos[2], numOfSteps: act.range); GameObject[] creatures = GameObject.FindGameObjectsWithTag("creature"); for (int i = 0; i < targetPos.GetLength(0); i++) { int x = targetPos[i, 0]; int y = targetPos[i, 1]; int z = targetPos[i, 2]; foreach (GameObject creature in creatures) { int creatureX = creature.GetComponent <Creature_Stats>().currentX; int creatureY = creature.GetComponent <Creature_Stats>().currentY; int creatureZ = creature.GetComponent <Creature_Stats>().currentZ; if (creatureX == x && creatureY == y && creatureZ == z && !Grid_Character_Movement.gridUnitChecker(Grid_Character_Movement.findGridUnitByCordinate(x, y, z))) { print("a target has been found"); foundTarget = true; creature.GetComponent <Grid_Character_Turn_Manager>().incomingActionProcessing(act); } } } //run polish here-------------- if (act.animationName != null) { if (act.animationAccessType == "trigger") { Grid_Character_Model_Movement.preformAnimationTrigger(act.animationAccessID); } if (act.animationAccessType == "bool") { Grid_Character_Model_Movement.preformAnimationBool(act.animationAccessID); } } //---------------------------- numOfAvailibleActions--; Grid_Character_Movement.resetAreaOfMovement(); } } else { print("this creature has no more actions avalible"); } } else { print("it is not this creatures turn"); } }