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; } } }
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--; } }
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(); } } }
void OnMouseDown() { if (state == CardState.Hidden && Playmat.GetPlaymat().NumberOfCardsFlipped != 2) { Playmat.GetPlaymat().NumberOfCardsFlipped++; state = CardState.Flipped; MarkDirty(); } }
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"))); } } } } }
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); }
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); //} } }
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--; } } }
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); }
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--; } }
IEnumerator WaitForPlaymatToLoad(string levelName) { yield return(new WaitForSeconds(.5f)); Playmat.GetPlaymat().CreateLayout(levelName); }
// Use this for initialization void Start() { mat = this; }
IEnumerator WaitForPlaymatToLoad() { yield return(new WaitForSeconds(0.0f)); Playmat.GetPlaymat().CreateLayout(Playmat.GetPlaymat().board.name); }
public void updateScore() { scoretime.text = "Score: " + Playmat.GetPlaymat().GetPointsString(); }
// Start is called before the first frame update void Start() { playmat = this; //GameSettings.Instance().SetDifficulty(GameSettings.GameDifficulty.Medium); }