// Use this for initialization void Start() { bh = GetComponent <BodyHashes>(); // TODO get and assign GameObjects bodyObjects = new GameObject[4]; activeBodies = new bool[4] { true, false, false, false }; storedBodies = new bool[4] { true, false, false, false }; currentIndex = 0; // Find player and set it as first active Body currentBody = GameObject.FindGameObjectWithTag("Player"); mixer = currentBody.GetComponent <BodyMixer>(); cyan.SetActive(false); magenta.SetActive(false); yellow.SetActive(false); bodyObjects[0] = currentBody; bodyObjects[1] = cyan; bodyObjects[2] = magenta; bodyObjects[3] = yellow; ui = FindObjectOfType <UIManager>(); camControl = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <CameraController>(); //camControl.setCameraOnPlayer(currentBody); }
// Use this for initialization void Start() { absorbing = false; targets = new List <GameObject>(); mixer = GetComponentInParent <BodyMixer>(); bodyManager = FindObjectOfType <BodyManager>(); if (bodyManager == null) { Debug.Log("Body Manger is not found"); } }
void OnTriggerEnter2D(Collider2D other) { player = other.gameObject; // check if collider is player & not a clone if (gameObject.GetComponent <BoxCollider2D>().enabled == true) { if (player.tag == "Player" && LayerMask.LayerToName(player.layer) != "Clone") { mixer = player.GetComponentInParent <BodyMixer>(); mixer.takeColor(fountainColorCode); int arrIndex = mixer.calculateArrayIndex(fountainColorCode); bodyManager.StoreClone(arrIndex); ui.uiCollectColor(fountainColorCode); setFountainInactive(); } } }