using System.Collections;

using System.Collections.Generic;

using UnityEngine;


public class MakeRun : MonoBehaviour

{

public float v = 5.0f;

public float y_v = 0.0f;

public float jump_power = 5.0f;

private float G = 9.8f;

private bool ground;


private Vector3 charVector;

private CharacterController char_ctrl;


void Start()

{

char_ctrl = GetComponent<CharacterController>();

ground = true;

charVector = Vector3.zero;

}


void Update()

{


charVector.x = -v;

charVector.y = y_v;

charVector.z = Input.GetAxisRaw("Vertical") * v;

char_ctrl.Move(charVector * Time.deltaTime);


if (Input.GetKeyDown("space") && ground)

{

charVector.y = jump_power;

ground = false;

}


if (!ground)

{


}

}

}


์˜ฌ๋ผ๊ฐ€๋Š”์ง€๋งŒ ๋จผ์ € ๋ณด๋ ค๊ณ  ํ–ˆ๋Š”๋ฐ ๊ทธ๊ฑฐ๊ฐ€ ์•ˆ๋˜๋„น