void logic() { Vector2 Playerpos = context.player.transform.position; Vector2 camerapos = context.Maincamera.transform.position; int diff = (int)(Playerpos.y - camerapos.y); int _diff = (int)(context.BottomEnd - context.CameraBoundsBottom); if (diff < 2) { } if (context.CameraBoundsBottom > context.BottomEnd) { Vector3 cameranewpos = Vector2.Lerp(camerapos, Playerpos, 0.05f); cameranewpos.z = -50; context.Maincamera.transform.position = new Vector3(camerapos.x, cameranewpos.y, -50); } else { context.SetState(context.GetState_statecamerastopped()); } }
void logic() { //TODO player above center if (context.player.transform.position.y > context.Maincamera.transform.position.y) { lerp += 0.003f; Vector3 campos = context.Maincamera.transform.position; campos.z = -50; Vector3 newpos = new Vector3(campos.x, context.player.transform.position.y, -50); context.Maincamera.transform.position = Vector3.Lerp(campos, newpos, lerp); if (context.CameraBoundsBottom > context.BottomEnd) { lerp = 0; context.SetState(context.GetState_statemovetoplayer()); } } }