Beispiel #1
0
        public void updatePoi(int index)
        {
            // TODO: Performancekiller killen
            //if (signboard == null || billboard == null) return;
            float cameraAngle  = 0;
            float lookRotation = 0;

            //switch (showCase)
            //{
            //    case "signboard":
            //        cameraAngle = Quaternion.LookRotation(signboard.transform.position - Camera.main.transform.position).eulerAngles.y;
            //        //Debug.Log("signboard: " + lookRotation + " " + Quaternion.LookRotation(signboard.transform.position - Camera.main.transform.position).eulerAngles.y);
            //        break;
            //    case "billboard":
            //        cameraAngle = Quaternion.LookRotation(billboard.transform.position - Camera.main.transform.position).eulerAngles.y;
            //        //Debug.Log("lookRotation: " + lookRotation + " " + bearing + " " + Quaternion.LookRotation(billboard.transform.position - Camera.main.transform.position).eulerAngles.y);
            //        break;
            //}
            if (!initRotationDone)
            {
                cameraAngle = Quaternion.LookRotation(billboard.transform.position - Camera.main.transform.position).eulerAngles.y;
                float rotation = Mathf.Abs(cameraAngle + 90 - (float)bearing);
                rotation    %= 360;
                lookRotation = Mathf.Abs(rotation - 180);
                if (lookRotation > 90)
                {
                    billboard.transform.Rotate(new Vector3(0, 180, 0));
                    flipBillboard = 1;
                }
                //lookRotation = 180 - lookRotation;
            }
            initRotationDone = true;
            //DeadMosquito.AndroidGoodies.AGUIMisc.ShowToast(" " + lookRotation);
            float d = 1000 * (float)map.dist(lat, lon);

            //String newShowCase = "billboard";
            //if (d < 100)
            //{
            //    if ((showCase.Equals("billboard") && lookRotation > 65.0f) || (!showCase.Equals("billboard") && lookRotation > 45.0f))
            //    {
            //        newShowCase = "signboard";
            //    }
            //}
            //else
            //{
            //    newShowCase = "signboard";
            //}
            //if (!newShowCase.Equals(showCase) && !camera_lock)
            //{
            //    switch (newShowCase)
            //    {
            //        case "signboard":
            //            billboard.GetComponent<Billboard>().scaleOut();
            //            signboard.SetActive(true);
            //            signboard.GetComponent<Signboard>().scaleIn();
            //            break;
            //        case "billboard":
            //            signboard.GetComponent<Signboard>().scaleOut();
            //            billboard.SetActive(true);
            //            billboard.GetComponent<Billboard>().scaleIn();
            //            break;
            //    }
            //    showCase = newShowCase;
            //}
            //switch (showCase)
            //{
            //    case "signboard":
            //        signboard.GetComponent<Signboard>().updateSignboard();
            //        break;
            //    case "billboard":
            //        billboard.GetComponent<Billboard>().updateBillboard();
            //        break;
            //}
            billboard.GetComponent <Billboard>().updateBillboard();
        }