예제 #1
0
 // Use this for initialization
 void Start()
 {
     scoreKeep  = GameObject.Find("ScoreKeeper").GetComponent <ScoreKeep> ();
     popupText += "\n\n (Click to close)";
     GameObject.Find("Popup").transform.GetChild(0).GetComponent <Text> ().text = popupText;
     isTouch = false;
 }
예제 #2
0
 // Use this for initialization
 void Start()
 {
     scoreKeep = GameObject.Find ("ScoreKeeper").GetComponent<ScoreKeep> ();
     popupText += "\n\n (Click to close)";
     GameObject.Find ("Popup").transform.GetChild (0).GetComponent<Text> ().text = popupText;
     isTouch = false;
 }
예제 #3
0
    // Use this for initialization
    void Start()
    {
        displayResult = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <ScoreKeep>();

        logScript = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <log>();

        logScript.file.Close();
    }
예제 #4
0
 void OnTriggerEnter(Collider otherCollider)
 {
     if (otherCollider == expectedCollider)
     {
         ScoreKeep scorekeep = FindObjectOfType <ScoreKeep> ();
         scorekeep.IncrementScore(1);
     }
 }
예제 #5
0
 // Start is called before the first frame update
 void Start()
 {
     Target      = Waypoints.waypoints[waypointIndex];
     Life        = 0;
     HP          = 100;
     Speed       = MaxSpeed;
     ScoreKeeper = FindObjectOfType <ScoreKeep>();
 }
예제 #6
0
    public void ToNextLevel()
    {
        int       currentSceneIndex = SceneManager.GetActiveScene().buildIndex;
        ScoreKeep sk = FindObjectOfType <ScoreKeep>();

        sk.SetMoney(300);
        sk.lastLvl = currentSceneIndex + 1;
        Instantiate(Restarter);
    }
예제 #7
0
 void Start()
 {
     if (FindObjectOfType <ScoreKeep>() != null)
     {
         ScoreKeep sk = FindObjectOfType <ScoreKeep>();
         ScoreAtLevel = sk.GetScore();
         MoneyAtLevel = sk.GetMoney();
         HpAtLevel    = sk.GetPlayerHP();
     }
 }
 void OnTriggerEnter(Collider otherCollider)
 {
     if (otherCollider == expectedCollider)
     {
         ScoreKeep    scoreKeep  = FindObjectOfType <ScoreKeep>();
         LevelManager lvlManager = FindObjectOfType <LevelManager>();
         scoreKeep.IncrementScore(1);
         lvlManager.IncrementTime();
     }
 }
예제 #9
0
    // Use this for initialization
    void Start()
    {
        ScoreKeep oldKeep = FindObjectOfType <ScoreKeep>();

        if (oldKeep)
        {
            score = oldKeep.score;
            Destroy(oldKeep.gameObject);
        }
    }
예제 #10
0
    public void RestartLevel()
    {
        int       currentSceneIndex = SceneManager.GetActiveScene().buildIndex;
        ScoreKeep sk = FindObjectOfType <ScoreKeep>();

        sk.SetPlayerHP(HpAtLevel);
        sk.SetScore(ScoreAtLevel);
        sk.SetMoney(MoneyAtLevel);
        sk.lastLvl = currentSceneIndex;
        Instantiate(Restarter);
    }
예제 #11
0
 public void ToTitleScreen()
 {
     SceneManager.LoadScene(0);
     if (FindObjectsOfType <ScoreKeep>().Length > 0)
     {
         GameCanvas gc = FindObjectOfType <GameCanvas>();
         ScoreKeep  sk = FindObjectOfType <ScoreKeep>();
         Destroy(gc.gameObject);
         Destroy(sk.gameObject);
     }
 }
예제 #12
0
    IEnumerator CheckForCollision()
    {
        yield return(null);

        if (collided)
        {
            ScoreKeep sk = FindObjectOfType <ScoreKeep>();
            sk.SpendMoney(-300);
            Debug.Log("Can not place here");
            Destroy(this.gameObject);
        }
    }
예제 #13
0
 // Use this for initialization
 void Start()
 {
     rend          = GetComponent <Renderer>();
     grabScript    = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <GrabDropScript>();
     coinCounter   = 0;
     logScript     = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <log>();
     source        = GetComponent <AudioSource>();
     pec           = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <PecCard>();
     scoreKeep     = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <ScoreKeep>();
     scoreVector   = new Vector3(0, 25, 0);
     scoreKeepBody = GameObject.Find("BodyPlaceHolders").GetComponent <ScoreKeep>();
     gameManager   = GameManager.getInstance();
 }
예제 #14
0
 // Start is called before the first frame update
 void Awake()
 {
     DontDestroyOnLoad(this.gameObject);
     gc       = FindObjectOfType <GameCanvas>();
     sk       = FindObjectOfType <ScoreKeep>();
     Money    = sk.GetMoney();
     Score    = sk.GetScore();
     playerHP = sk.GetPlayerHP();
     loadMe   = sk.lastLvl;
     Destroy(gc.gameObject);
     Destroy(sk.gameObject);
     gc = null;
     sk = null;
     SceneManager.LoadScene(loadMe);
 }
예제 #15
0
    void Start()
    {
        //pec = new GameObject[arraySize];

        //Associate the variables with Components in the MainCamera
        grabScript          = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <GrabDropScript>();
        interactionManager  = GameObject.FindGameObjectWithTag("MainCamera").GetComponents <InteractionManager>();
        result              = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <Timer>();
        scriptLog           = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <log>();
        engagementMeter     = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <EngagementMeter>();
        faceTrackingManager = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <FacetrackingManager>();
        scoreKeepBody       = GameObject.Find("BodyPlaceHolders").GetComponent <ScoreKeep>();



        source = GetComponent <AudioSource>();        //Gets AudioSource from the attached Object
    }
예제 #16
0
 private void Update()
 {
     if (FindObjectsOfType <ScoreKeep>().Length > 0)
     {
         sk = FindObjectOfType <ScoreKeep>();
         sk.SetMoney(Money);
         sk.SetScore(Score);
         sk.SetPlayerHP(playerHP);
         Destroy(this.gameObject);
     }
     if (FindObjectsOfType <FinalCanvas>().Length > 0)
     {
         FinalCanvas fc = FindObjectOfType <FinalCanvas>();
         fc.Score.GetComponent <TextMeshProUGUI>().text = "" + Score;
         Destroy(this.gameObject);
     }
 }
예제 #17
0
    // Update is called once per frame
    void Update()
    {
        if (!player && end)
        {
            gameOverScreen.SetActive(true);

            int currentScore = ScoreKeep.GetScore();

            if (currentHighScore < currentScore)
            {
                SetNewHighScore(currentScore);
            }

            string highestScore = currentHighScore.ToString();

            DisplayHighScore(highestScore);
            end = false;
        }
    }
    void OnCollisionEnter(Collision collision)
    {
        ScoreKeep scorekeep = FindObjectOfType <ScoreKeep> ();

        scorekeep.IncrementScore(scorePerHit);
    }
예제 #19
0
 // Start is called before the first frame update
 void Start()
 {
     gameCanvas  = FindObjectOfType <GameCanvas>().gameObject;
     ScoreKeeper = FindObjectOfType <ScoreKeep>();
 }
예제 #20
0
    // Start is called before the first frame update
    void Start()
    {
        ScoreKeep temp = FindObjectOfType <ScoreKeep>();

        ScoreKeeper = temp.gameObject;
    }
예제 #21
0
 // Use this for initialization
 void Start()
 {
     score = FindObjectOfType <ScoreKeep>();
     text  = GetComponent <Text>();
 }