Пример #1
0
    private void addLocationToContainer(LocationState locState, int locationIndex)
    {
        GameObject currLocationObj = Instantiate(locationPointPrefab, new Vector3(), new Quaternion()) as GameObject;

        // Реакция на нажатие
        GameObject LocButton = currLocationObj.transform.FindChild("Button").gameObject;

        LocButton.GetComponent <Button> ().onClick.AddListener(() => onLocationClickListener(locState));

        // Текст
        GameObject LocText       = LocButton.transform.FindChild("Text").gameObject;
        string     locHiddenMark = locState.isVisible ? "" : "[*] ";

        LocText.GetComponent <Text> ().text = locHiddenMark + locState.getName();

        // Позиционирование
        RectTransform AnswRT = currLocationObj.GetComponent <RectTransform> ();

        AnswRT.SetParent(locationsContainer);
        AnswRT.localScale = new Vector3(1, 1, 1);
        AnswRT.anchorMin  = new Vector2(0.2f + Random.Range(0.0f, 0.6f), 0.2f + Random.Range(0.0f, 0.6f));
        AnswRT.anchorMax  = AnswRT.anchorMin;
        AnswRT.offsetMax  = new Vector2(0, 0);
        AnswRT.offsetMin  = new Vector2(0, 0);
    }
Пример #2
0
    public override String ToString()
    {
        String resultString = "";

        if (charState == null)
        {
            resultString += "[charState:null, ";
        }
        else
        {
            resultString += "[charState:" + charState.name + ", ";
        }

        if (sector == null)
        {
            resultString += "sector:null, ";
        }
        else
        {
            resultString += "sector:" + sector.getName() + ", ";
        }

        if (location == null)
        {
            resultString += "location:null]";
        }
        else
        {
            resultString += "location:" + location.getName() + "]";
        }
        return(resultString);
    }