Professional Documents
Culture Documents
if(collisionInfo.transform.name == "CompleteLevel")
{
collisionInfo.collider.enabled = false;
//Debug.Log("you win");
Invoke("WinFunction", 0.5f);
}
if (collisionInfo.transform.tag == "SlidePad")
{
IsSlidingBool = true;
}
if(collisionInfo.transform.tag == "BouncePad")
{
rb.AddForce(0f, bounceForce * 0.1f, 0f, ForceMode.Impulse);
}
}
rb.AddForce(rayCastWallRunning.transform.TransformDirection(0f, 0f,
-WallRunningForce * speed));
}
*/
WallRunningForce = 10f;
IsWallRunning = true;
wallRunningSide = 1f;
Vector3 v = transform.rotation.eulerAngles;
Camera.rotation = Quaternion.Lerp(Camera.rotation,
Quaternion.Euler(v.x, v.y, -15f), 5f * Time.deltaTime);
if (Input.GetKeyDown(KeyCode.Space) && Input.GetKey(KeyCode.D))
{
IsJumped = true;
}
}
}
else if (Physics.Raycast(transform.position,
rb.transform.TransformDirection(Vector3.right), out hit, 0.8f))
{
if (hit.transform.tag == "WallRunPadNoSpeed")
{
rb.velocity = Vector3.zero;
WallRunningForce = 0f;
}
else if (hit.transform.tag == "WallRunPad")
{
//Debug.Log("right");
rayCastWallRunning = hit;
//Debug.Log(transform.eulerAngles.y);
//Debug.Log(rayCastWallRunning.transform.eulerAngles.y);
WallRunningForce = 10f;
IsWallRunning = true;
wallRunningSide = -1f;
Vector3 v = transform.rotation.eulerAngles;
Camera.rotation = Quaternion.Lerp(Camera.rotation,
Quaternion.Euler(v.x, v.y, 15f), 5f * Time.deltaTime);
if (Input.GetKeyDown(KeyCode.Space) && Input.GetKey(KeyCode.A))
{
IsJumped = true;
}
}
}
else
{
IsJumped = false;
wallRunningSide = 0f;
rb.useGravity = true;
Vector3 v = transform.rotation.eulerAngles;
Camera.rotation = Quaternion.Lerp(Camera.rotation,
Quaternion.Euler(v.x, v.y, 0f), 5f * Time.deltaTime);
IsWallRunning = false;
}
}
rb.MovePosition(newPosition);
}
}