Beispiel #1
0
    public void setInfo(StadiumGraphWorker graph, FishData fd)
    {
        this.graph = graph;
        this.fd    = fd;

        int    dir   = UnityEngine.Random.Range(0, 3);
        float  pos   = UnityEngine.Random.Range(0, SAACollection.height) - SAACollection.halfHeight;
        int    or    = pos > 0 ? 1 : -1;
        float  npos  = UnityEngine.Random.Range(0, SAACollection.height) - SAACollection.halfHeight;
        double angle = (npos > pos ? (npos - pos) / SAACollection.width : (pos - npos) / SAACollection.halfWidth);

        angle *= 180 / Math.PI;
        Vector3 v3 = new Vector3(0, pos, 0);
        Vector3 q  = new Vector3(0, 0, 0);

        if (dir == 0)
        {//left	0
         //test.transform.
            v3.x = -SAACollection.halfWidth;
            q.z  = -or * (float)angle;
            q.y  = 180;
        }
        else
        {//right			1
            v3.x = SAACollection.halfWidth;
            q.z  = or * (float)angle;
        }

        transform.eulerAngles = q;
        transform.position    = v3;
    }
Beispiel #2
0
    public void setInfo(StadiumGraphWorker graph, FishData fd, long delay)
    {
        fish       = transform.Find(SAAppConfig.Language + "_" + fd.fishID + "s");
        stfish     = STFish.getMap()[fd.fishID];
        life       = stfish.Life;
        this.graph = graph;
        this.fd    = fd;
        float pos;
        float npos;

        isRight = fd.begin < 0;
        if (isRight)//从右侧出发
        {
            pos  = SAACollection.height * -fd.begin / 20 - SAACollection.halfHeight;
            npos = SAACollection.height * fd.end / 20 - SAACollection.halfHeight;
            transform.position = new Vector3(SAACollection.halfWidth, pos, 0);
            transform.LookAt(new Vector3(-SAACollection.halfWidth, npos, 0));
        }
        else
        {
            pos  = SAACollection.height * fd.begin / 20 - SAACollection.halfHeight;
            npos = SAACollection.height * -fd.end / 20 - SAACollection.halfHeight;
            transform.position = new Vector3(-SAACollection.halfWidth, pos, 0);
            transform.LookAt(new Vector3(SAACollection.halfWidth, npos, 0));
        }
        //矫正位置
        //transform.Translate(Vector3.forward * stfish.Speed * delay / 1000);
    }
Beispiel #3
0
 /**
  * long begin               开始时间
  * long current             当前时间
  * List<FishData> sof       鱼群
  * List<int> fsid           生存鱼的ID
  */
 public void init(StadiumGraphWorker graph, long startTime, long currentTime, List <FishData> sof)
 {
     this.graph       = graph;
     this.startTime   = startTime;
     this.currentTime = currentTime;
     this.sof         = sof;
     exit             = false;
     StartCoroutine("refresh");
 }