Smooth Camera and Room Exist check
This commit is contained in:
@@ -29,6 +29,7 @@ public class NoPlayablePlayer : Player
|
||||
|
||||
public void Wurfeln(int wurfelZahl)
|
||||
{
|
||||
wurfelt = true;
|
||||
this.wurfelZahl = wurfelZahl;
|
||||
//nächstes Feld anvisieren
|
||||
TargetNextField();
|
||||
@@ -52,18 +53,21 @@ public class NoPlayablePlayer : Player
|
||||
wait = false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void FixedUpdate()
|
||||
{
|
||||
|
||||
if (activated)
|
||||
{
|
||||
camera.transform.position = Vector3.SmoothDamp(camera.transform.position, transform.position + cameraOffset, ref velocity, 0.2f);
|
||||
|
||||
if (!wait)
|
||||
{
|
||||
//Laufe zum nöchsten Feld, falls noch Züge übrig sind
|
||||
if (interPol < 1 && wurfelZahl > 0)
|
||||
{
|
||||
//delay
|
||||
if (Time.time - timeSinceWurfeln > 1)
|
||||
if (Time.time - timeSinceWurfeln > 2)
|
||||
{
|
||||
InterPolerate();
|
||||
}
|
||||
@@ -82,10 +86,13 @@ public class NoPlayablePlayer : Player
|
||||
//Der Spieler steht gerade
|
||||
else
|
||||
{
|
||||
//start the dice
|
||||
dice.transform.position = Vector3.SmoothDamp(dice.transform.position,
|
||||
transform.position + Vector3.up * 2, ref useLess, 0.2f);
|
||||
diceScript.StartRandom();
|
||||
if (!wurfelt)
|
||||
{
|
||||
//start the dice
|
||||
dice.transform.position = Vector3.SmoothDamp(dice.transform.position,
|
||||
transform.position + Vector3.up * 2, ref useLess, 0.2f);
|
||||
diceScript.StartRandom();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -18,6 +18,7 @@ public class PlayablePlayer : Player
|
||||
|
||||
|
||||
private float timeSinceWurfeln = 0;
|
||||
private float timeSinceStop = 0;
|
||||
|
||||
private Vector3 useLess = new Vector3();
|
||||
|
||||
@@ -59,13 +60,15 @@ public class PlayablePlayer : Player
|
||||
{
|
||||
if (activated)
|
||||
{
|
||||
camera.transform.position = Vector3.SmoothDamp(camera.transform.position, transform.position + cameraOffset, ref velocity, 0.2f);
|
||||
|
||||
if (!wait)
|
||||
{
|
||||
//Laufe zum nöchsten Feld, falls noch Züge übrig sind
|
||||
if (interPol < 1 && wurfelZahl > 0)
|
||||
{
|
||||
//delay
|
||||
if (Time.time - timeSinceWurfeln > 1)
|
||||
if (Time.time - timeSinceWurfeln > 2)
|
||||
{
|
||||
InterPolerate();
|
||||
}
|
||||
@@ -84,17 +87,19 @@ public class PlayablePlayer : Player
|
||||
//Der Spieler steht gerade
|
||||
else
|
||||
{
|
||||
//start the dice
|
||||
dice.transform.position = Vector3.SmoothDamp(dice.transform.position,
|
||||
transform.position + Vector3.up * 2, ref useLess, 0.2f);
|
||||
diceScript.StartRandom();
|
||||
|
||||
//TODO: temp spieler finsihed erst, wenn field action ausgeführt wurde
|
||||
if (wurfelt)
|
||||
{
|
||||
client.SendFinished();
|
||||
Invoke("Finish", 2);
|
||||
activated = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
//start the dice
|
||||
dice.transform.position = Vector3.SmoothDamp(dice.transform.position,
|
||||
transform.position + Vector3.up * 2, ref useLess, 0.2f);
|
||||
diceScript.StartRandom();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -157,5 +162,9 @@ public class PlayablePlayer : Player
|
||||
transform.position = new Vector3(nextPoint.x, transform.position.y, nextPoint.z);
|
||||
interPol += (Time.deltaTime * speed) / Mathf.Abs(Vector3.Distance(moveTo, lastPos));
|
||||
}
|
||||
|
||||
|
||||
private void Finish()
|
||||
{
|
||||
client.SendFinished();
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,11 @@ public class Player : MonoBehaviour
|
||||
public bool activated = false;
|
||||
protected bool wurfelt = false;
|
||||
|
||||
public GameObject camera;
|
||||
protected Vector3 velocity = Vector3.zero;
|
||||
|
||||
protected Vector3 cameraOffset = new Vector3(-5.81f, 8.13f, 7.6f);
|
||||
|
||||
//Aktiviert den Player
|
||||
public void Activate()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user