Esempio n. 1
0
 public void spawn()
 {
     skinColor  = utils.Instance.getSkinColor(skinColorId);
     m_Instance = UnityEngine.Object.Instantiate(Resources.Load("Prefab/unit"), m_pos, new Quaternion(0, 0, 0, 0)) as GameObject;
     m_Instance.transform.parent = GameObject.Find("units").transform;
     m_movement = m_Instance.GetComponent <unitMovement>();
     m_skin     = m_Instance.GetComponent <unitSkin>();
     m_unitUI   = m_Instance.GetComponent <unitUI>();
     m_movement.init(this);
     m_skin.init(this);
     m_unitUI.init(this);
     ai.init(this);
 }
Esempio n. 2
0
    public void spawn(int x, int y)
    {
        Vector3 v = GSceneMap.Instance.gridToWorldPosition(new GridID(x, y));

        grid       = new GridID(x, y);
        m_pos      = v;
        m_Instance = UnityEngine.Object.Instantiate(Resources.Load("Prefab/unit"), v, new Quaternion(0, 0, 0, 0)) as GameObject;
        m_Instance.transform.parent = GameObject.Find("units").transform;
        m_movement = m_Instance.GetComponent <unitMovement>();
        m_skin     = m_Instance.GetComponent <unitSkin>();
        m_unitUI   = m_Instance.GetComponent <unitUI>();
        m_movement.init(this);
        m_skin.init(this);
        m_unitUI.init(this);
    }