Ejemplo n.º 1
0
    // Use this for initialization
    void Start()
    {
        List <UnitServer> unitServer = player.getUnitList();

        Size  = unitServer.Count;
        units = new GameObject[Size];
        for (int x = 0; x < Size; x++)
        {
            GameObject  go     = GameObject.Instantiate(Resources.Load("Unit")) as GameObject;
            UnitBehavor script = go.GetComponent <UnitBehavor>();
            script.player = this;
            script.id     = unitServer[x].ID;
            Vector3 cord = map.convertMapToWorldCord((int)unitServer[x].position.x, (int)unitServer[x].position.y);
            go.transform.position   = cord;
            go.transform.parent     = gameObject.transform;
            units[unitServer[x].ID] = go;
        }
    }
Ejemplo n.º 2
0
 public void move(float x, float y)
 {
     transform.position = map.convertMapToWorldCord((int)x, (int)y);
 }