マイロボット配置システム1
配置ベースを十字キーで動かす
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class MyBotBase : MonoBehaviour
{
private int num = 0;
void Update()
{
Vector3 pos = transform.position;
if(Input.GetKeyDown(KeyCode.LeftArrow))
{
transform.position = new Vector3(pos.x - 1, 0, pos.z);
}
if (Input.GetKeyDown(KeyCode.RightArrow))
{
transform.position = new Vector3(pos.x + 1, 0, pos.z);
}
if (Input.GetKeyDown(KeyCode.UpArrow))
{
transform.position = new Vector3(pos.x, 0, pos.z + 1);
}
if (Input.GetKeyDown(KeyCode.DownArrow))
{
transform.position = new Vector3(pos.x, 0, pos.z - 1);
}
}
}
配置ベースを十字キーで動かす
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class MyBotBase : MonoBehaviour
{
private int num = 0;
void Update()
{
Vector3 pos = transform.position;
if(Input.GetKeyDown(KeyCode.LeftArrow))
{
transform.position = new Vector3(pos.x - 1, 0, pos.z);
}
if (Input.GetKeyDown(KeyCode.RightArrow))
{
transform.position = new Vector3(pos.x + 1, 0, pos.z);
}
if (Input.GetKeyDown(KeyCode.UpArrow))
{
transform.position = new Vector3(pos.x, 0, pos.z + 1);
}
if (Input.GetKeyDown(KeyCode.DownArrow))
{
transform.position = new Vector3(pos.x, 0, pos.z - 1);
}
}
}
マイロボット配置システム1