Example #1
0
 private void SpawnAGVs(int[] agvs, int[] cells)
 {
     for (int i = 0; i < agvs.Length; i++)
     {
         Vector3    initpos = ParameterScript.Cell2Position(cells[i]);
         Quaternion initrot = Quaternion.Euler(new Vector3(0, -90, 0));
         m_AGVs[i].m_Instance = Instantiate(m_AGVPrefab, initpos, initrot) as GameObject;
         m_AGVs[i].m_Name     = "agv_" + agvs[i].ToString();
         m_AGVs[i].m_Address  = m_TrafficServerAddress;
         m_AGVs[i].m_Port     = m_TrafficServerPort;
         Vector3    tag_position = m_AGVs[i].m_Instance.transform.position + new Vector3(0, 3, 4);
         GameObject tag          = Instantiate(m_TagPrefab, tag_position, Quaternion.identity) as GameObject;
         tag.GetComponent <TextMesh>().text = "agv_" + agvs[i].ToString();
         tag.transform.SetParent(m_AGVs[i].m_Instance.transform);
         tag.transform.Rotate(90, 0, 0);
         m_AGVs[i].Setup();
     }
 }
Example #2
0
    public void AddPath(int[] paths, float speed)
    {
        Vector3[] new_paths = new Vector3[paths.Length];
        for (int i = 0; i < paths.Length; i++)
        {
            new_paths[i] = ParameterScript.Cell2Position(paths[i]);
        }
        Hashtable command = new Hashtable();

        command.Add("path", new_paths);
        command.Add("easeType", iTween.EaseType.easeInOutSine);
        command.Add("speed", speed);
        command.Add("movetopath", false);
        command.Add("orienttopath", true);
        command.Add("oncomplete", "OnPathComplete");
        command.Add("oncompleteparams", paths[paths.Length - 1]);
        commands.Add(command);
        Debug.Log("Add path to " + m_Manager.m_Name + command.ToString());
    }