Skip to content

Commit

Permalink
some fixes to debug mode
Browse files Browse the repository at this point in the history
  • Loading branch information
corinnaj committed May 15, 2021
1 parent 3df81f2 commit c1f2965
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 13 deletions.
4 changes: 4 additions & 0 deletions Assets/PantoScripts/Level.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,5 +62,9 @@ async private Task IntroduceObject(ObjectOfInterest objectOfInterest, int msDela
await Task.WhenAll(tasks);
await Task.Delay(msDelay);
}
void OnApplicationQuit()
{
speechOut.Stop();
}
}
}
31 changes: 18 additions & 13 deletions Assets/PantoScripts/PantoHandle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,9 @@ public float GetRotation()
{
if (userControlledRotation)
{
return rotation;
//return rotation;
GameObject debugObject = pantoSync.GetDebugObject(isUpper);
return debugObject.transform.eulerAngles.y;
}
else
{
Expand Down Expand Up @@ -214,6 +216,10 @@ public bool IsUserControlled()
{
return userControlledPosition;
}
public bool IsRotationUserControlled()
{
return userControlledRotation;
}

float MaxMovementSpeed()
{
Expand All @@ -225,32 +231,33 @@ public void Rotate(float rotation)
pantoSync.UpdateHandlePosition(null, rotation, isUpper);
}

public void SetPositions(Vector3 newPosition, float newRotation, Vector3? newGodObjectPosition)
public void SetPositions(Vector3 newPosition, float? newRotation, Vector3? newGodObjectPosition)
{
if (pantoSync.debug && userControlledRotation)
if (pantoSync.debug && newRotation != null)
{
Debug.Log("setting rotation");
GameObject debugObject = pantoSync.GetDebugObject(isUpper);
debugObject.transform.eulerAngles = new Vector3(debugObject.transform.eulerAngles.x, newRotation, debugObject.transform.eulerAngles.z);
debugObject.transform.eulerAngles = new Vector3(debugObject.transform.eulerAngles.x, (float)newRotation, debugObject.transform.eulerAngles.z);
}
if (pantoSync.debug)// && userControlledPosition)
{
GameObject debugObject = pantoSync.GetDebugObject(isUpper);
debugObject.transform.position = position;
debugObject.transform.position = newPosition;
}
if (!pantoSync.debug)
{
GameObject debugObject = pantoSync.GetDebugObject(isUpper);
debugObject.transform.eulerAngles = new Vector3(debugObject.transform.eulerAngles.x, newRotation, debugObject.transform.eulerAngles.z);
debugObject.transform.eulerAngles = new Vector3(debugObject.transform.eulerAngles.x, (float)newRotation, debugObject.transform.eulerAngles.z);
debugObject.transform.position = position;
GameObject debugGodObject = pantoSync.GetDebugGodObject(isUpper);
if (newGodObjectPosition != null)
{
debugGodObject.transform.position = newGodObjectPosition.Value;
debugGodObject.transform.eulerAngles = new Vector3(debugGodObject.transform.eulerAngles.x, newRotation, debugGodObject.transform.eulerAngles.z);
debugGodObject.transform.eulerAngles = new Vector3(debugGodObject.transform.eulerAngles.x, (float)newRotation, debugGodObject.transform.eulerAngles.z);
}
}
position = newPosition;
rotation = newRotation;
if (newRotation != null) rotation = (float)newRotation;
godObjectPosition = newGodObjectPosition;
}

Expand All @@ -270,9 +277,6 @@ async public Task TraceObjectByPoints(List<GameObject> cornerObjects, float spee

protected void FixedUpdate()
{
if (pantoSync.debug)
{
}
if (pantoSync.debug && handledGameObject != null)
{
if (Vector3.Distance(handledGameObject.transform.position, position) < 0.1f)
Expand All @@ -282,8 +286,9 @@ protected void FixedUpdate()
else
{
Vector3 goalPos = handledGameObject.transform.position;
//GetPantoSync().UpdateHandlePosition(position + (goalPos - position) * 0.1f, handledGameObject.transform.eulerAngles.y, isUpper);
SetPositions(position + (goalPos - position) * 0.05f, handledGameObject.transform.eulerAngles.y, null);
float? newRot = null;
if (!userControlledRotation) newRot = handledGameObject.transform.eulerAngles.y;
SetPositions(position + (goalPos - position) * 0.05f, newRot, null);
}
}
else if (handledGameObject != null && !inTransition && !isFrozen)// reached gameobject initially
Expand Down

0 comments on commit c1f2965

Please sign in to comment.