备份CatanBuilding瘦身独立工程
This commit is contained in:
27
Assets/Scripts/EventPinball/Calculate.cs
Normal file
27
Assets/Scripts/EventPinball/Calculate.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class Calculate : MonoBehaviour
|
||||
{
|
||||
public float Height = 1;
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
// 按下tab键,计算掉落用时
|
||||
if (Input.GetKey(KeyCode.Tab))
|
||||
{
|
||||
float g = Mathf.Abs(Physics2D.gravity.y);
|
||||
float t2 = 2 * Height / g;
|
||||
float t = Mathf.Sqrt(t2);
|
||||
Debug.Log("从高度 " + Height + " 米掉落,耗时 " + t + "s");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user