Example #1
0
    public override void Update()
    {
        if (touch.hasTaps())
        {
            endScene();
        }

        sceneManager.loopTracker.PlayAllButVocals();
    }
    // Cycles through displaying a sequence of action-response pairs for each object that is touched.
    // Calls onComplete when it reaches the end of a cycle with the object for which the sequence was completed.
    public void hintWhenTouched(Action<Sprite> onComplete, TouchSensor sensor, float currentTime, Dictionary<Sprite, ActionResponsePair[]> interactions)
    {
        //if (!sensor.hasTaps()) return; // only act on touches

        // if there was an interaction but a dialog has not shown yet...
        if (currentTime <= actionPrintedAt + promptTime && touchedObject != null) {
            // ignore a tap if it's been at least a half second since prompting
            if (sensor.hasTaps() && currentTime > actionPrintedAt + 0.5f) {
                return;
            }
            // ignore touches of the same object before the first dialog is shown
            if (touchedObject != null && sensor.insideSprite(Camera.main, touchedObject, TouchSensor.allPhases)) {
                return;
            }
        }

        // if a dialog was just shown, let it sit there for a moment
        if (currentTime <= actionPrintedAt + promptTime + 0.5f) {
            return;
        }

        // cycle through remaining dialogs
        if (remainingMessages.Count > 0) {
            if (sensor.hasTaps()) {
                messageBox.setMessage(remainingMessages[0]);
                remainingMessages.RemoveAt(0);
                actionPrintedAt = currentTime - promptTime;
                Debug.Log("tapped. messages remaining: " + remainingMessages.Count);
            }
            return;
        }

        // start an action-dialog sequence if they touched an interactive object

        touchedObject = detectObjectInteraction(sensor, interactions);

        if (touchedObject == null) return;

        var message = interactions[touchedObject][0];
        var action = message.action;
        var responses = message.responses;
        actionPrintedAt = currentTime;
        print(action, responses[0]);

        var restOfresponses = new List<string>(responses).Skip(1).ToList();
        hint(action, restOfresponses);

        if (interactions[touchedObject].Length > 1) {
            interactions[touchedObject] = interactions[touchedObject].Skip(1).ToArray();
        } else {
            target = touchedObject;
            this.onComplete = onComplete;
        }
    }
Example #3
0
    public override void Update()
    {
        var touch = new TouchSensor(input, gameObjectFinder);

        if (touch.insideSprite(Camera.main, buyMusic)) {
            Application.OpenURL("http://itunes.apple.com/us/album/same-not-same-ep/id533347009");
        }
        else if (touch.insideSprite(Camera.main, news)) {
            Application.OpenURL("http://themakingofthemakingof.com");
        }
        else if (touch.hasTaps()) {
            endScene();
        }

        if (cycle_title.Complete()) {
            animateStartButton();
        }

        cycle_title.Update(Time.time);
    }
Example #4
0
    public override void Update()
    {
        var touch = new TouchSensor(input, gameObjectFinder);

        if (touch.insideSprite(Camera.main, buyMusic))
        {
            Application.OpenURL("http://itunes.apple.com/us/album/same-not-same-ep/id533347009");
        }
        else if (touch.insideSprite(Camera.main, news))
        {
            Application.OpenURL("http://themakingofthemakingof.com");
        }
        else if (touch.hasTaps())
        {
            endScene();
        }

        if (cycle_title.Complete())
        {
            animateStartButton();
        }

        cycle_title.Update(Time.time);
    }