Commit c3d0abdd authored by Joe Libipl's avatar Joe Libipl

Finished (for now) converting NPCs to CellLoc.

parent b8f78f0a
......@@ -12,3 +12,4 @@
sanctuary
ste-reez-muvi.v12.suo
......@@ -92,8 +92,8 @@ public class CameraControlScript : MonoBehaviour {
angle -= 360F;
}
public void lookAtNpc(Vector3 npcCoords) {
transform.position = new Vector3((-1f) * npcCoords.x, (-1f) * npcCoords.y, (0.1f * npcCoords.z) + 15f);
transform.LookAt(new Vector3((-1f) * npcCoords.x, (-1f) * npcCoords.y, npcCoords.z));
public void lookAtNpc(Vector3 npcPos) {
transform.position = new Vector3(npcPos.x, npcPos.y, npcPos.z - 15f);
transform.LookAt(npcPos);
}
}
......@@ -21,7 +21,7 @@ namespace DragonsSpine.DAL
public static SqlConnection GetSQLConnection()
{
// string sConnStr = "User ID='db1_readonly';Password='IMakeMaps';Initial Catalog='DSpineBackup';Data Source='AQUALUNG\\SQLEXPRESS';Connect Timeout=15";
string sConnStr = "User ID='db1_readonly';Password='IMakeMaps';Initial Catalog='dragonsspine';Data Source='localhost\\MYTESTSQL';Connect Timeout=15";
string sConnStr = "User ID='db1_readonly';Password='IMakeMaps';Initial Catalog='dragonsspine';Data Source='localhost\\MYTESTSQL';Connect Timeout=30";
Utils.Log(sConnStr, Utils.LogType.SystemFailure);
try
{
......
Assets/Images/arrow_red.png

9.88 KB | W: | H:

Assets/Images/arrow_red.png

9.76 KB | W: | H:

Assets/Images/arrow_red.png
Assets/Images/arrow_red.png
Assets/Images/arrow_red.png
Assets/Images/arrow_red.png
  • 2-up
  • Swipe
  • Onion skin
using UnityEngine;
using System.Text;
public class GUIManager : MonoBehaviour {
private static GUIManager instance;
public MapManager mapManager;
public NpcManager npcManager;
public CameraControlScript mainCamera;
void Start () {
instance = this;
}
void Update () {
if (Input.GetKeyDown (KeyCode.Z)) {
mapManager.CycleZ(false);
}
if (Input.GetKeyDown (KeyCode.A)) {
mapManager.CycleZ(true);
}
if (Input.GetKeyDown (KeyCode.Space)) {
mainCamera.ReturnToHome();
}
if (Input.GetKeyDown (KeyCode.N)) {
using UnityEngine;
using System.Text;
public class GUIManager : MonoBehaviour {
private static GUIManager instance;
public MapManager mapManager;
public NpcManager npcManager;
public CameraControlScript mainCamera;
void Start () {
instance = this;
}
void Update () {
if (Input.GetKeyDown (KeyCode.Z)) {
mapManager.CycleZ(false);
}
if (Input.GetKeyDown (KeyCode.A)) {
mapManager.CycleZ(true);
}
if (Input.GetKeyDown (KeyCode.Space)) {
mainCamera.ReturnToHome();
}
if (Input.GetKeyDown (KeyCode.N)) {
CellLoc randomNpcCell = npcManager.locateRandomNpc();
Vector3 randomNpcPos = CLUtils.CellLocToVector3(randomNpcCell, 1);
mainCamera.lookAtNpc(randomNpcPos);
mapManager.UpdateZ(randomNpcPos.z + 1f);
}
}
void OnGUI(){
GUI.Box (new Rect (0,0,100,50), "# of cells\n" + mapManager.num_cells);
GUI.Box (new Rect (100,0,100,50), "NPC Instances\n" + npcManager.NumNpcScripts);
GUI.Box (new Rect (200,0,100,50), "Active NPC Insts\n" + npcManager.NumActiveNpcScripts);
GUI.Box (new Rect (300,0,100,50), "NPCs in DB\n" + npcManager.NumNpcsInDb);
GUI.Box (new Rect (Screen.width - 100,0,100,50), "# of blocks\n" + mapManager.num_blocks);
GUI.Box (new Rect (0,Screen.height - 50,100,50), "Z top\n" + mapManager.zTop);
StringBuilder builder = new StringBuilder();
foreach (int gameRound in npcManager.activeGameRounds)
builder.Append(gameRound).Append(" ");
GUI.Box (new Rect (Screen.width - 100,Screen.height - 50,100,50), "Game Round\n" + builder.ToString());
}
}
Vector3 randomNpcPos = CLUtils.CellLocToVector3(randomNpcCell, 1);
mainCamera.lookAtNpc(randomNpcPos);
mapManager.UpdateZ(randomNpcCell.z);
}
}
void OnGUI(){
GUI.Box (new Rect (0,0,100,50), "# of cells\n" + mapManager.num_cells);
GUI.Box (new Rect (100,0,100,50), "NPC Instances\n" + npcManager.NumNpcScripts);
GUI.Box (new Rect (200,0,100,50), "Active NPC Insts\n" + npcManager.NumActiveNpcScripts);
GUI.Box (new Rect (300,0,100,50), "NPCs in DB\n" + npcManager.NumNpcsInDb);
GUI.Box (new Rect (Screen.width - 100,0,100,50), "# of blocks\n" + mapManager.num_blocks);
GUI.Box (new Rect (0,Screen.height - 50,100,50), "Z top\n" + mapManager.zTop);
StringBuilder builder = new StringBuilder();
foreach (int gameRound in npcManager.activeGameRounds)
builder.Append(gameRound).Append(" ");
GUI.Box (new Rect (Screen.width - 100,Screen.height - 50,100,50), "Game Round\n" + builder.ToString());
}
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -38,10 +38,9 @@ public class CLUtils {
position.x = c.x - 0.5f; // left side
position.x += (1f / (c.dim * 2f)); // first position
position.x += xPos * (1f / c.dim);
position.y = c.y - 0.5f; // top side
position.y += (1f / (c.dim * 2f)); // first position
position.y += yPos * (1f / c.dim);
position.y *= -1f;
position.y = (-1f) * c.y + 0.5f; // top side
position.y -= (1f / (c.dim * 2f)); // first position
position.y -= yPos * (1f / c.dim);
position.z = (-0.1f) * (c.z + layer);
return position;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment