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
......@@ -26,7 +26,7 @@ public class GUIManager : MonoBehaviour {
CellLoc randomNpcCell = npcManager.locateRandomNpc();
Vector3 randomNpcPos = CLUtils.CellLocToVector3(randomNpcCell, 1);
mainCamera.lookAtNpc(randomNpcPos);
mapManager.UpdateZ(randomNpcPos.z + 1f);
mapManager.UpdateZ(randomNpcCell.z);
}
}
......
......@@ -236,6 +236,7 @@ public class MapManager : MonoBehaviour {
return true;
} else {
print ("Failed to load map!");
Application.Quit();
return false;
}
}
......
......@@ -24,6 +24,7 @@ public class NpcScript : MonoBehaviour {
public Transform damagePrefab;
public Transform hatredPrefab;
private Renderer myRend;
private Transform myDamage;
private Renderer myDamageRend;
private Transform myHatred;
......@@ -80,6 +81,7 @@ public class NpcScript : MonoBehaviour {
void Awake () {
Reset();
myRend = GetComponent<Renderer>();
}
public void Reset() {
......@@ -113,16 +115,17 @@ public class NpcScript : MonoBehaviour {
}
// disappear if desired
GetComponent<Renderer>().enabled = toBeSeen;
myRend.enabled = toBeSeen;
}
public void UpdateMaterial(int currRound) {
if (lastActiveRound >= currRound-1 && Health > 0f) // one round leeway in case we catch the DB in mid-update
GetComponent<Renderer>().material = liveMaterial;
myRend.material = liveMaterial;
else {
presumedDead = true;
GetComponent<Renderer>().material = deadMaterial;
myRend.material = deadMaterial;
}
myRend.material.mainTextureScale = new Vector2(-1f,-1f);
}
IEnumerator Damage () {
......@@ -132,7 +135,7 @@ public class NpcScript : MonoBehaviour {
Vector3.zero,
Quaternion.identity) as Transform;
myDamage.parent = this.transform;
myDamage.localPosition = new Vector3(0f, 0f, 0.1f);
myDamage.localPosition = new Vector3(0f, 0f, -0.1f);
myDamageRend = myDamage.GetComponent<Renderer>();
}
myDamage.localScale = new Vector3(1f, 1f - Health, 1f);
......@@ -149,7 +152,7 @@ public class NpcScript : MonoBehaviour {
Vector3.zero,
Quaternion.identity) as Transform;
myHatred.parent = this.transform;
myHatred.localPosition = new Vector3(0f, 0f, 0.2f);
myHatred.localPosition = new Vector3(0f, 0f, -0.2f);
myHatredRend = myHatred.GetComponent<Renderer>();
}
hatedLocation = npcManager.locateNpc(mostHatedId);
......@@ -165,7 +168,7 @@ public class NpcScript : MonoBehaviour {
myHatred.localScale = new Vector3(0.3f, 0.1f, 1f);
Vector3 startPos = transform.position + hatredDir * transform.localScale.x * 0.5f;
Vector3 endPos = hatedLocation - hatredDir * transform.localScale.x * 0.5f;
startPos.z += 0.2f; endPos.z += 0.2f;
startPos.z -= 0.2f; endPos.z -= 0.2f;
myHatred.position = Vector3.Lerp(startPos, endPos, Time.time % 1f);
myHatredRend.enabled = toBeSeen;
......
......@@ -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