private void Awake() { /*Finding enemy hands*/ Hands = new List <Transform>(3); Hands.Add(transform.GetChild(0).GetChild(1).GetChild(0).GetChild(0)); Hands.Add(transform.GetChild(1).GetChild(3).GetChild(0).GetChild(0)); Hands.Add(transform.GetChild(2).GetChild(3).GetChild(0).GetChild(0)); /*Finding enemy Torsos*/ Torsos = new List <GameObject>(3); Torsos.Add(transform.GetChild(0).gameObject); Torsos.Add(transform.GetChild(1).gameObject); Torsos.Add(transform.GetChild(2).gameObject); /*Finding Animators*/ Animators = new List <Animator>(3); foreach (GameObject t in Torsos) { Animators.Add(t.GetComponent <Animator>()); } SpriteController = new SpriteChanger(Torsos); /*Building New HandRoot Component*/ Hand = new HandRoot(Hands[0], Bow, Hands); Heads = SpriteFinderScript.Instance.RandomHead(); Chests = SpriteFinderScript.Instance.RandomTorso(); UpperHands = SpriteFinderScript.Instance.RandomUpperArms(); LowerHands = SpriteFinderScript.Instance.RandomLowerArms(); UpdateRandomSprites(); }
private void Awake() { /*Finding enemy hands*/ Hands = new List <Transform>(3); Hands.Add(transform.GetChild(0).GetChild(1).GetChild(0).GetChild(0)); Hands.Add(transform.GetChild(1).GetChild(3).GetChild(0).GetChild(0)); Hands.Add(transform.GetChild(2).GetChild(3).GetChild(0).GetChild(0)); /*Finding enemy Torsos*/ Torsos = new List <GameObject>(3); Torsos.Add(transform.GetChild(0).gameObject); Torsos.Add(transform.GetChild(1).gameObject); Torsos.Add(transform.GetChild(2).gameObject); /*Finding enemy Heads*/ Heads = new List <Sprite>(3); /*Finding Animators*/ Animators = new List <Animator>(3); foreach (GameObject t in Torsos) { Animators.Add(t.GetComponent <Animator>()); } SpriteController = new SpriteChanger(Torsos); /*Building New HandRoot Component*/ if (GetComponent <archerStats>() == null) { Hand = new HandRoot(Hands[0], SpriteFinderScript.Instance.RandomMeleeWeapon(), Hands); } else { Bow.GetComponent <SpriteRenderer>().sortingLayerName = "ObjectLayer"; Hand = new HandRoot(Hands[0], Bow, Hands); } Heads = SpriteFinderScript.Instance.RandomHead(); Chests = SpriteFinderScript.Instance.RandomTorso(); UpperHands = SpriteFinderScript.Instance.RandomUpperArms(); LowerHands = SpriteFinderScript.Instance.RandomLowerArms(); UpdateRandomSprites(); }