Пример #1
0
    private void absorb(GameObject newPlayer)
    {
        int otherID = newPlayer.GetComponent <PlayerController>().identifier;

        // Save Clone GameObject in BodyManager
        int arrayIndex = mixer.calculateArrayIndex(otherID);

        bodyManager.StoreClone(arrayIndex);
        bodyManager.setActiveBody(arrayIndex, false);

        // Destroy Clone object
        //Destroy(newPlayer);

        // Disable Clone Gameobject
        newPlayer.SetActive(false);
        mixer.takeColor(otherID);
    }
Пример #2
0
    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();
            }
        }
    }