public void Move() { if (health > 0) { bool needMove = false; if (Mathf.Abs(positionX - targetX) > 0.5f || Mathf.Abs(positionY - targetY) > 0.5f) { needMove = true; } if (fraction == "enemy") { if (checkEncounter(game.GetUnit(0)) || checkEncounter(game.GetUnit(1)) || checkEncounter(game.GetUnit(2))) { needMove = false; } } //Debug.Log(needMove); if (needMove) { Vector2 currentPos = new Vector2(positionX, positionY); Vector2 targetPos = new Vector2(targetX, targetY); Vector2 direction = Vector2.MoveTowards(currentPos, targetPos, Time.deltaTime * speed); positionX = direction.x; positionY = direction.y; } else if (targetX != finalTargetX || targetY != finalTargetY) { if (!isEndlessWalking) { selectFinalTarget(finalTargetX, finalTargetY); } else { startEndlessWalking(); } } else if (!isOnBoard) { if (fraction == "team") { game.missionComplete(massiveIndex); } } } }
void OnGUI() { PointBase unit = gameController.GetUnit(0); health0.text = "Health:" + unit.health; strength0.text = "Strength:" + unit.strength; intellect0.text = "Intellect:" + unit.intellect; social0.text = "Social:" + unit.social + " " + unit.readyDirection; unit = gameController.GetUnit(1); health1.text = "Health:" + unit.health; strength1.text = "Strength:" + unit.strength; intellect1.text = "Intellect:" + unit.intellect; social1.text = "Social:" + unit.social + " " + unit.readyDirection; unit = gameController.GetUnit(2); health2.text = "Health:" + unit.health; strength2.text = "Strength:" + unit.strength; intellect2.text = "Intellect:" + unit.intellect; social2.text = "Social:" + unit.social + " " + unit.readyDirection; }