Ejemplo n.º 1
0
    //

    void Start()
    {
        objectsToShowOnPause = GameObject.FindGameObjectsWithTag(Tags.pauseObject);
        setObjectsToShowOnPause(false);

        charactersManager = GetComponent <CharactersManager>();
        cameraManager     = GetComponent <CameraManager>();

        RectTransform rectTransformOneButton = allButtons[0].GetComponent <RectTransform>();

        anchorMinRight = rectTransformOneButton.anchorMin.x;
        anchorMaxRight = rectTransformOneButton.anchorMax.x;
        anchorMinLeft  = 0f;
        anchorMaxLeft  = anchorMaxRight - anchorMinRight;


        charactersOnMissionList = GameObject.FindGameObjectWithTag(Tags.charactersOnMissionList).GetComponent <CharactersOnMissionList>();
        buttonsOnLeft           = charactersOnMissionList.getButtonsOnLeft();
        if (buttonsOnLeft)
        {
            setButtonsToLeft();
        }
        else
        {
            setButtonsToRight();
        }

        setPause(false);


        //
        text = GameObject.FindGameObjectWithTag("debugtext").GetComponent <Text>();
        //
    }
Ejemplo n.º 2
0
    void Awake()
    {
        charactersOnMissionList        = GameObject.FindGameObjectWithTag(Tags.charactersOnMissionList).GetComponent <CharactersOnMissionList>();
        allCharacterOnMissionTemplates = new CharacterOnMissionTemplate[charactersOnMission];

        RectTransform prefabButtonAddRect = characterOnMissionPrefab.GetComponent <RectTransform>();
        float         sizeY = prefabButtonAddRect.anchorMax.y - prefabButtonAddRect.anchorMin.y;

        for (int i = 0; i < charactersOnMission; i++)
        {
            GameObject button = (GameObject)Instantiate(characterOnMissionPrefab);

            button.GetComponent <RectTransform>().anchorMax = new Vector2(prefabButtonAddRect.anchorMax.x, prefabButtonAddRect.anchorMax.y - (sizeY * i));
            button.GetComponent <RectTransform>().anchorMin = new Vector2(prefabButtonAddRect.anchorMin.x, prefabButtonAddRect.anchorMin.y - (sizeY * i));

            button.transform.SetParent(buttonsContainer.transform, false);


            CharacterOnMissionTemplate characterOnMissionTemplate = button.GetComponent <CharacterOnMissionTemplate>();

            allCharacterOnMissionTemplates[i] = characterOnMissionTemplate;
        }

        hardCoreModeToggle.isOn = charactersOnMissionList.getHardCoreMode();
        buttonsOnLeft.isOn      = charactersOnMissionList.getButtonsOnLeft();
    }
    void Awake()
    {
        charactersOnMissionList = GameObject.FindGameObjectWithTag(Tags.charactersOnMissionList).GetComponent<CharactersOnMissionList>();
        allCharacterOnMissionTemplates = new CharacterOnMissionTemplate[charactersOnMission];

        RectTransform prefabButtonAddRect = characterOnMissionPrefab.GetComponent<RectTransform>();
        float sizeY = prefabButtonAddRect.anchorMax.y - prefabButtonAddRect.anchorMin.y;

        for(int i=0; i<charactersOnMission; i++){
            GameObject button = (GameObject)Instantiate(characterOnMissionPrefab);

            button.GetComponent<RectTransform>().anchorMax = new Vector2(prefabButtonAddRect.anchorMax.x, prefabButtonAddRect.anchorMax.y - (sizeY*i));
            button.GetComponent<RectTransform>().anchorMin = new Vector2(prefabButtonAddRect.anchorMin.x, prefabButtonAddRect.anchorMin.y - (sizeY*i));

            button.transform.SetParent(buttonsContainer.transform, false);

            CharacterOnMissionTemplate characterOnMissionTemplate = button.GetComponent<CharacterOnMissionTemplate>();

            allCharacterOnMissionTemplates[i] = characterOnMissionTemplate;
        }

        hardCoreModeToggle.isOn = charactersOnMissionList.getHardCoreMode();
        buttonsOnLeft.isOn = charactersOnMissionList.getButtonsOnLeft();
    }