using Boo.Lang;
using Boo.Lang.Runtime;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using UnityEngine;
[Serializable]
public class Movement : MonoBehaviour
{
[CompilerGenerated]
[Serializable]
internal sealed class Start46 : GenericGenerator
{
[Serializable]
internal sealed class self_ : GenericGeneratorEnumerator, IEnumerator
{
internal float t47;
internal Movement self_48;
public self_ (Movement self_)
{
self_48 = self_;
}
public bool movenext()
{
int varBG0;
switch (this._state)
{
case 0:
{
Lb1_BJ:
break;
}
case 1:
{
varBG0 = 0;
return varBG0 !=0;
}
case 2:
{
this.t47 += Time.deltaTime;
if (Input.GetKeyDown(KeyCode.Backspace))
{
this.self_48.spaceTapped = true;
goto Lb1_GM;
}
this.self_48.spaceTapped = false;
goto Lb1_GM;
}
case 3:
{
goto Lb1_KA;
}
}
goto Lb1_BJ;
Lb1_GM:
if (this.t47 >= this.self_48.dubleTapDelay)
{
Lb1_OT:
varBG0 = (this.yieldDefault(3) ? 1 : 0);
return varBG0 !=0;
}
varBG0 = (this.yieldDefault(2) ? 1 : 0);
return varBG0 != 0;
Lb1_KA:
if (Input.GetKeyDown(KeyCode.Backspace))
{
this.t47 = (float)0;
goto Lb1_GM;
}
goto Lb1_OT;
return varBG0 != 0;
}
}
internal Movement self_49;
public Start46(Movement self_)
{
this.self_49 = self_;
}
public override IEnumerator<object> GetEnumerator()
{
return new Movement.Start46.self_(this.self_49);
}
}
public float rotationSpeed;
public float walkSpeed;
public float flySpeed;
public float swoopSpeed;
public float gravity;
private float yRot;
private float xRot;
public Transform body;
private int PowerUp;
private object onGround;
public Transform teleportBody;
public float xMin;
public float xMax;
public float doubleTapDelay;
private int count;
private bool spaceTapped;
private bool flyState;
public Movement()
{
this.rotationSpeed = (float)10;
this.walkSpeed = (float)7;
this.flySpeed = (float)20;
this.swoopSpeed = (float)50;
this.gravity = (float)50;
this.doubleTapDelay = 0.2f;
}
public IEnumerator Start()
{
return new Movement.Start46(this).GetEnumerator();
}
public void Update()
{
Screen.lockCursor = true;
if (Input.GetKeyDown(KeyCode.Escape))
{
Screen.lockCursor = false;
}
Vector3 a = this.transform.TransformDirection(Vector3.forward);
Vector3 a2 = this.transform.TransformDirection(Vector3.right);
Vector3 a3 = this.transform.TransformDirection(Vector3.left);
Vector3 a4 = this.transform.TransformDirection(Vector3.back);
Vector3 a5 = this.transform.TransformDirection(Vector3.down);
Vector3 a6 = this.transform.TransformDirection(Vector3.up);
CharacterController characterController = (CharacterController)this.GetComponent(typeof(CharacterController));
if (Screen.lockCursor)
{
this.onGround = characterController.isGrounded;
this.animation["walk_forward"].speed = this.walkSpeed / (float)4;
this.animation["walk_backward"].speed = this.walkSpeed / (float)4;
if (this.PowerUp == 0)
{
if (Input.GetAxis("Vertical") > (float)0)
{
if (RuntimeServices.ToBool(this.onGround))
{
this.animation.Play("walk_forward", PlayMode.StopAll);
}
if (this.flyState)
{
this.animation.Play("fly_forward", PlayMode.StopAll);
characterController.Move(a * (this.flySpeed * Input.GetAxis("Vertical")) * Time.deltaTime);
}
characterController.Move(a * (this.walkSpeed * Input.GetAxis("Vertical")) * Time.deltaTime);
}
else
{
this.animation.CrossFade("idle");
}
if (Input.GetAxis("Vertical") < (float)0)
{
if (this.flyState)
{
this.animation.Play("fly_backward", PlayMode.StopAll);
characterController.Move(a4 * (-this.flySpeed * Input.GetAxis("Vertical")) * Time.deltaTime);
}
this.animation.CrossFade("walk_backward");
characterController.Move(a4 * (-this.walkSpeed * Input.GetAxis("Vertical")) * Time.deltaTime);
}
else
{
this.animation.CrossFade("idle");
}
if (Input.GetAxis("Horizontal") > (float)0)
{
if (this.flyState && Input.GetAxis("Vertical") == (float)0)
{
this.animation.Play("fly_right", PlayMode.StopAll);
characterController.Move(a2 * (this.flySpeed * Input.GetAxis("Horizontal")) * Time.deltaTime);
}
this.animation.CrossFade("walk_forward");
characterController.Move(a2 * (this.walkSpeed * Input.GetAxis("Horizontal")) * Time.deltaTime);
}
else
{
if (Input.GetAxis("Horizontal") < (float)0)
{
if (this.flyState && Input.GetAxis("Vertical") == (float)0)
{
this.animation.Play("fly_left", PlayMode.StopAll);
characterController.Move(a3 * (-this.flySpeed * Input.GetAxis("Horizontal")) * Time.deltaTime);
}
this.animation.CrossFade("walk_forward");
characterController.Move(a3 * (-this.walkSpeed * Input.GetAxis("Horizontal")) * Time.deltaTime);
}
}
}
if (Input.GetAxis("Mouse X") != (float)0)
{
this.yRot += (float)10 * Input.GetAxis("Mouse X");
}
if (Input.GetAxis("Mouse Y") != (float)0 && this.flyState)
{
this.xRot -= (float)5 * Input.GetAxis("Mouse Y");
}
else
{
if (RuntimeServices.ToBool(this.onGround))
{
this.xRot = (float)0;
}
}
if (this.xRot > this.xMax)
{
this.xRot = this.xMax;
}
else
{
if (this.xRot < this.xMin)
{
this.xRot = this.xMin;
}
}
this.transform.rotation = Quaternion.Euler(this.xRot, this.yRot, (float)0);
characterController.Move(a5 * this.gravity * Time.deltaTime);
if (Input.GetKeyDown(KeyCode.E) && Input.GetAxis("Horizontal") == (float)0 && Input.GetAxis("Vertical") == (float)0 && Input.GetAxis("GoUp") == (float)0)
{
this.PowerUp = 1;
this.animation.Play("powerup0", PlayMode.StopAll);
}
else
{
if (Input.GetKeyUp(KeyCode.E))
{
this.animation.CrossFade("idle");
this.PowerUp = 0;
}
}
if (this.PowerUp == 0 && RuntimeServices.ToBool(this.onGround) && (Input.GetKeyDown(KeyCode.F) || this.spaceTapped) && !this.flyState)
{
this.gravity = (float)0;
this.flyState = true;
}
if (this.flyState)
{
if (Input.GetKeyDown(KeyCode.F))
{
this.flyState = false;
}
this.animation.CrossFade("fly_idle");
this.gravity = (float)0;
}
else
{
if (!this.flyState)
{
this.gravity = (float)50;
}
}
if (Input.GetAxis("GoUp") != (float)0 && this.flyState && Input.GetAxis("Horizontal") == (float)0 && Input.GetAxis("Vertical") == (float)0)
{
this.animation.Play("fly_up", PlayMode.StopAll);
characterController.Move(a6 * (this.flySpeed * Input.GetAxis("GoUp")) * Time.deltaTime);
}
else
{
this.animation.CrossFade("fly_idle");
}
if (Input.GetKeyDown(KeyCode.Mouse2))
{
if (this.flyState)
{
this.flySpeed = this.swoopSpeed;
}
}
else
{
if (Input.GetKeyUp(KeyCode.Mouse2))
{
this.flySpeed = (float)20;
}
}
}
}
public void LateUpdate()
{
if (GameObject.FindGameObjectWithTag("Player") && !this.flyState)
{
if (Input.GetAxis("Vertical") > (float)0)
{
if (Input.GetAxis("Horizontal") > (float)0)
{
int int_ = 45;
Vector3 localEulerAngles = this.body.localEulerAngles;
float sngl_ = localEulerAngles.y = (float)int_;
Vector3 vector = this.body.localEulerAngles = localEulerAngles;
}
else
{
if (Input.GetAxis("Horizontal") < (float)0)
{
int int_2 = -45;
Vector3 localEulerAngles2 = this.body.localEulerAngles;
float sngl_2 = localEulerAngles2.y = (float)int_2;
Vector3 vector2 = this.body.localEulerAngles = localEulerAngles2;
}
}
}
if (Input.GetAxis("Horizontal") > (float)0 && Input.GetAxis("Vertical") == (float)0)
{
int int_3 = 90;
Vector3 localEulerAngles3 = this.body.localEulerAngles;
float sngl_3 = localEulerAngles3.y = (float)int_3;
Vector3 vector3 = this.body.localEulerAngles = localEulerAngles3;
}
else
{
if (Input.GetAxis("Horizontal") < (float)0 && Input.GetAxis("Vertical") == (float)0)
{
int int_4 = -90;
Vector3 localEulerAngles4 = this.body.localEulerAngles;
float sngl_4 = localEulerAngles4.y = (float)int_4;
Vector3 vector4 = this.body.localEulerAngles = localEulerAngles4;
}
}
}
if (this.PowerUp == 1)
{
if (RuntimeServices.ToBool(this.onGround))
{
this.animation.Play("powerup", PlayMode.StopAll);
}
if (this.flyState)
{
this.animation.Play("fly_powerup", PlayMode.StopAll);
}
}
}
public void Main()
{
}
}