Esempio n. 1
0
    public void Init()
    {
        gameManager = GameManager.Instance;
        marker      = transform.Find("ClusterMarker");
        line        = transform.Find("ClusterMarker/Line");
        homePos     = transform.position;
        mainCamera  = Camera.main;

        //StartCoroutine(CreateUnits());
        if (!HideUI && gameObject.tag.Equals("Friend"))
        {
            UI = transform.Find("ClusterUI").GetComponent <UICluster>().Init();
            UI.AddLine(marker.GetComponent <Renderer>(), line.GetComponent <Renderer>());
        }
        foreach (ClusterDescription.Segment segment in clusterDescription.segments)
        {
            Facility facility = gameManager.GetClosestFacility(transform.position, gameObject.tag);
            if (!facility)
            {
                Debug.Log("Can't find facility");
            }
            Debug.Log("Sumbmitting order for " + segment.amount + "  " + segment.type);
            facility.SubmitOrder(new Facility.UnitOrder(this, segment.type, segment.amount));
        }
        gameManager.InputControl.AddCluster(this);
        clusterReady = true;
    }