// Update is called once per frame public void Update() { UpdateHealth(); if (isTurn) { if (!hasMoved && numActions > 0 && Input.GetMouseButtonDown(0) && TileMousePos.IsValid()) { hasMoved = true; numActions--; targetPos = new Vector3(TileMousePos.mousePos.x, this.transform.position.y, TileMousePos.mousePos.z); List <Vector3> path = pathfind.FindPath(this.transform.position, targetPos); rom.SetPoints(path); rom.move = true; } if (this.transform.position == targetPos) { rom.move = false; pathfind.Reset(); } if (numActions <= 0) { EndTurn(); } } }
void OnMouseExit() { TileMousePos.LeavePosition(); rend.material.color = Color.white; }
void OnMouseEnter() { TileMousePos.NewPosition(this.transform.position); rend.material.color = Color.red; }