Open EngediKimHyeYoung opened 2 years ago
using System.Collections; using System.Collections.Generic; using UnityEngine;
public class Player : MonoBehaviour {
protected float jump_speed = 5.0f;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
if (Input.GetMouseButtonDown(0))
{
this.GetComponent<Rigidbody>().velocity = Vector3.up * this.jump_speed;
}
}
private void OnMouseDown()
{
Debug.Log("OnMouseDown");
}
private void OnMouseOver()
{
//bug.Log("OnMouseOver");
}
private void OnMouseUp()
{
Debug.Log("OnMouseUp");
}
}
using System.Collections; using System.Collections.Generic; using UnityEngine;
public class Player : MonoBehaviour {
protected float jump_speed = 5.0f;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
if (Input.GetMouseButtonDown(0))
{
this.GetComponent<Rigidbody>().velocity = Vector3.up * this.jump_speed;
}
if (Input.GetKey("up"))
{
print("up");
}
if (Input.GetKey("down"))
{
//print("down");
Debug.Log("down");
}
}
private void OnMouseDown()
{
Debug.Log("OnMouseDown");
}
private void OnMouseOver()
{
//bug.Log("OnMouseOver");
}
private void OnMouseUp()
{
Debug.Log("OnMouseUp");
}
}
using System.Collections; using System.Collections.Generic; using UnityEngine;
public class Player : MonoBehaviour {
protected float jump_speed = 5.0f;
public bool is_landing = false;
// Start is called before the first frame update
void Start()
{
this.is_landing = false;
}
// Update is called once per frame
void Update()
{
if (this.is_landing)
{
if (Input.GetMouseButtonDown(0))
{
this.is_landing = false;
this.GetComponent<Rigidbody>().velocity = Vector3.up * this.jump_speed;
}
}
}
private void OnCollisionEnter(Collision collision)
{
this.is_landing = true;
Debug.Log("collision");
}
}
using System.Collections; using System.Collections.Generic; using UnityEngine;
public class Player : MonoBehaviour {
protected float jump_speed = 11.0f;
public bool is_landing = false;
// Start is called before the first frame update
void Start()
{
this.is_landing = false;
}
// Update is called once per frame
void Update()
{
if (this.is_landing)
{
if (Input.GetMouseButtonDown(0))
{
this.is_landing = false;
this.GetComponent<Rigidbody>().velocity = Vector3.up * this.jump_speed;
//Debug.Break();
}
}
}
private void OnCollisionEnter(Collision collision)
{
if (collision.gameObject.tag == "Floor")
{
this.is_landing = true;
//Debug.Log("collision");
}
}
}
using System.Collections; using System.Collections.Generic; using UnityEngine;
public class Player : MonoBehaviour { protected float jump_speed = 5.0f;
}