Last active
April 13, 2018 20:30
-
-
Save gleydson/138fe7bd473436de880557c92439c965 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
public class PlayerBehaviourScript : MonoBehaviour { | |
private float x; | |
private float y; | |
private float z; | |
public bool canJump = true; | |
public float velocity = 0.2f; | |
public float rotationVelocity = 1.3f; | |
public float force = 0.5f; | |
// Use this for initialization | |
void Start () { | |
} | |
// Update is called once per frame | |
void Update () { | |
x = Input.GetAxis("Horizontal") * rotationVelocity; | |
z = Input.GetAxis("Vertical") * velocity; | |
transform.Translate(0, 0, z); | |
transform.Rotate(0, x, 0); | |
y = Input.GetAxis ("Jump") * force; | |
transform.Translate (0, y, 0); | |
} | |
/* | |
void OnCollisionStay(Collision col) { | |
if (col.gameObject.tag.Equals ("Plataform") || col.gameObject.tag.Equals ("floor")) { | |
canJump = true; | |
} | |
} | |
void OnCollisionExit(Collision col) { | |
if (col.gameObject.tag.Equals ("Plataform") || col.gameObject.tag.Equals ("floor")) { | |
canJump = false; | |
} | |
}*/ | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerBehaviourScript : MonoBehaviour
{
}