//static void MakeAttackZone(Hero hero, Hero initialTarget, out List<Hero> targets, List<Hero> enemyList) //{ // targets = new List<Hero>(); // int place; // if (initialTarget != null) // { // place = Mathf.Clamp(initialTarget.mySlot.myPlace, 1, 3); // } else { // place = Mathf.Clamp(enemyList[0].mySlot.myPlace, 1, 3); //default behaviour, change later to attack lowest max HP target // } // //make into square-shape target function // TryAddTarget(AIenemies.GetSlotByCoord(1, place)); // TryAddTarget(AIenemies.GetSlotByCoord(2, place)); // ++place; // TryAddTarget(AIenemies.GetSlotByCoord(1, place)); // TryAddTarget(AIenemies.GetSlotByCoord(2, place)); //} //static void MakeBuffZone(Hero hero, Hero initialTarget, out List<Hero> targets) //{ // targets = new List<Hero>(); // int place = 0; // if (initialTarget != null) // { // place = Mathf.Clamp(initialTarget.mySlot.myPlace, 1, 3); // } // else // { // Debug.LogError("unintended AI solution"); // return; // } // //make into square-shape target function //} static void CubicalTarget(BattleGrid grid, Hero initialTarget, out List <Hero> targets) { targets = new List <Hero>(); int place = 0; if (initialTarget != null) { place = Mathf.Clamp(initialTarget.mySlot.myPlace, 1, 3); } else { Debug.LogError("unintended AI solution"); return; } List <Slot> slots = new List <Slot>(); slots.Add(grid.GetSlotByCoord(1, place)); slots.Add(grid.GetSlotByCoord(2, place)); place++; slots.Add(grid.GetSlotByCoord(1, place)); slots.Add(grid.GetSlotByCoord(2, place)); ExtractSlotHeroes(slots, out targets); }
//method that handles how targets are chosen and how to visualise it // maybe i gotta separate visual and functional part... public void ChooseTargets() { ray = Camera.main.ScreenPointToRay(Input.mousePosition); RaycastHit hit; if (Physics.Raycast(ray, out hit)) { lastRememberedSlot = hit.collider.gameObject.GetComponent <Slot>(); if (currentSlot == null) { currentSlot = lastRememberedSlot.myGrid.Slots[0]; } } if (currentSlot != null && !chosenSlots.Contains(lastRememberedSlot)) { setDirection(lastRememberedSlot.myPlace, currentSlot.myPlace); currentGrid = currentSlot.myGrid; currentSlotmaker = rulerDict[currentGrid.side]; currentMaterial = selector.GetComponent <MeshRenderer>(); if (currentGrid.side == Affiliation.Ally) { selector.GetComponent <MeshRenderer>().materials[0].SetColor("_Color", Color.green); } else if (currentGrid.side == Affiliation.Enemy) { selector.GetComponent <MeshRenderer>().materials[0].SetColor("_Color", Color.red); } int checkPlace = Mathf.Clamp(currentSlot.myPlace, 1, 3); chosenSlots.Clear(); chosenSlots.Add(currentGrid.GetSlotByCoord(1, checkPlace)); chosenSlots.Add(currentGrid.GetSlotByCoord(2, checkPlace)); chosenSlots.Add(currentGrid.GetSlotByCoord(1, checkPlace + 1)); chosenSlots.Add(currentGrid.GetSlotByCoord(2, checkPlace + 1)); selector.SetActive(true); selector.transform.position = new Vector3( currentSlotmaker.lowerRuler.transform.position.x + 2 * currentSlotmaker.slotHalfWidth, 0.5f, currentSlotmaker.lowerRuler.transform.position.z + (2 * checkPlace) * currentSlotmaker.slotHalfHeight ); currentSlot = lastRememberedSlot.myGrid.GetSlotByCoord(1, currentSlot.myPlace + direction); } }