Inheritance: MonoBehaviour
Ejemplo n.º 1
0
    // Use this for initialization
    void Start ()
    {
        levelSoundIndex = PlayerPrefs.GetInt("levelSoundIndex");
        gObj = GameObject.Find("_Manager");
        csScript = gObj.GetComponent<ChangeScene>();

        if(levelSoundIndex == 1 || levelSoundIndex == 2 || levelSoundIndex == 3)
        {
            audioLength = csScript.lvl1Music.clip.length + 4;
            difference = 25000 - (int)audioLength * 50;
        }
        else if(levelSoundIndex == 4 || levelSoundIndex == 5 || levelSoundIndex == 6)
        {
            audioLength = csScript.lvl2Music.clip.length + 4;
            difference = 25000 - (int)audioLength * 50;
        }
        else if(levelSoundIndex == 7 || levelSoundIndex == 8 || levelSoundIndex == 9)
        {
            audioLength = csScript.lvl3Music.clip.length + 4;
            difference = 25000 - (int)audioLength * 50;
        }

        gObj = GameObject.Find("TimeText");
        guiTimeText = gObj.GetComponent<Text>();

        gObj = GameObject.Find("ScoreText");
        guiScoreText = gObj.GetComponent<Text>();

        gObj = GameObject.Find("AnswersText");
        guiAnswersText = gObj.GetComponent<Text>();
    }
Ejemplo n.º 2
0
    private void checkForWinner()
    {
        GameObject  manager     = GameObject.Find("_Manager");
        ChangeScene changescene = manager.GetComponent <ChangeScene>();
        GameObject  bust;
        GameObject  win;
        GameObject  lose;
        GameObject  push;

        //Check for winner before turn is over
        if (playerOneTotal > 21)
        {
            print("You Bust");

            bust = Instantiate(bustMessage, new Vector3(0, 0, 0), Quaternion.identity) as GameObject;
            bust.transform.SetParent(GameObject.Find("Canvas").transform);
            flipAllCards(objectsOnScreen);
            bust.animation.Play();
            totalScoreOpponent += 1;

            hitButton.SetActive(false);
            standButton.SetActive(false);
        }

        if (playerOneTotal == 21)
        {
            print("You Win");

            win = Instantiate(winMessage, new Vector3(0, 0, 0), Quaternion.identity) as GameObject;
            win.transform.SetParent(GameObject.Find("Canvas").transform);
            flipAllCards(objectsOnScreen);
            win.animation.Play();
            totalScorePlayer += 1;

            hitButton.SetActive(false);
            standButton.SetActive(false);
        }
        if (stand == true)
        {
            if (playerOneTotal < 21)
            {
                if (opponentTotal > 21)
                {
                    win = Instantiate(winMessage, new Vector3(0, 0, 0), Quaternion.identity) as GameObject;
                    win.transform.SetParent(GameObject.Find("Canvas").transform);
                    flipAllCards(objectsOnScreen);
                    win.animation.Play();
                    print("You beat the AI");
                    totalScorePlayer += 1;

                    hitButton.SetActive(false);
                    standButton.SetActive(false);
                }
                else
                {
                    if (playerOneTotal > opponentTotal)
                    {
                        win = Instantiate(winMessage, new Vector3(0, 0, 0), Quaternion.identity) as GameObject;
                        win.transform.SetParent(GameObject.Find("Canvas").transform);
                        flipAllCards(objectsOnScreen);
                        win.animation.Play();
                        print("you beat the AI");
                        totalScorePlayer += 1;

                        hitButton.SetActive(false);
                        standButton.SetActive(false);
                    }

                    if (playerOneTotal < opponentTotal)
                    {
                        print("the AI beat you");

                        lose = Instantiate(loseMessage, new Vector3(0, 0, 0), Quaternion.identity) as GameObject;
                        lose.transform.SetParent(GameObject.Find("Canvas").transform);
                        flipAllCards(objectsOnScreen);
                        lose.animation.Play();
                        totalScoreOpponent += 1;

                        hitButton.SetActive(false);
                        standButton.SetActive(false);
                    }

                    if (playerOneTotal == opponentTotal)
                    {
                        print("You Have the same score");

                        push = Instantiate(pushMessage, new Vector3(0, 0, 0), Quaternion.identity) as GameObject;
                        push.transform.SetParent(GameObject.Find("Canvas").transform);
                        flipAllCards(objectsOnScreen);
                        push.animation.Play();
                        totalScoreOpponent += 1;

                        hitButton.SetActive(false);
                        standButton.SetActive(false);
                    }
                }
            }
        }
    }
Ejemplo n.º 3
0
 private void Start()
 {
     speed       = 0.3f;
     movement    = GetComponent <PlayerMovement>();
     changeScene = GameObject.FindGameObjectWithTag(Tags.gameController).GetComponentInParent <ChangeScene> ();
 }
 private void GameOver()
 {
     changeScene = GameObject.Find ("SceneManager").GetComponent<ChangeScene> ();
     changeScene.SwitchScene ("gameOverScreen");
 }
Ejemplo n.º 5
0
    void Start()
    {
        if (!gm)
        {
            try
            {
                gm = GameObject.FindGameObjectWithTag("GM").GetComponent<GameMaster>();
            }
            catch (System.Exception)
            {
                throw;
            }
        }

        cs = new ChangeScene();
    }
Ejemplo n.º 6
0
 void Start()
 {
     startTime = Time.time;
     Cs        = new ChangeScene();
 }
Ejemplo n.º 7
0
 // Use this for initialization
 void Start()
 {
     spriteRenderer = GetComponent<SpriteRenderer>();
     sceneChanger = GetComponent<ChangeScene> ();
 }
Ejemplo n.º 8
0
 // Start is called before the first frame update
 void Start()
 {
     SceneChanger = SceneGameObject.GetComponent <ChangeScene>();
 }
Ejemplo n.º 9
0
 public void Exit()
 {
     ChangeScene.Exit();
 }
Ejemplo n.º 10
0
 public void Change(string scene)
 {
     GameStatic.SetNext(true);
     ChangeScene.Change(scene);
 }
Ejemplo n.º 11
0
 public void Restart()
 {
     ChangeScene.Restart();
 }
Ejemplo n.º 12
0
    // ズームアウト終わった判定が必要

    void Start()
    {
        this.transform.position = cameraStartPoint;
        st = GameObject.Find("StageChangeCanvas").GetComponent <StageTransition>();
        cs = GameObject.Find("UIObject").GetComponent <ChangeScene>();
    }
Ejemplo n.º 13
0
 void Start()
 {
     PS = GameObject.FindObjectOfType <PlayerScript>();
     IT = GameObject.FindObjectOfType <ItemTrack>();
     Cs = GameObject.FindObjectOfType <ChangeScene>();
 }
Ejemplo n.º 14
0
 public void Change(string scene)
 {
     ChangeScene.Change(scene);
 }
Ejemplo n.º 15
0
 public void Change(int scene)
 {
     ChangeScene.Change(scene);
 }
Ejemplo n.º 16
0
 // Use this for initialization
 void Start()
 {
     spriteRenderer = GetComponent <SpriteRenderer>();
     sceneChanger   = GetComponent <ChangeScene> ();
 }
 private void OnMouseDown()
 {
     SceneChange = GameObject.Find("ChangeSceneManager").GetComponent <ChangeScene>();
     SceneChange.BattleToWorld();
 }
Ejemplo n.º 18
0
 void Start()
 {
     Ps = GameObject.FindObjectOfType <PlayerScript>();
     Cs = GameObject.FindObjectOfType <ChangeScene>();
 }
Ejemplo n.º 19
0
 void Start()
 {
     Cs             = GameObject.FindObjectOfType <ChangeScene>();
     Cursor.visible = false;
 }
Ejemplo n.º 20
0
 private void Awake()
 {
     m_ChangeScene = GetComponent <ChangeScene>();
     TimerText     = TimerCanvas.GetComponentInChildren <Text>();
 }
Ejemplo n.º 21
0
 void Start()
 {
     instance = this;
 }
 private void Start()
 {
     sceneChanger    = GameObject.Find("GameplayUI").GetComponent <ChangeScene>();
     musicController = GameObject.FindWithTag("MusicAmbientController").GetComponent <MusicAmbientController>();
 }
Ejemplo n.º 23
0
 void Start()
 {
     instance = this;
     anim     = GetComponent <Animator>();
 }
Ejemplo n.º 24
0
 void Start()
 {
     audioManager = GameObject.FindGameObjectWithTag("AudioManager");
     instance     = this;
 }
Ejemplo n.º 25
0
	// Use this for initialization
	void Start () {
        levelSoundIndex = PlayerPrefs.GetInt("levelSoundIndex");
        PauseUI.SetActive(false);
        gObj = GameObject.Find("_Manager");
        csScript = gObj.GetComponent<ChangeScene>();
    }
Ejemplo n.º 26
0
    public void processturn()
    {
        GameObject  manager     = GameObject.Find("_Manager");
        ChangeScene changescene = manager.GetComponent <ChangeScene>();

        //player one wins turn over opponent
        //must add opponents card to player ones deck. Also must take players ones card they just played and add it to back of deck
        if (getCardValue(playerOneCards[0]) > getCardValue(opponentCards[0]))
        {
            playerOneWin();
            checkForWinner();
            return;
        }
        //opponent wins turn
        else if (getCardValue(playerOneCards[0]) < getCardValue(opponentCards[0]))
        {
            opponentWin();
            checkForWinner();
            return;
        }

        //WARRRRRRR!!!!
        //laying one more card face down then playing next card after that
        if (getCardValue(playerOneCards[0]) == getCardValue(opponentCards[0]))
        {
            int    i      = 0;
            string winner = "none";

            while (winner == "none")
            {
                //war occuring going to need to visually show this

                i = i + 2;

                if (playerOneCards[i] == null && playerOneCards.Count < opponentCards.Count)
                {
                    changescene.changeToScene("menu");
                }

                if (opponentCards[i] == null && playerOneCards.Count > opponentCards.Count)
                {
                    changescene.changeToScene("menu");
                }

                if (getCardValue(playerOneCards[i]) > getCardValue(opponentCards[i]))
                {
                    winner = "playerone";
                }
                if (getCardValue(playerOneCards[i]) < getCardValue(opponentCards[i]))
                {
                    winner = "opponent";
                }
            }

            if (winner == "playerone")
            {
                for (int x = 0; x <= i; x++)
                {
                    playerOneWin();
                }
            }

            if (winner == "opponent")
            {
                for (int x = 0; x <= i; x++)
                {
                    opponentWin();
                }
            }
        }
    }
Ejemplo n.º 27
0
 public void Play()
 {
     ChangeScene.LoadRespectiveScene();
 }
Ejemplo n.º 28
0
 void Awake()
 {
     changeScene             = GameObject.FindGameObjectWithTag("ChangeScene").GetComponent <ChangeScene>();
     changeScene.loreManager = this;
 }