Esempio n. 1
0
    void Start()
    {
        if (GetComponent <NetworkView>().isMine)
        {
            gridObject = GameObject.Find("A*");
            ourgrid    = gridObject.GetComponent <Grid>();


            //PathRequestManager.RequestPath(transform.position, target.position, OnPathFound);
            //Debug.Log("Have Path? " + pathHolder.GetComponent<Paths>().isPath(pathName));
            if (!ourgrid.isPath(pathName))
            {
                ourgrid.CreateGridWithOutName(Creator.name, target.name);
                pathfinding = GetComponent <OnlinePathfinding>();
                pathfinding.StartFindPath(transform.position, target.position);
            }
            else
            {
                path = ourgrid.getPath(pathName);
                StopCoroutine("FollowPath");
                StartCoroutine("FollowPath");
            }
        }
    }
 void Awake()
 {
     instance    = this;
     pathfinding = GetComponent <OnlinePathfinding>();
 }