Trail growth

This commit is contained in:
Sewmina
2022-06-30 03:18:02 +05:30
parent 253710d137
commit f18f2562eb
14 changed files with 7159 additions and 7158 deletions

View File

@@ -10,7 +10,7 @@ using System.Net;
using System.Net.Sockets;
public class DBmanager : MonoBehaviour
{
public static string phpRoot = "http://38.242.232.13/upf/";
public static string phpRoot = "http://vps.playpoolstudios.com/upf/";
public static string username = null;
@@ -497,7 +497,8 @@ public class DBmanager : MonoBehaviour
public async static void AddInventoryItem(InventoryItem item)
{
bool exists = false;
if(inventory==null){inventory = new List<InventoryEntry>();}
foreach(InventoryEntry entry in inventory){
if(entry.Item == item.itemName){
entry.Count++;

View File

@@ -64,7 +64,7 @@ public class LoginManager : MonoBehaviour
MessageDialogInstance.messageDialog.ShowDialog("Error", "Please use a Strong password (should be more than 5 characters)");
return;
}
Debug.Log("Clicked register");
StartCoroutine(Register());
}
@@ -113,7 +113,7 @@ public class LoginManager : MonoBehaviour
WWWForm form = new WWWForm();
form.AddField("name", reg_username.text);
form.AddField("password", reg_password.text);
Debug.Log("Registering");
WWW www = new WWW(DBmanager.phpRoot + "register.php", form);
yield return www;
if (www.text == "0")

View File

@@ -10,6 +10,9 @@ public class SpaceshipController : NetworkBehaviour
public string pname;
[SyncVar(hook=nameof(OnScoresChanged))]
public int Scores;
[SyncVar(hook=nameof(OnTrailTimeChanged))]
public float trailTime;
public float trailIncrementRate = 0.5f;
[SyncVar]
public bool dead;
public Text pnameTxt;
@@ -42,6 +45,10 @@ public class SpaceshipController : NetworkBehaviour
Debug.Log($"Add scores { newScores - oldScores}, (total: {newScores})");
}
void OnTrailTimeChanged(float oldValue, float newValue){
trailMgr.trail.time = newValue;
}
void Start()
{
if (isLocalPlayer)
@@ -71,6 +78,7 @@ public class SpaceshipController : NetworkBehaviour
int lastClientUpdateTime = 0;
void FixedUpdate()
{
pnameTxt.rectTransform.rotation = Quaternion.Euler(Vector3.zero);
if(dead){return;}
if (isLocalPlayer)
@@ -330,14 +338,18 @@ public class SpaceshipController : NetworkBehaviour
Debug.Log($"{pname} killed {deadPlayer.pname}");
Scores+= 10; //TODO: Need to change Scores on kills?
trailTime = trailMgr.trail.time+ trailIncrementRate;
trailMgr.trail.time = trailTime;
}
}
public void Die(string killer){
Debug.Log("You got killed by " + killer);
Debug.Log($"Sending death signal to {pname} by {killer}");
//Handle Respawning
dead=true;
trailTime = 1;
trailMgr.trail.time = trailTime;
RpcDie(killer);
FindObjectOfType<MinigameManager>().SetRespawn(gameObject);
}

View File

@@ -111,7 +111,7 @@ public class WorldItemSelector : MonoBehaviour
if(pointerDiff < moveThreshold){
SelectScreenPoint(ped.position);
}else{
Debug.Log("Pointer moved (" + pointerDiff+ "), Not gonna select item");
// Debug.Log("Pointer moved (" + pointerDiff+ "), Not gonna select item");
}
startedPos = null;
holdingPointer=false;