Fix mesh issues, add robotics room robot, poster
This commit is contained in:
44
Assets/Scripts/Poster.cs
Normal file
44
Assets/Scripts/Poster.cs
Normal file
@@ -0,0 +1,44 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class Poster : MonoBehaviour
|
||||
{
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
Vector2[] uvSingleFace = {
|
||||
new Vector2(0, 0),
|
||||
new Vector2(1, 0),
|
||||
new Vector2(0, 1),
|
||||
new Vector2(1, 1),
|
||||
|
||||
new Vector2(-1, -1),
|
||||
new Vector2(-1, -1),
|
||||
new Vector2(-1, -1),
|
||||
new Vector2(-1, -1),
|
||||
|
||||
new Vector2(-1, -1),
|
||||
new Vector2(-1, -1),
|
||||
new Vector2(-1, -1),
|
||||
new Vector2(-1, -1),
|
||||
|
||||
new Vector2(-1, -1),
|
||||
new Vector2(-1, -1),
|
||||
new Vector2(-1, -1),
|
||||
new Vector2(-1, -1),
|
||||
|
||||
new Vector2(-1, -1),
|
||||
new Vector2(-1, -1),
|
||||
new Vector2(-1, -1),
|
||||
new Vector2(-1, -1),
|
||||
|
||||
new Vector2(-1, -1),
|
||||
new Vector2(-1, -1),
|
||||
new Vector2(-1, -1),
|
||||
new Vector2(-1, -1)
|
||||
};
|
||||
|
||||
GetComponent<MeshFilter>().mesh.uv = uvSingleFace;
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/Poster.cs.meta
Normal file
11
Assets/Scripts/Poster.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: dac1c67daec8f264da85a77c48bf5f0d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/Scripts/Robotics.meta
Normal file
8
Assets/Scripts/Robotics.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bd9f7a9938a4bf24a84872811c68d93f
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
22
Assets/Scripts/Robotics/NavPoint.cs
Normal file
22
Assets/Scripts/Robotics/NavPoint.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class NavPoint : MonoBehaviour
|
||||
{
|
||||
public NavPoint previous;
|
||||
public NavPoint next;
|
||||
|
||||
public NavPoint GetNext()
|
||||
{
|
||||
return next;
|
||||
}
|
||||
|
||||
void OnDrawGizmos()
|
||||
{
|
||||
if (next == null) return;
|
||||
Gizmos.color = Color.yellow;
|
||||
Gizmos.DrawLine(transform.position, next.transform.position);
|
||||
}
|
||||
|
||||
}
|
||||
11
Assets/Scripts/Robotics/NavPoint.cs.meta
Normal file
11
Assets/Scripts/Robotics/NavPoint.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e665a34866aa84947a9189411e8b1f63
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
44
Assets/Scripts/Robotics/NavPointFollower.cs
Normal file
44
Assets/Scripts/Robotics/NavPointFollower.cs
Normal file
@@ -0,0 +1,44 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Unity.Mathematics;
|
||||
using UnityEngine;
|
||||
|
||||
public class NavPointFollower : MonoBehaviour
|
||||
{
|
||||
public NavPoint startNavPoint;
|
||||
public float rotationSpeed = 1f;
|
||||
public float speed = 1f;
|
||||
|
||||
private Rigidbody _rigidbody;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
_rigidbody = GetComponent<Rigidbody>();
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
var transform1 = transform;
|
||||
var position = transform1.position;
|
||||
_rigidbody.MovePosition(position + transform1.forward * (speed * Time.deltaTime));
|
||||
|
||||
var nextNavPointDirectionFlat =
|
||||
new Vector3(startNavPoint.transform.position.x, 0, startNavPoint.transform.position.z);
|
||||
|
||||
var direction = (startNavPoint.transform.position - position).normalized;
|
||||
|
||||
direction.y = 0;
|
||||
|
||||
var lookRotation = Quaternion.LookRotation(direction);
|
||||
|
||||
transform.rotation = Quaternion.Slerp(transform.rotation, lookRotation, Time.deltaTime * rotationSpeed);
|
||||
|
||||
|
||||
if (Vector3.Distance(transform.position, startNavPoint.transform.position) < 0.3f)
|
||||
{
|
||||
startNavPoint = startNavPoint.GetNext();
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/Robotics/NavPointFollower.cs.meta
Normal file
11
Assets/Scripts/Robotics/NavPointFollower.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5ce1c79856036c740b25a576b37e4476
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
32
Assets/Scripts/Robotics/RGB.cs
Normal file
32
Assets/Scripts/Robotics/RGB.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class RGB : MonoBehaviour
|
||||
{
|
||||
public float colorChangeInterval = 2f;
|
||||
public float minColor = 0;
|
||||
public float maxColor = 100;
|
||||
private Light _light;
|
||||
|
||||
private float _nextColorChange;
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
_light = GetComponent<Light>();
|
||||
_nextColorChange = Time.time;
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
if (!(_nextColorChange <= Time.time)) return;
|
||||
var r = Random.Range(minColor, maxColor);
|
||||
var g = Random.Range(minColor, maxColor);
|
||||
var b = Random.Range(minColor, maxColor);
|
||||
|
||||
_light.color = new Color(r, g, b);
|
||||
|
||||
_nextColorChange = Time.time + colorChangeInterval;
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/Robotics/RGB.cs.meta
Normal file
11
Assets/Scripts/Robotics/RGB.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a78c20c4f2fa24043a42f6640a85fb21
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user