Compare commits

...

2 Commits

Author SHA1 Message Date
haitem
142e43c9f8 Merge branch 'master' of https://git.steelants.cz/GJP/GlobalGameJam-2021 2021-01-31 00:44:49 +01:00
haitem
c51d76fe30 bigger power changes 2021-01-31 00:44:40 +01:00

View File

@ -35,8 +35,10 @@ public class PlayerManager : MonoBehaviour
private float saveRunSpeed; private float saveRunSpeed;
private float saveJump; private float saveJump;
private Vector3 saveSize; private Vector3 saveSize;
private Vector3 saveNewSize;
private Vector3 savePosition; private Vector3 savePosition;
private Vector3 saveCameraPosition; private Vector3 saveCameraPosition;
private float savePower;
// Start is called before the first frame update // Start is called before the first frame update
void Start() void Start()
@ -49,8 +51,6 @@ public class PlayerManager : MonoBehaviour
saveRunSpeed = runSpeed; saveRunSpeed = runSpeed;
saveJump = jump; saveJump = jump;
saveSize = transform.localScale; saveSize = transform.localScale;
savePosition = transform.localPosition;
saveCameraPosition = Camera.main.transform.localPosition;
} }
// Update is called once per frame // Update is called once per frame
@ -92,6 +92,11 @@ public class PlayerManager : MonoBehaviour
powerCubeManager.transform.localScale = Vector3.Slerp(powerCubeManager.transform.localScale, new Vector3(0.01f, 0.01f, 0.01f), stepSmaller); powerCubeManager.transform.localScale = Vector3.Slerp(powerCubeManager.transform.localScale, new Vector3(0.01f, 0.01f, 0.01f), stepSmaller);
} }
} }
if (actualPowerTimes[0] != 0f && actualPowerTimes[0] > Time.time)
{
transform.localScale = Vector3.Slerp(transform.localScale, saveNewSize, 1 * Time.deltaTime);
}
} }
private void FixedUpdate() private void FixedUpdate()
@ -288,24 +293,22 @@ public class PlayerManager : MonoBehaviour
if (powerType == PowerCubeManager.PowerType.Bigger) if (powerType == PowerCubeManager.PowerType.Bigger)
{ {
saveSize = transform.localScale; saveSize = transform.localScale;
savePosition = transform.localPosition; savePower = power;
saveCameraPosition = Camera.main.transform.localPosition; saveNewSize = new Vector3(
transform.localScale.x + savePower,
transform.localScale = new Vector3( transform.localScale.y + savePower,
transform.localScale.z + savePower
);
/*transform.localScale = new Vector3(
transform.localScale.x + power, transform.localScale.x + power,
transform.localScale.y + power, transform.localScale.y + power,
transform.localScale.z + power transform.localScale.z + power
); );*/
transform.localPosition = new Vector3( /*transform.localPosition = new Vector3(
transform.localPosition.x, transform.localPosition.x,
transform.localPosition.y + power * 2, transform.localPosition.y + power * 2,
transform.localPosition.z transform.localPosition.z
); );*/
Camera.main.transform.localPosition = new Vector3(
Camera.main.transform.localPosition.x,
Camera.main.transform.localPosition.y,
Camera.main.transform.localPosition.z - power * 2
);
} }
else if (powerType == PowerCubeManager.PowerType.Faster) else if (powerType == PowerCubeManager.PowerType.Faster)
@ -329,10 +332,10 @@ public class PlayerManager : MonoBehaviour
{ {
if (actualPowerTimes[0] != 0f && actualPowerTimes[0] < Time.time) if (actualPowerTimes[0] != 0f && actualPowerTimes[0] < Time.time)
{ {
transform.localScale = saveSize; transform.localScale = Vector3.Slerp(transform.localScale, saveSize, 1 * Time.deltaTime);
transform.localPosition = savePosition; if (transform.localScale == saveSize) {
Camera.main.transform.localPosition = saveCameraPosition; actualPowerTimes[0] = 0f;
actualPowerTimes[0] = 0f; }
} }
if (actualPowerTimes[1] != 0f && actualPowerTimes[1] < Time.time) if (actualPowerTimes[1] != 0f && actualPowerTimes[1] < Time.time)
{ {