Esempio n. 1
0
 IEnumerator showEnd(float time_interval, hint h, GameObject obj)
 {
     yield return new WaitForSeconds(time_interval);
     showText(h);
     if (obj != null && !obj.activeSelf)
         obj.SetActive(true);
 }
Esempio n. 2
0
 private void showText(hint text, float time_interval = 0.01f)
 {
     if (textfield == null)
         textfield = GameObject.FindGameObjectWithTag("tutorialText").GetComponent<Text>();
     if (text == null)
     {
         textfield.text = "";
         return;
     }
     if (text.showed)
         return;
     textfield.rectTransform.localPosition = new Vector2(text.x, text.y);
     textfield.text = "";
     monoBehaviour.StartCoroutine(loadText(text.content, 0, time_interval));
     text.showed = true;
 }
Esempio n. 3
0
    // Use this for initialization
    void Start()
    {
        player_sc = player.transform.GetChild(0).GetComponent <spacecraft>();
        //Debug.Log(player_sc);
        saveName    = "tu" + (tutorialNum + 1).ToString();
        checkedMark = GameStates.instance.GetTutorialData(saveName);

        Debug.Log("Checkmark: " + checkedMark);
        inst = new Dictionary <string, hint>();

        if (textfield == null)
        {
            textfield = GameObject.FindGameObjectWithTag("tutorialText").GetComponent <Text>();
        }


        textfield.text = "";

        switch (tutorialNum)
        {
        case 0:
            //Start page
            //printList();
            part_1 = new Part_1(player_sc, firstPlanet, secondPlanet, textfield, this);
            if (checkedMark < 1)
            {
                playerIntro.GetComponent <Text>().text = "This is You :)";
                StartCoroutine(waitToShowStuff(playerIntro, 1f));
            }
            break;

        case 1:
            //Tutorial level 1
            //Debug.Log(dist_ratio);

            break;

        case 2:
            inst["energy"] = new hint("You lose energy during interstellar travels.", false, 100, 200);
            inst["dust"]   = new hint("The dust charges your energy.", false, 0, -200);
            break;

        case 3:
            inst["obstacle"] = new hint("Avoid these squared rocks!", false, -220, 200);
            break;
        }
    }
Esempio n. 4
0
    private void showText(hint text, float time_interval = 0.01f)
    {
        if (text == null)
        {
            textfield.text = "";
            return;
        }
        if (text.showed)
        {
            return;
        }
        Debug.Log(text.content + "," + text.x + "," + text.y);

        textfield.rectTransform.localPosition = new Vector2(text.x, text.y);
        textfield.text = "";
        StartCoroutine(loadText(text.content, 0, time_interval));
        text.showed = true;
    }
Esempio n. 5
0
    public Part_1(spacecraft player_sc, GameObject firstPlanet, GameObject secondPlanet,Text textfield, MonoBehaviour monoBehaviour)
    {
        this.player_sc = player_sc;
        this.firstPlanet = firstPlanet;
        this.secondPlanet = secondPlanet;
        this.textfield = textfield;

        this.monoBehaviour = monoBehaviour;
        Dictionary<string, hint> instr = new Dictionary<string, hint>();
        instr["release"] = new hint("Relase to launch yourself!");
        instr["hold"] = new hint("First, hold the screen.");
        instr["compliment"] = new hint("Good job!", false, 200, 200);
        instr["goal_1"] = new hint("Get here!", false, 200, 200);
        instr["goal_2"] = new hint("Now get here!", false, 350, 300);
        instr["congrat"] = new hint("Well done, let's get into the game!", false, 0, 200);

        this.inst = instr;
    }
Esempio n. 6
0
    // Update is called once per frame
    void Update()
    {
        //Debug.Log(checkedMark);

        if (textfield == null)
        {
            textfield = GameObject.FindGameObjectWithTag("tutorialText").GetComponent <Text>();
        }


        if (tutorialNum == 0)
        {
            part_1.runtimeRoutine();
        }
        else if (player_sc.won && (tutorialNum == 1 || tutorialNum == 2 || tutorialNum == 3))
        {
            showText(null);
            if (tutorialNum == 1 || tutorialNum == 3)
            {
                player_sc.end.transform.Find("arrow").gameObject.SetActive(false);
            }
        }
        //Debug.Log(dist_ratio + ", " + player_ratio);
        if (Input.GetKeyDown(KeyCode.Space) || (Input.touches.Length > 0 && Input.touches[0].phase == TouchPhase.Ended))
        {
            if (stopped)
            {
                if (tutorialNum == 0)
                {
                    if (playerIntro != null && playerIntro.activeSelf)
                    {
                        playerIntro.SetActive(false);
                    }
                }
                else if (tutorialNum == 3)
                {
                    if (obstacle.activeSelf)
                    {
                        obstacle.SetActive(false);
                    }
                }
                stopped = false;
            }
        }

        if (player_sc.rotatingPlanet != null)
        {
            if (tutorialNum == 0)
            {
                part_1.onPlanetRoutine();
            }
            else if (tutorialNum == 1)
            {
                if (checkedMark < 1)
                {
                    hint start_campagin = new hint("Get here to start!", false, 250, -110);
                    showText(start_campagin);
                    player_sc.end.transform.Find("arrow").gameObject.SetActive(true);
                    checkedMark++;
                    GameStates.instance.SaveTutorialData(checkedMark, saveName);
                }
            }
            else if (tutorialNum == 2)
            {
                if (player_sc.rotatingPlanet == secondPlanet && checkedMark < 1)
                {
                    showText(inst["energy"]);
                    checkedMark++;
                    GameStates.instance.SaveTutorialData(checkedMark, saveName);
                }
                if (player_sc.rotatingPlanet == thirdPlanet && checkedMark < 2)
                {
                    showText(inst["dust"]);
                    checkedMark++;
                    GameStates.instance.SaveTutorialData(checkedMark, saveName);
                }
            }
            else if (tutorialNum == 3)
            {
                if (player_sc.rotatingPlanet == firstPlanet && checkedMark < 1)
                {
                    showText(inst["obstacle"]);
                    player_sc.end.transform.Find("arrow").gameObject.SetActive(true);
                    checkedMark++;
                    GameStates.instance.SaveTutorialData(checkedMark, saveName);
                }
            }
        }
    }
Esempio n. 7
0
 public void RemoveHintAsync(hint h)
 {
     _database.Table <hint>().DeleteAsync(i => i.Hint.Equals(h.Hint));
 }
Esempio n. 8
0
 public Task <int> SaveHintAsync(hint h)
 {
     return(_database.InsertAsync(h));
 }
 // Start is called before the first frame update
 void Start()
 {
     _hint = GetComponent <hint>();
 }