From ab2f50a8b71b71dfb5aad17ff63d240e8ab4ffc8 Mon Sep 17 00:00:00 2001 From: jordanci Date: Sun, 31 Jan 2021 12:00:41 +1100 Subject: [PATCH] remove old baby parts, update parent behaviour --- Assets/Baby Parts/baby base1.png | 3 - Assets/Baby Parts/baby base2.png | 3 - Assets/Baby Parts/baby base3.png | 3 - Assets/Baby Parts/baby eye 1 blue.png | 3 - Assets/Baby Parts/baby eye 1 brown.png | 3 - Assets/Baby Parts/baby eye 1 green.png | 3 - Assets/Baby Parts/baby hat1.png | 3 - Assets/Baby Parts/baby hat2.png | 3 - Assets/Baby Parts/baby hat3.png | 3 - Assets/Baby Parts/baby pant 1.png | 3 - Assets/Baby Parts/baby pant 2.1.png | 3 - Assets/Baby Parts/baby smile 1.png | 3 - Assets/Baby Parts/baby smile 2.png | 3 - Assets/Baby Parts/baby smile 3.png | 3 - Assets/Baby Parts/baby top1.png | 3 - Assets/Baby Parts/baby top2.png | 3 - Assets/Baby Parts/baby top3.png | 3 - Assets/ParentBehaviour.cs | 104 ++++++++++++++++--- ProjectSettings/PackageManagerSettings.asset | 4 +- 19 files changed, 92 insertions(+), 67 deletions(-) delete mode 100644 Assets/Baby Parts/baby base1.png delete mode 100644 Assets/Baby Parts/baby base2.png delete mode 100644 Assets/Baby Parts/baby base3.png delete mode 100644 Assets/Baby Parts/baby eye 1 blue.png delete mode 100644 Assets/Baby Parts/baby eye 1 brown.png delete mode 100644 Assets/Baby Parts/baby eye 1 green.png delete mode 100644 Assets/Baby Parts/baby hat1.png delete mode 100644 Assets/Baby Parts/baby hat2.png delete mode 100644 Assets/Baby Parts/baby hat3.png delete mode 100644 Assets/Baby Parts/baby pant 1.png delete mode 100644 Assets/Baby Parts/baby pant 2.1.png delete mode 100644 Assets/Baby Parts/baby smile 1.png delete mode 100644 Assets/Baby Parts/baby smile 2.png delete mode 100644 Assets/Baby Parts/baby smile 3.png delete mode 100644 Assets/Baby Parts/baby top1.png delete mode 100644 Assets/Baby Parts/baby top2.png delete mode 100644 Assets/Baby Parts/baby top3.png diff --git a/Assets/Baby Parts/baby base1.png b/Assets/Baby Parts/baby base1.png deleted file mode 100644 index 2f904e5..0000000 --- a/Assets/Baby Parts/baby base1.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:ae3c5442cf08a2087063b7afbe18c9b48844ddafadc27572e41afee0a37859a0 -size 26338 diff --git a/Assets/Baby Parts/baby base2.png b/Assets/Baby Parts/baby base2.png deleted file mode 100644 index afad52b..0000000 --- a/Assets/Baby Parts/baby base2.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:923de1f21124633c12fa1e7cb89875f2bc746ed371258f81d31e670657c9adfb -size 28143 diff --git a/Assets/Baby Parts/baby base3.png b/Assets/Baby Parts/baby base3.png deleted file mode 100644 index b8733eb..0000000 --- a/Assets/Baby Parts/baby base3.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:03aa913cfff1afe0335d122937d92299328d515b4890f277c204acfb28889dbe -size 25588 diff --git a/Assets/Baby Parts/baby eye 1 blue.png b/Assets/Baby Parts/baby eye 1 blue.png deleted file mode 100644 index b6060c0..0000000 --- a/Assets/Baby Parts/baby eye 1 blue.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:0ab23907e4e6779a2de99b9a4f042074acb002742053cc8406094c483a30e305 -size 7428 diff --git a/Assets/Baby Parts/baby eye 1 brown.png b/Assets/Baby Parts/baby eye 1 brown.png deleted file mode 100644 index 0cc2902..0000000 --- a/Assets/Baby Parts/baby eye 1 brown.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:1054659d732e4f561c9adc1194e2a7ab424e847df072d27989b7b239cf9c5b52 -size 7840 diff --git a/Assets/Baby Parts/baby eye 1 green.png b/Assets/Baby Parts/baby eye 1 green.png deleted file mode 100644 index 27e68a7..0000000 --- a/Assets/Baby Parts/baby eye 1 green.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:d97cf853b0b92e317bcd43819cfe3c0eb3f56f8e0b3303afb6c040869efdddc2 -size 8465 diff --git a/Assets/Baby Parts/baby hat1.png b/Assets/Baby Parts/baby hat1.png deleted file mode 100644 index 6a9e0ba..0000000 --- a/Assets/Baby Parts/baby hat1.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:f3b3b538196b4300a41735e538ccbe20be3393c257ab12d7295b93b4bbf9e7b4 -size 16511 diff --git a/Assets/Baby Parts/baby hat2.png b/Assets/Baby Parts/baby hat2.png deleted file mode 100644 index a657149..0000000 --- a/Assets/Baby Parts/baby hat2.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:d9c60b198c4e1786cdf742f8cae6205c7726c00d6cb3aa14a5b530d17008ab73 -size 12946 diff --git a/Assets/Baby Parts/baby hat3.png b/Assets/Baby Parts/baby hat3.png deleted file mode 100644 index 24e2601..0000000 --- a/Assets/Baby Parts/baby hat3.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:02ce68161b28d3ec43dd8d76d64655c78952b06df457ff4169ec6a6a19bc6395 -size 17938 diff --git a/Assets/Baby Parts/baby pant 1.png b/Assets/Baby Parts/baby pant 1.png deleted file mode 100644 index c264a0b..0000000 --- a/Assets/Baby Parts/baby pant 1.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:3cc4fe335add6e4759515d3c3649fe42532a681b8ad0d2c842474aff0c9eb464 -size 30189 diff --git a/Assets/Baby Parts/baby pant 2.1.png b/Assets/Baby Parts/baby pant 2.1.png deleted file mode 100644 index 5d62e36..0000000 --- a/Assets/Baby Parts/baby pant 2.1.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:f622c6738db9c98018b67df6e3148e290c44bf3bf86f0ce5ba17d8c49c11f128 -size 29336 diff --git a/Assets/Baby Parts/baby smile 1.png b/Assets/Baby Parts/baby smile 1.png deleted file mode 100644 index 4d68a4c..0000000 --- a/Assets/Baby Parts/baby smile 1.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:fa768308f3bb8737a66d4b7b3508b708b0049f1da0eb9eb075d325dc568618f9 -size 7830 diff --git a/Assets/Baby Parts/baby smile 2.png b/Assets/Baby Parts/baby smile 2.png deleted file mode 100644 index be8ac79..0000000 --- a/Assets/Baby Parts/baby smile 2.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:be7fc40f2505ffd029bd2224a4ea0b09106472be87300bd2a626699403b82781 -size 13321 diff --git a/Assets/Baby Parts/baby smile 3.png b/Assets/Baby Parts/baby smile 3.png deleted file mode 100644 index b390c37..0000000 --- a/Assets/Baby Parts/baby smile 3.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:cdb649bf9cd08abdd64b01d513e1b16028621cf65f9ed2bb5f0b341038cafd65 -size 9695 diff --git a/Assets/Baby Parts/baby top1.png b/Assets/Baby Parts/baby top1.png deleted file mode 100644 index 2acea1e..0000000 --- a/Assets/Baby Parts/baby top1.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:706fc3c856ffe63bac67b0a993cdbba3736b442fe376b26a0c93ae255f42bad5 -size 22865 diff --git a/Assets/Baby Parts/baby top2.png b/Assets/Baby Parts/baby top2.png deleted file mode 100644 index 4615215..0000000 --- a/Assets/Baby Parts/baby top2.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:f414c6c7e6229f505d4e5f07713ffeeab220cfbedca88d858c93c8e9368bae86 -size 16031 diff --git a/Assets/Baby Parts/baby top3.png b/Assets/Baby Parts/baby top3.png deleted file mode 100644 index 742e0df..0000000 --- a/Assets/Baby Parts/baby top3.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:c744fcd8c99c07017688a859ca1f5096d959e7f8fca39c93df612f0fbc69816f -size 20523 diff --git a/Assets/ParentBehaviour.cs b/Assets/ParentBehaviour.cs index e70652e..6f1fd55 100644 --- a/Assets/ParentBehaviour.cs +++ b/Assets/ParentBehaviour.cs @@ -16,16 +16,35 @@ public class ParentBehaviour : MonoBehaviour public List order = new List(); + public ParentBehaviour otherParent; + + public Texture2D[] parentBases; + public Texture2D parentFaceNeutral; + public Texture2D parentFaceHappy1; + public Texture2D parentFaceHappy2; + public Texture2D parentFaceAngry; + public Texture2D parentFaceTalk; + [ContextMenu("Get Random Child")] public void GetRandomChild() { - int _childIndex = Random.Range(0, babySpawner.transform.childCount); - - child = babySpawner.transform.GetChild(_childIndex).gameObject; - - //CHECK IF OTHER PARENT WANTS THIS CHILD (if otherParent.child == child) - + bool _validChild = false; + while (!_validChild) + { + int _childIndex = Random.Range(0, babySpawner.transform.childCount); + + child = babySpawner.transform.GetChild(_childIndex).gameObject; + + if (otherParent.child != null) + { + if (child != otherParent.child) + { + //this prevents both parents asking for the same child + _validChild = true; + } + } + } Randomizer _childRandomizer = child.GetComponent(); baseVis = _childRandomizer.baseObj.GetComponent().material.mainTexture; @@ -39,19 +58,76 @@ public class ParentBehaviour : MonoBehaviour order.Insert(Random.Range(0, order.Count), "eye"); order.Insert(Random.Range(0, order.Count), "top"); order.Insert(Random.Range(0, order.Count), "bottom"); + } - foreach (string item in order) + public bool CheckChild(GameObject _child) + { + if (_child == child) { - print(item); + return true; + } + else + { + return false; } - - - } + public Texture GiveDetails(GameObject _child) + { + for (int i = 0; i < order.Count; i++) + { + switch (order[i]){ + case "base": + if (child.GetComponent().baseObj.GetComponent().material.mainTexture != baseVis) + { + return baseVis; + } + break; + case "hat": + if (child.GetComponent().hatObj.GetComponent().material.mainTexture != hatVis) + { + return hatVis; + } + break; + case "eye": + if (child.GetComponent().eyeObj.GetComponent().material.mainTexture != eyeVis) + { + return eyeVis; + } + break; + case "top": + if (child.GetComponent().topObj.GetComponent().material.mainTexture != topVis) + { + return topVis; + } + break; + case "bottom": + if (child.GetComponent().bottomObj.GetComponent().material.mainTexture != bottomVis) + { + return bottomVis; + } + break; + default: + break; + } + } + return null; + } - - - + private void OnTriggerEnter(Collider other) + { + if (other.gameObject.tag == "child") + { + if (CheckChild(other.gameObject)) + { + //this is the correct child + } + else + { + Texture _displayGraphic = GiveDetails(other.gameObject); + //display the display graphic + } + } + } } diff --git a/ProjectSettings/PackageManagerSettings.asset b/ProjectSettings/PackageManagerSettings.asset index b75a80b..e23edbb 100644 --- a/ProjectSettings/PackageManagerSettings.asset +++ b/ProjectSettings/PackageManagerSettings.asset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4057c0c98a8017b1346eab48b1e2929bdcda4ba9d1834dfbeb732262bd29d17a -size 1453 +oid sha256:b286851b15416b9eaf1e26119cc9f5fdb63ec6d4df95104bf01f269266694c41 +size 1445