Unity Project

reference
https://cardgames.io/yahtzee/
This commit is contained in:
mcutegs2
2020-07-21 15:43:56 +09:00
commit 42edc18e4e
4081 changed files with 189452 additions and 0 deletions

47
Assets/Script/cubeMove.cs Normal file
View File

@@ -0,0 +1,47 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class cubeMove : MonoBehaviour
{
public int speed = 10;
public bool isJumpping = false;
private Rigidbody rb;
// Use this for initialization
void Start()
{
rb = GetComponent<Rigidbody>();
}
// Update is called once per frame
void Update()
{
moveCube();
}
void moveCube()
{
if (!isJumpping)
{
if (Input.GetMouseButtonDown(0))
{
this.isJumpping = true;
transform.position = new Vector3(0, 1, 0);
transform.rotation = Quaternion.identity;
rb.AddForce(transform.up * 500);
rb.AddTorque(Random.Range(0, 500), Random.Range(0, 500), Random.Range(0, 500));
this.GetComponent<Rigidbody>().velocity = Vector3.up * this.speed;
}
}
}
private void OnCollisionEnter(Collision collision)
{
if (collision.transform.tag == "Ground")
{
this.isJumpping = false;
}
}
}