示例#1
0
        void Update()
        {
            if (transform.position != targets[current_target].position)
            {
                Vector3 pos = Vector3.MoveTowards(transform.position, targets[current_target].position, speed);
                transform.LookAt(pos);
                GetComponent <Rigidbody>().MovePosition(pos);

                if (animIndex != 13)
                {
                    playAnimation(13);
                }
            }
            else
            {
                Vector3 cam_pos = GameObject.Find("main_camera").gameObject.transform.position;
                cam_pos.y = 0f;
                transform.LookAt(cam_pos);
                if (animIndex != 0)
                {
                    playAnimation(0);
                }
                CanvasController.UpdateCanvas(current_target);
            }
        }
示例#2
0
        // Use this for initialization
        void Start()
        {
            // Inicia a fila do dialogo
            fila = new ArrayList();

            _gameObject = this;

            foreach (Text t in GetComponents <Text>())
            {
                Debug.Log("text name: " + t.name);
            }
            foreach (Button b in GetComponents <Button>())
            {
                Debug.Log("button name: " + b.name);
            }

            // Se estiver no android, inicia o TTS
            if (Application.platform == RuntimePlatform.Android)
            {
                tts = new TextToSpeech();
            }

            userData = GameController.LoadGameData();

            dialogueBox.onClick.AddListener(delegate
            {
                ViewNext();
            });

            int first_time = PlayerPrefs.GetInt("first_time");

            if (first_time == 0)
            {
                FirstTime();
                PlayerPrefs.SetInt("first_time", 1);
            }

            /* var notificationParams = new NotificationParams {
             *  Id = NotificationIdHandler.GetNotificationId (),
             *      Delay = TimeSpan.FromSeconds (5),
             *      Title = PlayerPrefs.getString ("nickname") + " do Agito",
             *      Message = "A partir de agora te enviarei notificações",
             *      Ticker = "para que você se lembre de interagir comigo!",
             *      Multiline = true
             * };
             * NotificationManager.SendCustom (notificationParams); */

            /* NotificationManager.SendWithAppIcon(
             *  TimeSpan.FromSeconds(5),
             *  "AGITO",
             *  "Hora de medir sua glicemia!",
             *  new Color(0, 0.6f, 1),
             *  NotificationIcon.Star
             *  ); */

            NotificationCallback nb = NotificationManager.GetNotificationCallback();

            Debug.Log("Notification Callback " + nb);
            if (nb != null)
            {
                switch (nb.Data)
                {
                case "glicemia":
                    getTips();
                    break;

                default:
                    break;
                }
            }

            // Clear Notifications
            NotificationManager.CancelAllDisplayed();
        }