Beispiel #1
0
    void InGame()
    {
        GUI.Label(new Rect(Screen.width / 2 - 50, 0, 100, 20), "Score: " + Playmat.GetPlaymat().GetPointsString());

        if (GUI.Button(new Rect(0, 0, 100, 30), "Quit"))
        {
            Destroy(Playmat.GetPlaymat().gameObject);
            state = State.Menu;
        }

        if (Playmat.GetPlaymat().gameWon)
        {
            if (GUI.Button(new Rect(Screen.width / 2 - 50, Screen.height / 2, 100, 30), "Play Again?"))
            {
                Destroy(Playmat.GetPlaymat().gameObject);
                Instantiate(playmat);
            }

            if (GUI.Button(new Rect(Screen.width / 2 - 50, Screen.height / 2 + 35, 100, 30), "Quit?"))
            {
                Destroy(Playmat.GetPlaymat().gameObject);
                state = State.Menu;
            }
        }
    }
Beispiel #2
0
    public IEnumerator StartCardFlip()
    {
        AnimationClip clip;

        clip = cardView.GetComponent <Animation>().GetClip("Card Flip");
        if (state == CardState.Flipped)
        {
            cardView.GetComponent <Animation>()["Card Flip"].speed = 1;
        }
        else
        {
            cardView.GetComponent <Animation>()["Card Flip"].speed = -1;
            cardView.GetComponent <Animation>()["Card Flip"].time  = clip.length;
        }
        cardView.GetComponent <Animation>().Play();
        yield return(new WaitForSeconds(clip.length + delay));

        if (state == CardState.Flipped)
        {
            Playmat.GetPlaymat().SetCardsForMatch(this);
        }
        else
        {
            Playmat.GetPlaymat().NumberOfCardsFlipped--;
        }
    }
Beispiel #3
0
 void OnTouch()
 {
     for (int i = 0; i < Playmat.GetPlaymat().cards.Count; i++)
     {
         Playmat.GetPlaymat().cards[i].cardTimer = 0f;
     }
     if (GameSettings.Instance().difficulty == GameSettings.GameDifficulty.Easy)
     {
         if (state == CardState.Hidden && Playmat.GetPlaymat().NumberOfCardsFlipped != 2 && abletoflip)
         {
             Playmat.GetPlaymat().NumberOfCardsFlipped++;
             state = CardState.Flipped;
             MarkDirty();
         }
     }
     else
     {
         if (state == CardState.Hidden && Playmat.GetPlaymat().NumberOfCardsFlipped != 3)
         {
             Playmat.GetPlaymat().NumberOfCardsFlipped++;
             state = CardState.Flipped;
             MarkDirty();
         }
     }
 }
Beispiel #4
0
 void OnMouseDown()
 {
     if (state == CardState.Hidden && Playmat.GetPlaymat().NumberOfCardsFlipped != 2)
     {
         Playmat.GetPlaymat().NumberOfCardsFlipped++;
         state = CardState.Flipped;
         MarkDirty();
     }
 }
Beispiel #5
0
    void Update()
    {
        if (Input.GetKey(KeyCode.Escape))
        {
            Application.LoadLevel(0);
        }
        //	PlayerPrefs.SetInt ("Level",1);
        //	GameController.currentLVL = PlayerPrefs.GetInt ("Level");
        //	PlayerPrefs.SetInt ("World",1);
        //	PlayerPrefs.Save ();
        //}

        if (InputController.HasTouchBegan())
        {
            ray = Camera.main.ScreenPointToRay(InputController.GetTouchPosition());
            if (Physics.Raycast(ray, out hit))
            {
                if (hit.collider.name.Contains("Home"))
                {
                    Destroy(Playmat.GetPlaymat().gameObject);

                    Application.LoadLevel(0);
                }
                else if (hit.collider.name.Contains("Replay"))
                {
                    Destroy(Playmat.GetPlaymat().gameObject);
                    if (PlayerPrefs.GetInt("CurrentLevel") > PlayerPrefs.GetInt("Level"))
                    {
                        PlayerPrefs.SetInt("Level", PlayerPrefs.GetInt("CurrentLevel"));
                    }
                    Application.LoadLevel(Application.loadedLevel);
                }
                else if (hit.collider.name.Contains("Mute"))
                {
                    mute();
                }
                else if (hit.collider.name.Contains("Next"))
                {
                    if (Application.loadedLevelName.Equals("Level9"))
                    {
                        Application.LoadLevel(19);
                    }
                    else
                    {
                        PlayerPrefs.SetInt("CurrentLevel", PlayerPrefs.GetInt("CurrentLevel") + 1);
                        Destroy(Playmat.GetPlaymat().gameObject);
                        Application.LoadLevel("Level" + (PlayerPrefs.GetInt("CurrentLevel")));
                    }
                }
            }
        }
    }
Beispiel #6
0
    static bool anchorExists; // backs public AnchorExists property
    #endregion                // PRIVATE_MEMBERS

    #region MONOBEHAVIOUR_METHODS

    void Start()
    {
        VuforiaARController.Instance.RegisterVuforiaStartedCallback(OnVuforiaStarted);
        VuforiaARController.Instance.RegisterOnPauseCallback(OnVuforiaPaused);
        DeviceTrackerARController.Instance.RegisterTrackerStartedCallback(OnTrackerStarted);
        DeviceTrackerARController.Instance.RegisterDevicePoseStatusChangedCallback(OnDevicePoseStatusChanged);

        m_PlaneFinder.HitTestMode = HitTestMode.AUTOMATIC;
        m_Playmat       = FindObjectOfType <Playmat>();
        m_PlaymatAnchor = m_PlaymatAugmentation.GetComponentInParent <AnchorBehaviour>();

        UtilityHelper.EnableRendererColliderCanvas(m_PlaymatAugmentation, false);
    }
Beispiel #7
0
    void Ingame()
    {
        //if (!won)
        //	GUI.Label (new Rect (Screen.width / 4 + 75, 0, Screen.width * 0.25f, Screen.height * 0.12f), "Score: " + Playmat.GetPlaymat ().GetPointsString (), style);
        //else GUI.Label (new Rect (Screen.width / 4 + 75, 0, Screen.width * 0.25f, Screen.height * 0.12f), "Time: " + PlayerPrefs.GetString("LevelTime"), style);
        //if(GUI.Button(new Rect(0,0,Screen.width*0.15f,Screen.height*0.12f),"Quit",style)){
        //	Destroy(Playmat.GetPlaymat().gameObject);
        //	Application.LoadLevel (0);
        //}

        if (Playmat.GetPlaymat().gameWon)
        {
            if (PlayerPrefs.GetInt("CurrentLevel" + 1) > PlayerPrefs.GetInt("Level"))
            {
                PlayerPrefs.SetInt("Level", PlayerPrefs.GetInt("CurrentLevel" + 1));
            }
            if (!won)
            {
                timer.StopTimer();
                Instantiate(victory, vicpos, victory.transform.rotation);
                won = true;
            }
            foreach (Card c in Playmat.GetPlaymat().all)
            {
                c.fadeOut();
            }

            //TODO: These buttons are images from ICONS texture map
            //if(GUI.Button(new Rect(Screen.width*0.425f,Screen.height*0.25f,Screen.width*0.15f,Screen.height*0.15f),"Play again!", style)){
            //	if(PlayerPrefs.GetInt ("CurrentLevel") > PlayerPrefs.GetInt ("Level")) PlayerPrefs.SetInt ("Level",PlayerPrefs.GetInt ("CurrentLevel"));
            //	Destroy(Playmat.GetPlaymat().gameObject);
            //	Application.LoadLevel("Level"+(PlayerPrefs.GetInt ("CurrentLevel")));
            //}

            //if(GUI.Button(new Rect(Screen.width*0.425f,Screen.height*0.5f,Screen.width*0.15f,Screen.height*0.15f),"Next Level", style)){
            //	if(Application.loadedLevelName.Equals ("Level9")){
            //		Application.LoadLevel(19);
            //	}
            //	else{
            //	PlayerPrefs.SetInt ("CurrentLevel",PlayerPrefs.GetInt ("CurrentLevel")+1);
            //	Destroy(Playmat.GetPlaymat().gameObject);
            //	Application.LoadLevel("Level"+(PlayerPrefs.GetInt ("CurrentLevel")));
            //	}
            //}

            //if(GUI.Button(new Rect(Screen.width*0.425f,Screen.height*0.75f,Screen.width*0.15f,Screen.height*0.15f),"Main Menu", style)){
            //	Destroy(Playmat.GetPlaymat().gameObject);
            //	Application.LoadLevel (0);
            //}
        }
    }
Beispiel #8
0
 public void setMatch()
 {
     if (state == CardState.Flipped)
     {
         Playmat.GetPlaymat().SetCardsForMatch(this);
     }
     else if (state == CardState.Hidden)
     {
         if (Playmat.GetPlaymat().NumberOfCardsFlipped <= 0)
         {
             Playmat.GetPlaymat().NumberOfCardsFlipped = 0;
         }
         else
         {
             Playmat.GetPlaymat().NumberOfCardsFlipped--;
         }
     }
 }
Beispiel #9
0
 void Start()
 {
     //prefablist=prefablist;
     //if(prefablist.Count==0){
     //string[] prefablist = {"Joejoe1","Joejoe2","Joejoe3","Joejoe5","Joejoe6","Joejoe7","Joejoe8","Joejoe9","Fleak1","Fleak2","Fleak3","Fleak4",
     //"Fleak5","Fleak6","Fleak7","Fleak8","Morphy2","Morphy3","Morphy4","Morphy5","Morphy6","Morphy7","Morphy8","Morphy10"};
     //}
     Random.seed = System.Environment.TickCount;
     level       = PlayerPrefs.GetInt("Level");
     currLevel   = PlayerPrefs.GetInt("CurrentLevel");
     world       = PlayerPrefs.GetInt("World");
     currWorld   = PlayerPrefs.GetInt("CurrentWorld");
     preflist.AddRange(prefablist);
     GameSettings.Instance().difficulty = GameSettings.GameDifficulty.Easy;
     last = 0;
     ui   = GameObject.FindGameObjectWithTag("UI").GetComponent <UI> ();
     mat  = this;
     xy   = board.name.Split(delimiter);
     int.TryParse(xy [0], out x);
     int.TryParse(xy [2], out y);
 }
Beispiel #10
0
    public IEnumerator StartCardFlip()
    {
        if (state == CardState.Flipped)
        {
            clip.speed = 1f;
        }
        else
        {
            clip.speed = -1f;
            clip.time  = clip.length;
        }

        anim.Play();
        yield return(new WaitForSeconds(clip.length + delay));

        if (state == CardState.Flipped)
        {
            Playmat.GetPlaymat().SetCardsForMatch(this);
        }
        else
        {
            Playmat.GetPlaymat().numberOfCardsFlipped--;
        }
    }
Beispiel #11
0
    IEnumerator WaitForPlaymatToLoad(string levelName)
    {
        yield return(new WaitForSeconds(.5f));

        Playmat.GetPlaymat().CreateLayout(levelName);
    }
Beispiel #12
0
 // Use this for initialization
 void Start()
 {
     mat = this;
 }
Beispiel #13
0
    IEnumerator WaitForPlaymatToLoad()
    {
        yield return(new WaitForSeconds(0.0f));

        Playmat.GetPlaymat().CreateLayout(Playmat.GetPlaymat().board.name);
    }
Beispiel #14
0
 public void updateScore()
 {
     scoretime.text = "Score: " + Playmat.GetPlaymat().GetPointsString();
 }
Beispiel #15
0
 // Start is called before the first frame update
 void Start()
 {
     playmat = this;
     //GameSettings.Instance().SetDifficulty(GameSettings.GameDifficulty.Medium);
 }