// Use this for initialization
    void Start()
    {
        GameObject gameControlObject = GameObject.FindWithTag ("GameController");
        if (gameControlObject != null) {
            mGameController = gameControlObject.GetComponent <GameController>(); //get this instance's own game controller connection
        }
        if (mGameController == null) {
            UnityEngine.Debug.Log("Cannot find 'GameController' script"); //logging in case unable to find gamecontroller
        }

        mPlayer = GameObject.FindWithTag ("Player");
        if (mPlayer != null) {
            mPlayerController = mPlayer.GetComponent <TooBeeController>(); //get this instance's own game controller connection
        }

        //UnityEngine.Debug.Log(spriteRenderer.bounds.extents.x);
        //CapsuleCollider cap = (CapsuleCollider) mPlayer.GetComponent("CapsuleCollider");

        //Physics.IgnoreCollision(cap, transform.GetComponent<BoxCollider>());
    }
    // Use this for initialization
    void Start()
    {
        GameObject gameControlObject = GameObject.FindWithTag("GameController");

        if (gameControlObject != null)
        {
            mGameController = gameControlObject.GetComponent <GameController>();             //get this instance's own game controller connection
        }
        if (mGameController == null)
        {
            UnityEngine.Debug.Log("Cannot find 'GameController' script");             //logging in case unable to find gamecontroller
        }

        mPlayer = GameObject.FindWithTag("Player");
        if (mPlayer != null)
        {
            mPlayerController = mPlayer.GetComponent <TooBeeController>();             //get this instance's own game controller connection
        }

        //UnityEngine.Debug.Log(spriteRenderer.bounds.extents.x);
        //CapsuleCollider cap = (CapsuleCollider) mPlayer.GetComponent("CapsuleCollider");

        //Physics.IgnoreCollision(cap, transform.GetComponent<BoxCollider>());
    }
    // Use this for initialization
    void Start()
    {
        GameObject gameControlObject = GameObject.FindWithTag("GameController");

        if (gameControlObject != null)
        {
            gameController = gameControlObject.GetComponent <GameController>();             //get this instance's own game controller connection
        }
        if (gameController == null)
        {
            UnityEngine.Debug.Log("Cannot find 'GameController' script");             //logging in case unable to find gamecontroller
        }

        player = GameObject.FindWithTag("Player");
        if (player != null)
        {
            playerController = player.GetComponent <TooBeeController>();             //get this instance's own game controller connection
        }

        playerAnimator = player.GetComponent <Animator>();
        timer          = new Stopwatch();
        spriteRenderer = GetComponent <Renderer>() as SpriteRenderer;
        //boxCol = GetComponent<BoxCollider>() as BoxCollider;
    }
    void Start()
    {
        PlayerPrefs.SetInt ("levelScore", 0);
        mCurrentLevel = PlayerPrefs.GetInt ("currentLevel");
        if (mCurrentLevel > 0) {
            levelText.text = "Level " + mCurrentLevel.ToString ();
        } else {
            levelText.text = "Level 1";
        }
        gameOver = false;
        //isWindowShown = false;
        Load ();
        _scoreFloat = 1000;
        mInvulnerabilityCountDown = 10;
        scoreText.text = Mathf.RoundToInt(_scoreFloat).ToString();
        numCansText.text = "x" + _numCans;

        GameObject playerObject = GameObject.FindWithTag ("Player");
        GameObject invulnerabilityObject = GameObject.FindWithTag("Invulnerability");
        if (playerObject != null) {
            playerController = playerObject.GetComponent <TooBeeController>(); //get this instance's own game controller connection
        }

        if (playerController == null) {
            Debug.Log("Cannot find 'GameController' script"); //logging in case unable to find gamecontroller
        }

        //trying to connect invulnerabilityColision to this class
        if (invulnerabilityObject != null) {
            invulnerabilityColision = invulnerabilityObject.GetComponent <InvulnerabilityColision>(); //get this instance's own game controller connection
        }

        if (invulnerabilityColision == null) {
            Debug.Log("Cannot find 'invulnerability' script"); //logging in case unable to find gamecontroller
        }

        UpdateScore();

        _lives = PlayerPrefs.GetInt("lives");

        if (extraLife > 0) {
            _lives += extraLife;
        }

        if (_lives > 3) {
            _lives = 3;
        }

        if (_lives < 3) {
            removeHeads(_lives);
        }

        waterGoal = GameObject.FindWithTag ("Water");
        playerController.setNumCans(_numCans);
        playerController.GetComponent<ParticleSystem>().Stop();
    }
示例#5
0
    void Start()
    {
        PlayerPrefs.SetInt("levelScore", 0);
        mCurrentLevel = PlayerPrefs.GetInt("currentLevel");
        if (mCurrentLevel > 0)
        {
            levelText.text = "Level " + mCurrentLevel.ToString();
        }
        else
        {
            levelText.text = "Level 1";
        }
        gameOver = false;
        //isWindowShown = false;
        Load();
        _scoreFloat = 1000;
        mInvulnerabilityCountDown = 10;
        scoreText.text            = Mathf.RoundToInt(_scoreFloat).ToString();
        numCansText.text          = "x" + _numCans;

        GameObject playerObject          = GameObject.FindWithTag("Player");
        GameObject invulnerabilityObject = GameObject.FindWithTag("Invulnerability");

        if (playerObject != null)
        {
            playerController = playerObject.GetComponent <TooBeeController>();             //get this instance's own game controller connection
        }

        if (playerController == null)
        {
            Debug.Log("Cannot find 'GameController' script");             //logging in case unable to find gamecontroller
        }

        //trying to connect invulnerabilityColision to this class
        if (invulnerabilityObject != null)
        {
            invulnerabilityColision = invulnerabilityObject.GetComponent <InvulnerabilityColision>();             //get this instance's own game controller connection
        }

        if (invulnerabilityColision == null)
        {
            Debug.Log("Cannot find 'invulnerability' script");             //logging in case unable to find gamecontroller
        }

        UpdateScore();

        _lives = PlayerPrefs.GetInt("lives");

        if (extraLife > 0)
        {
            _lives += extraLife;
        }

        if (_lives > 3)
        {
            _lives = 3;
        }

        if (_lives < 3)
        {
            removeHeads(_lives);
        }

        waterGoal = GameObject.FindWithTag("Water");
        playerController.setNumCans(_numCans);
        playerController.GetComponent <ParticleSystem>().Stop();
    }
    // Use this for initialization
    void Start()
    {
        GameObject gameControlObject = GameObject.FindWithTag ("GameController");
        if (gameControlObject != null) {
            gameController = gameControlObject.GetComponent <GameController>(); //get this instance's own game controller connection
        }
        if (gameController == null) {
            UnityEngine.Debug.Log("Cannot find 'GameController' script"); //logging in case unable to find gamecontroller
        }

        player = GameObject.FindWithTag ("Player");
        if (player != null) {
            playerController = player.GetComponent <TooBeeController>(); //get this instance's own game controller connection
        }

        playerAnimator = player.GetComponent<Animator>();
        timer = new Stopwatch ();
        spriteRenderer = GetComponent<Renderer>() as SpriteRenderer;
        //boxCol = GetComponent<BoxCollider>() as BoxCollider;
    }