mirror of
https://github.com/Team4388/2019-Virtual-Field.git
synced 2026-06-08 16:18:04 -06:00
Added dropdown to set starting position
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class setPosition : MonoBehaviour
|
||||
{
|
||||
robotControl robotControl;
|
||||
|
||||
// Start is called before the first frame update
|
||||
public void Start()
|
||||
{
|
||||
GameObject Robot = GameObject.Find("Robot");
|
||||
robotControl = Robot.GetComponent<robotControl>();
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
public void Update()
|
||||
{
|
||||
Dropdown dd = GetComponent<Dropdown>();
|
||||
// 1 = left, 2 = middle, and 3 = right
|
||||
if (dd.value != 0)
|
||||
{
|
||||
if (dd.value == 1)
|
||||
{
|
||||
robotControl.pos = new Vector3(-50, 10, -260);
|
||||
}
|
||||
else if (dd.value == 2)
|
||||
{
|
||||
robotControl.pos = new Vector3(0, 10, -260);
|
||||
}
|
||||
else if (dd.value == 3)
|
||||
{
|
||||
robotControl.pos = new Vector3(50, 10, -260);
|
||||
}
|
||||
robotControl.initialRot = robotControl.yRot;
|
||||
dd.value = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b2a1ca7e8c9bd604bb02031bb790a351
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user