From 0812cae8f93caef20f58780f7d35dc43f5207844 Mon Sep 17 00:00:00 2001 From: Joshua Reason Date: Sun, 2 Feb 2020 14:32:03 +1100 Subject: [PATCH] Added humpty dumpty scale --- Assets/Scripts/HumptyDumptyFollow.cs | 16 ++++++++++++++++ Assets/Scripts/HumptyDumptyFollow.cs.meta | 11 +++++++++++ Assets/Scripts/SetHorseMat.cs | 17 +++++++++++++++++ Assets/Scripts/SetHorseMat.cs.meta | 11 +++++++++++ 4 files changed, 55 insertions(+) create mode 100644 Assets/Scripts/HumptyDumptyFollow.cs create mode 100644 Assets/Scripts/HumptyDumptyFollow.cs.meta create mode 100644 Assets/Scripts/SetHorseMat.cs create mode 100644 Assets/Scripts/SetHorseMat.cs.meta diff --git a/Assets/Scripts/HumptyDumptyFollow.cs b/Assets/Scripts/HumptyDumptyFollow.cs new file mode 100644 index 0000000..530a110 --- /dev/null +++ b/Assets/Scripts/HumptyDumptyFollow.cs @@ -0,0 +1,16 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class HumptyDumptyFollow : MonoBehaviour +{ + public Transform Centre; + public Vector3 Offset; + + + // Update is called once per frame + void Update() + { + transform.position = Centre.position + Offset; + } +} diff --git a/Assets/Scripts/HumptyDumptyFollow.cs.meta b/Assets/Scripts/HumptyDumptyFollow.cs.meta new file mode 100644 index 0000000..d0d89b3 --- /dev/null +++ b/Assets/Scripts/HumptyDumptyFollow.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 48503f69a7f0ea9458ae404e5b00ffd9 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/SetHorseMat.cs b/Assets/Scripts/SetHorseMat.cs new file mode 100644 index 0000000..1bfc4c3 --- /dev/null +++ b/Assets/Scripts/SetHorseMat.cs @@ -0,0 +1,17 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class SetHorseMat : MonoBehaviour +{ + public List allMats; + + // Start is called before the first frame update + void Start() + { + int randomIndex = Random.Range(0, allMats.Count - 1); + Debug.Log("RandomIndex: " + randomIndex); + GetComponentInChildren().material = allMats[randomIndex]; + + } +} diff --git a/Assets/Scripts/SetHorseMat.cs.meta b/Assets/Scripts/SetHorseMat.cs.meta new file mode 100644 index 0000000..8b660bf --- /dev/null +++ b/Assets/Scripts/SetHorseMat.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: c16c4586273f9b84e97fcbbb885db687 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: