using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class RightButton : MonoBehaviour {
public float speed = 3;
bool push = false;
public void Update(){
if(push){
Move();
}
}
public void PushDown(){
push = true;
}
public void PushUp(){
push = false;
}
public void Move(){
Vector2 direction = new Vector2 (1.0f, 0).normalized;
GetComponent<Rigidbody2D>().velocity = direction * speed;
}
}
ゲームオブジェクトにアタッチ後、ボタンに設置