Пример #1
0
 // Update is called once per frame
 void Update()
 {
     //if (!startWalk) return; //only show on the ACT III
     if (Input.GetKeyUp(KeyCode.I))
     {
         length = 0;
     }
     if (!positionInfo.InBed(gameObject))
     {
         if (!allPoints.Contains(transform.position))
         {
             tempDist     = Vector3.Distance(transform.position, oldPosition);
             currentAngle = Vector3.Angle(transform.position, oldPosition);
             if (oldDistance > minMoveDist && (currentAngle - oldAngle) < Mathf.Deg2Rad * minMoveAngle)
             {
                 length += oldDistance;
                 //Debug.Log("Adding distance, angle:" + (currentAngle - oldAngle));
             }
             allPoints.Add(transform.position);
             Vector3[] tempPoints = new Vector3[allPoints.Count];
             //allPoints.CopyTo(points);
             //line.points3 = points;
             //line.Draw3DAuto();
             //line.material.color = color;
         }
         oldAngle    = currentAngle;
         oldPosition = transform.position;
         oldDistance = tempDist;
         //if(fakeDistance != null){
         //	fakeDistance.text = length.ToString().Split('.')[0] + "ft";
         headsUpCont.updateStepCounter(Mathf.FloorToInt(length));
         //}
     }
 }