Inheritance: MonoBehaviour
Exemplo n.º 1
0
 // Use this for initialization
 void Start()
 {
     Fader = GameObject.Find ("Fader").GetComponent<FaderScript>();
     if (first) {
         Setup();
     }
 }
 // Start is called before the first frame update
 void Start()
 {
     instructionScript = GameObject.FindGameObjectWithTag("InstructionScript").GetComponent <InstructionScript>();
     camera            = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <PlayerCameraFollowScript>();
     fader             = GameObject.FindGameObjectWithTag("Fader").GetComponent <FaderScript>();
     snowBallScript    = GameObject.FindGameObjectWithTag("Snowball").GetComponent <SnowBallScript>();
 }
Exemplo n.º 3
0
    // Use this for initialization
    void Start()
    {
        fader = GameObject.Find("Fader").GetComponent<FaderScript>();
        fader.guiAlpha = 1f;
        fader.FadeUp(null);

        faded = false;
    }
Exemplo n.º 4
0
    IEnumerator ChangeLevel(int level)
    {
        FaderScript fader = GameObject.Find("MenuScriptsHolder").GetComponent <FaderScript>();
        float       wait  = fader.BeginFade(1);

        yield return(new WaitForSeconds(wait));

        Application.LoadLevel(level);
    }
Exemplo n.º 5
0
void fadeeverything()
{
	for(int j=1;j<=7;j+=2)
	{
		fadeit=GameObject.Find("FadePlayer"+j.ToString());
			WallScript wallsc2 = fadeit.GetComponent<WallScript>();
		FaderScript fadescript = fadeit.GetComponent<FaderScript>();
			Debug.Log ("ID: "+wallsc2.id.ToString()+" owner: "+wallsc2.owner.ToString());
		fadescript.TotalFade();
	}
}
Exemplo n.º 6
0
    IEnumerator ChangeLevel(int levelNum)
    {
        //call screen fade
        FaderScript fdrs   = GetComponent <FaderScript>();
        float       result = fdrs.BeginFade(1);

        yield return(new WaitForSeconds(result));

        //load level number
        SceneManager.LoadScene(levelNum);
    }
Exemplo n.º 7
0
 private void Start()
 {
     m_fader = FindObjectOfType <FaderScript>();
     UpdateMenuButtons();
     if (m_mainAudioSource != null)
     {
         m_mainAudioSource = GetComponent <AudioSource>();
     }
     m_mainAudioSource.clip = m_menuSong;
     m_mainAudioSource.Play();
     m_winPanel.SetActive(false);
 }
Exemplo n.º 8
0
 void CreateSingleton()
 {
     if (instance != null)
     {
         Destroy(gameObject);
     }
     else
     {
         instance = this;
         DontDestroyOnLoad(gameObject);
     }
 }
Exemplo n.º 9
0
    private void Start()
    {
        m_cam       = Camera.main;
        m_mainColor = m_cam.backgroundColor;
        m_fader     = FindObjectOfType <FaderScript>();
        UpdateCollectableButtons();
        if (m_mainAudioSource != null)
        {
            m_mainAudioSource = GetComponent <AudioSource>();
        }
        m_mainAudioSource.clip = m_menuSong;
        m_mainAudioSource.Play();
        m_winPanel.SetActive(false);
        m_startLevelPanel.SetActive(false);

        if (m_restartOnPlay)
        {
            SaveManager.Instance.ResetSave();
        }
    }
Exemplo n.º 10
0
 // Start is called before the first frame update
 void Start()
 {
     thisText = GetComponent <Text>();
     fader    = GameObject.FindGameObjectWithTag("Fader").GetComponent <FaderScript>();
 }
Exemplo n.º 11
0
 // Start is called before the first frame update
 void Start()
 {
     instructionScript = GameObject.FindGameObjectWithTag("InstructionScript").GetComponent <InstructionScript>();
     fader             = GameObject.FindGameObjectWithTag("Fader").GetComponent <FaderScript>();
     snowBallScript    = GameObject.FindGameObjectWithTag("Snowball").GetComponent <SnowBallScript>();
 }
Exemplo n.º 12
0
	void Update ()
	{	//int x = 1;
		for (int i = 0; i < Input.touchCount; i++) {
			Touch touch = Input.GetTouch (i);
			if (touch.phase == TouchPhase.Ended) {
				Ray ray = Camera.main.ScreenPointToRay (touch.position);
				RaycastHit2D hit = Physics2D.Raycast (ray.origin, ray.direction);
				if (hit.collider != null) {
					//	D		
					if (hit.collider.tag == "Player") {   
						#region Hit Player
						
						//	Destroy (GameObject.Find ("FadePlayer" + x.ToString ()));
						WallScript wallsc = hit.transform.GetComponent<WallScript> ();
						if (wallsc) { 
							selectedwall = hit.transform.gameObject;
							selected=wallsc.id;
							fadeeverything ();
							m1 = wallsc.PossibleLeftMove ();
							m2 = wallsc.PossibleRightMove ();
							
							fadeit = GameObject.Find ("FadePlayer" + m1.ToString ());
							FaderScript fadescript = fadeit.GetComponent<FaderScript> ();
							WallScript tofade = fadeit.GetComponent<WallScript> ();
							if(wallsc.owner==0)
							{
								if (tofade.owner == wallsc.id || tofade.owner == 0)
									fadescript.fading = true;
								fadeit = GameObject.Find ("FadePlayer" + m2.ToString ());
								tofade = fadeit.GetComponent<WallScript> ();
								fadescript = fadeit.GetComponent<FaderScript> ();
								if (tofade.owner == wallsc.id || tofade.owner == 0)
									fadescript.fading = true;
							}
							else
							{
								if (tofade.owner == wallsc.id)
									fadescript.fading = true;
								fadeit = GameObject.Find ("FadePlayer" + m2.ToString ());
								tofade = fadeit.GetComponent<WallScript> ();
								fadescript = fadeit.GetComponent<FaderScript> ();
								if (tofade.owner == wallsc.id)
									fadescript.fading = true;
								
							}
							
						}
					}
					#endregion
					#region Hit RedWall
					else if (hit.collider.tag == "Redwall"&&selectedwall!=null) {
						WallScript ownerid = selectedwall.GetComponent<WallScript> ();
						WallScript getid = hit.collider.gameObject.GetComponent<WallScript> ();
						if (ownerid.owner == 0) {
							
							if (getid.owner == 0) {
								

								if (getid.id == m1 || getid.id == m2) {
									getid.owner = selected;
									ownerid.owner = 1;
									Vector3 savepos = selectedwall.transform.position;
									selectedwall.transform.position = hit.collider.transform.position;
									hit.collider.transform.position = savepos;
								} else {
									selected = 0;
									//		m1 = 0;
									//		m2 = 0;
									fadeeverything ();
								}
							} else if (getid.owner == selected) {   
								
								getid.owner = 0;
								if (getid.id == m1 || getid.id == m2) {
									ownerid.owner = 1;
									Vector3 savepos = selectedwall.transform.position;
									selectedwall.transform.position = hit.collider.transform.position;
									hit.collider.transform.position = savepos;
								} else {
									//selected = 0;
									//	m1 = 0;
									//	m2 = 0;
									fadeeverything ();
								}
								
							}
						} else {
							if (getid.owner == selected) {   
								
								getid.owner = 0;
								if (getid.id == m1 || getid.id == m2) {
									ownerid.owner = 0;
									Vector3 savepos = selectedwall.transform.position;
									selectedwall.transform.position = hit.collider.transform.position;
									hit.collider.transform.position = savepos;
									
								}	
							}
							
						}
						
					}
					#endregion
				}
				else  {
					//	selectedwall=null;
					fadeeverything();
				}
			}
			else { 
				if (touch.phase == TouchPhase.Began)
				{
					Debug.Log("I'm Here");
					Ray ray = Camera.main.ScreenPointToRay (touch.position);
					RaycastHit2D hit = Physics2D.Raycast (ray.origin, ray.direction);
					if (hit.collider != null) {
						//	D		
						if (hit.collider.tag == "Player") {   						
							//	Destroy (GameObject.Find ("FadePlayer" + x.ToString ()));
							WallScript wallsc = hit.transform.GetComponent<WallScript> ();
							if (wallsc) { 
								selectedwall = hit.transform.gameObject;
								selected=wallsc.id;
								fadeeverything ();
								m1 = wallsc.PossibleLeftMove ();
								m2 = wallsc.PossibleRightMove ();
								
								fadeit = GameObject.Find ("FadePlayer" + m1.ToString ());
								FaderScript fadescript = fadeit.GetComponent<FaderScript> ();
								WallScript tofade = fadeit.GetComponent<WallScript> ();
								if(wallsc.owner==0)
								{
									if (tofade.owner == wallsc.id || tofade.owner == 0)
										fadescript.fading = true;
									fadeit = GameObject.Find ("FadePlayer" + m2.ToString ());
									tofade = fadeit.GetComponent<WallScript> ();
									fadescript = fadeit.GetComponent<FaderScript> ();
									if (tofade.owner == wallsc.id || tofade.owner == 0)
										fadescript.fading = true;
								}
								else
								{
									if (tofade.owner == wallsc.id)
										fadescript.fading = true;
									fadeit = GameObject.Find ("FadePlayer" + m2.ToString ());
									tofade = fadeit.GetComponent<WallScript> ();
									fadescript = fadeit.GetComponent<FaderScript> ();
									if (tofade.owner == wallsc.id)
										fadescript.fading = true;
									
								}
								
							}
						}	
					}
				}
				else if (touch.phase == TouchPhase.Moved)
				{
					// Move the trail
					Ray ray = Camera.main.ScreenPointToRay (touch.position);
					RaycastHit2D hit = Physics2D.Raycast (ray.origin, ray.direction);
					if (hit.collider != null) {
						//	D		
						if (hit.collider.tag == "Redwall"&&selectedwall!=null) {
							WallScript ownerid = selectedwall.GetComponent<WallScript> ();
							WallScript getid = hit.collider.gameObject.GetComponent<WallScript> ();
							if (ownerid.owner == 0) {
								
								if (getid.owner == 0) {
									

									if (getid.id == m1 || getid.id == m2) {
										getid.owner = selected;
										ownerid.owner = 1;
										Vector3 savepos = selectedwall.transform.position;
										selectedwall.transform.position = hit.collider.transform.position;
										hit.collider.transform.position = savepos;
									} else {
										selected = 0;
										//m1 = 0;
										//m2 = 0;
										fadeeverything ();
									}
								} else if (getid.owner == selected) {   
									
									getid.owner = 0;
									if (getid.id == m1 || getid.id == m2) {
										ownerid.owner = 1;
										Vector3 savepos = selectedwall.transform.position;
										selectedwall.transform.position = hit.collider.transform.position;
										hit.collider.transform.position = savepos;
									} else {
										//selected = 0;
										//	m1 = 0;
										//	m2 = 0;
										fadeeverything ();
									}
									
								}
							} else {
								if (getid.owner == selected) {   
									
									getid.owner = 0;
									if (getid.id == m1 || getid.id == m2) {
										ownerid.owner = 0;
										Vector3 savepos = selectedwall.transform.position;
										selectedwall.transform.position = hit.collider.transform.position;
										hit.collider.transform.position = savepos;
										
									}
									
									
									
								}
								
							}
							
						}
						
					}
				}
				else if (touch.phase == TouchPhase.Ended)
				{
					// Clear known trails
					
					
				}
				
				
				
			}	
		}
		
	}
Exemplo n.º 13
0
 private void Start()
 {
     snowBallScript = GameObject.FindGameObjectWithTag("Snowball").GetComponent <SnowBallScript>();
     fader          = GameObject.FindGameObjectWithTag("Fader").GetComponent <FaderScript>();
 }