Browse Source

remove old baby parts, update parent behaviour

develop
Jordan 3 years ago
parent
commit
ab2f50a8b7
19 changed files with 92 additions and 67 deletions
  1. BIN
      Assets/Baby Parts/baby base1.png
  2. BIN
      Assets/Baby Parts/baby base2.png
  3. BIN
      Assets/Baby Parts/baby base3.png
  4. BIN
      Assets/Baby Parts/baby eye 1 blue.png
  5. BIN
      Assets/Baby Parts/baby eye 1 brown.png
  6. BIN
      Assets/Baby Parts/baby eye 1 green.png
  7. BIN
      Assets/Baby Parts/baby hat1.png
  8. BIN
      Assets/Baby Parts/baby hat2.png
  9. BIN
      Assets/Baby Parts/baby hat3.png
  10. BIN
      Assets/Baby Parts/baby pant 1.png
  11. BIN
      Assets/Baby Parts/baby pant 2.1.png
  12. BIN
      Assets/Baby Parts/baby smile 1.png
  13. BIN
      Assets/Baby Parts/baby smile 2.png
  14. BIN
      Assets/Baby Parts/baby smile 3.png
  15. BIN
      Assets/Baby Parts/baby top1.png
  16. BIN
      Assets/Baby Parts/baby top2.png
  17. BIN
      Assets/Baby Parts/baby top3.png
  18. +90
    -14
      Assets/ParentBehaviour.cs
  19. BIN
      ProjectSettings/PackageManagerSettings.asset

BIN
Assets/Baby Parts/baby base1.png (Stored with Git LFS) View File

size 26338

BIN
Assets/Baby Parts/baby base2.png (Stored with Git LFS) View File

size 28143

BIN
Assets/Baby Parts/baby base3.png (Stored with Git LFS) View File

size 25588

BIN
Assets/Baby Parts/baby eye 1 blue.png (Stored with Git LFS) View File

size 7428

BIN
Assets/Baby Parts/baby eye 1 brown.png (Stored with Git LFS) View File

size 7840

BIN
Assets/Baby Parts/baby eye 1 green.png (Stored with Git LFS) View File

size 8465

BIN
Assets/Baby Parts/baby hat1.png (Stored with Git LFS) View File

size 16511

BIN
Assets/Baby Parts/baby hat2.png (Stored with Git LFS) View File

size 12946

BIN
Assets/Baby Parts/baby hat3.png (Stored with Git LFS) View File

size 17938

BIN
Assets/Baby Parts/baby pant 1.png (Stored with Git LFS) View File

size 30189

BIN
Assets/Baby Parts/baby pant 2.1.png (Stored with Git LFS) View File

size 29336

BIN
Assets/Baby Parts/baby smile 1.png (Stored with Git LFS) View File

size 7830

BIN
Assets/Baby Parts/baby smile 2.png (Stored with Git LFS) View File

size 13321

BIN
Assets/Baby Parts/baby smile 3.png (Stored with Git LFS) View File

size 9695

BIN
Assets/Baby Parts/baby top1.png (Stored with Git LFS) View File

size 22865

BIN
Assets/Baby Parts/baby top2.png (Stored with Git LFS) View File

size 16031

BIN
Assets/Baby Parts/baby top3.png (Stored with Git LFS) View File

size 20523

+ 90
- 14
Assets/ParentBehaviour.cs View File

@ -16,16 +16,35 @@ public class ParentBehaviour : MonoBehaviour
public List<string> order = new List<string>();
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<Randomizer>();
baseVis = _childRandomizer.baseObj.GetComponent<MeshRenderer>().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<Randomizer>().baseObj.GetComponent<MeshRenderer>().material.mainTexture != baseVis)
{
return baseVis;
}
break;
case "hat":
if (child.GetComponent<Randomizer>().hatObj.GetComponent<MeshRenderer>().material.mainTexture != hatVis)
{
return hatVis;
}
break;
case "eye":
if (child.GetComponent<Randomizer>().eyeObj.GetComponent<MeshRenderer>().material.mainTexture != eyeVis)
{
return eyeVis;
}
break;
case "top":
if (child.GetComponent<Randomizer>().topObj.GetComponent<MeshRenderer>().material.mainTexture != topVis)
{
return topVis;
}
break;
case "bottom":
if (child.GetComponent<Randomizer>().bottomObj.GetComponent<MeshRenderer>().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
}
}
}
}

BIN
ProjectSettings/PackageManagerSettings.asset (Stored with Git LFS) View File

size 1445

Loading…
Cancel
Save