using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Tilemaps;
public class Box : MonoBehaviour
{
const float Gravity = -0.01f;
Vector3 pos;
Vector3 speed = new Vector3();
// Start is called before the first frame update
void Start()
{
//Transform.Positionを複製
pos = this.transform.position;
//初期速度は0
speed = Vector3.zero;
}
// Update is called once per frame
void Update()
{
//現在位置を受け取る
pos = this.transform.position;
//ボックスの自由落下
speed.y = speed.y + Gravity;
pos = new Vector3( pos.x, pos.y + speed.y, 0);
//新しい位置をTransform.Positionに代入する
transform.position = pos;
}
}