コード例 #1
0
 private void Start()
 {
     cameraAnim = Camera.main.GetComponent <Animator>();
     anim       = GetComponent <Animator>();
     rb         = GetComponent <Rigidbody2D>();
     transition = FindObjectOfType <sceneTransition>();
 }
コード例 #2
0
    // Use this for initialization
    void Start()
    {
        background   = GameObject.Find("MessageBackground").GetComponent <Image>();
        audioPlayer  = GetComponent <AudioSource>();
        sceneChanger = GetComponent <sceneTransition>();
        winMessage   = GameObject.Find("DeathMessage").GetComponent <Text>();

        if (sceneChanger.IsPlayScene())
        {
            FindObjectOfType <ScoreCounter>().ResetScore();
            Debug.Log("counting pigs and resetting scene scores");
            listOfEnemies = FindObjectsOfType <EnemySpawner>();
            CountEnemies(listOfEnemies);
            //FindObjectOfType<ScoreCounter>().ResetScore();
        }
        if (sceneChanger.GetCurrentScene() == 2)
        {
            FindObjectOfType <ScoreCounter>().ResetTotalScore();
        }

        if (sceneChanger.IsGameOver())
        {
            Debug.Log("This should print in last scenes");
            FinalResult();
        }
    }
コード例 #3
0
ファイル: Player.cs プロジェクト: swabac/Bandanas-2d-shooter
 private void Start()
 {
     rb               = GetComponent <Rigidbody2D>();
     anim             = GetComponent <Animator>();
     player           = GameObject.FindGameObjectWithTag("Player2").transform;
     sceneTransitions = FindObjectOfType <sceneTransition>();
 }
コード例 #4
0
 private void Start()
 {
     halfHealth         = health / 2;
     anim               = GetComponent <Animator>();
     healthBar          = FindObjectOfType <Slider>();
     healthBar.maxValue = health;
     healthBar.value    = health;
     transition         = FindObjectOfType <sceneTransition>();
 }
コード例 #5
0
 // Use this for initialization
 void Start()
 {
     audioPlayer       = GetComponent <AudioSource>();
     sceneChanger      = GetComponent <sceneTransition>();
     currentSceneIndex = sceneChanger.GetCurrentScene();
     if (currentSceneIndex == 0)
     {
         StartCoroutine(LoadFromSplashWithDelay());
     }
 }