Inheritance: MonoBehaviour
Example #1
0
    public void slice(Vector3 posA, Vector3 posB)
    {
        GameObject partOne          = Instantiate(slicePartOne, transform.position, transform.rotation);
        GameObject partTwo          = Instantiate(slicePartTwo, transform.position, transform.rotation);
        Transform  partOneTransform = partOne.transform.Find("TransparencyMask");
        Transform  partTwoTransform = partTwo.transform.Find("TransparencyMask");
        Vector3    dir = posB - posA;

        float angleA = (Mathf.Atan2(dir.y, dir.x) * Mathf.Rad2Deg) - 90f;
        float angleB = (Mathf.Atan2(dir.y, dir.x) * Mathf.Rad2Deg) + 90f;

        partOneTransform.rotation = Quaternion.AngleAxis(angleA, Vector3.forward);
        partTwoTransform.rotation = Quaternion.AngleAxis(angleB, Vector3.forward);

        partOne.GetComponent <Rigidbody2D>().AddForce(-partOneTransform.right * 200f);
        partTwo.GetComponent <Rigidbody2D>().AddForce(-partTwoTransform.right * 200f);

        ScoreScript scoreScript = GameObject.Find("ScoreText").GetComponent <ScoreScript>();
        GameObject  point       = Instantiate(pointText, transform.position, Quaternion.identity);

        if (isBomb)
        {
            scoreScript.addScore(-1);
            point.GetComponentInChildren <TextMesh>().text = "-1";
            cameraShake.shake(true);
        }
        else
        {
            scoreScript.addScore(1);
            cameraShake.shake(false);
        }
        Destroy(gameObject);
    }
Example #2
0
    private void Start()
    {
        // initialize options
        // Graphics
        if (PlayerPrefs.HasKey("Graphics"))
        {
            graphicsDropdown.value = PlayerPrefs.GetInt("Graphics");
        }
        else
        {
            graphicsDropdown.value = 2; // High graphics by default
        }
        graphicsDropdown.RefreshShownValue();

        // Volume
        if (PlayerPrefs.HasKey("Volume"))
        {
            volumeSlider.value = PlayerPrefs.GetFloat("Volume");
        }
        else
        {
            volumeSlider.value = 0.6f; // 60% global volume by default
        }

        // HighScore
        score = new ScoreScript();
        if (PlayerPrefs.HasKey("HighScore"))
        {
            highScore.text = PlayerPrefs.GetInt("HighScore").ToString();
        }
        else
        {
            highScore.text = "0"; // 0 if high score does not exist before
        }
    }
Example #3
0
    //   void elapsed(object sender, ElapsedEventArgs e) {
    //	//decrease time left (working in 1/5 of a second)
    //	timeLeft = timeLeft - timeTest;

    //	//update time bar
    //	barScript.percent = timeLeft/60f;
    //}

    void Start()
    {
        GameObject timerObject = GameObject.FindWithTag("TimerBar");

        if (timerObject != null)
        {
            barScript = timerObject.GetComponent <timerBar>();
        }
        if (timerObject == null)
        {
            Debug.Log("Cannot find 'barScript' script");
        }
        GameObject scoreObject = GameObject.FindWithTag("Score");

        if (scoreObject != null)
        {
            scoreScript = scoreObject.GetComponent <ScoreScript>();
        }

        startTime = Time.time;

        //      //Initialize timer with 1/5 second intervals
        //      LeTimer = new System.Timers.Timer (200);
        //LeTimer.Elapsed += new ElapsedEventHandler(elapsed);

        //LeTimer.Start();
    }
Example #4
0
    // Use this for initialization
    void Start()
    {
        string selectedSkin = DataController.GetSkin();

        if (selectedSkin == "rocks")
        {
            backImage.sprite = back_Cave;
        }
        else
        {
            backImage.sprite = back_Forest;
        }

        List <Score> scoresList = DataController.GetScores().scores;

        scoresList = scoresList.OrderByDescending(n => n.score).Take(20).ToList();

        foreach (Score score in scoresList)
        {
            GameObject  scorePanel  = Instantiate(scoreCardPrefab, scoreContainer.transform);
            ScoreScript scoreScript = scorePanel.GetComponent <ScoreScript>();

            scoreScript.user.text  = score.user;
            scoreScript.date.text  = score.dateTime.ToShortDateString();
            scoreScript.score.text = score.score.ToString();
        }
    }
Example #5
0
	void Start(){
		sc  = GetComponent<ScoreScript> ();
		hud = GameObject.Find ("HUD").GetComponent<HUD>();
		hud.nRecord = sc.GetRecord ();
		hud.nScore  = sc.GetScore ();
		sc.ResetScore (); //zera os pontos
	}
Example #6
0
 // Use this for initialization
 void Start()
 {
     songLoader     = gameManager.GetComponent <SongLoader>();
     soundConverter = gameManager.GetComponent <SoundConverter>();
     audioSource    = gameManager.GetComponent <AudioSource>();
     scoreScript    = gameManager.GetComponent <ScoreScript>();
 }
    void OnCollisionEnter(Collision collision)
    {
        int spawnPowerUp = Random.Range(1, 6);

        //HERE YOU CAN PLAY A SOUNDCLIP

        //REMOVE BLOCK
        foreach (ContactPoint contact in collision.contacts)
        {
            if (collision.gameObject.tag.Equals("Block"))
            {
                Destroy(collision.gameObject);
                GameControls.gameControls.changeBallSpeed(1.5f);

                ScoreScript.increasePoints();

                Instantiate(explosion, transform.position, transform.rotation);
                Instantiate(tilesExplosion, transform.position, transform.rotation);

                explosion.startSize = 50f;
                explosion.Play();
                tilesExplosion.Play();


                //POWERUPS DROP RANDOMLY
                if (spawnPowerUp == 1)
                {
                    Transform powerUp = Instantiate(powerUpPrefab, new Vector3(collision.gameObject.transform.position.x, collision.gameObject.transform.position.y), Quaternion.identity) as Transform;
                    Physics.IgnoreCollision(powerUp.GetComponent <Collider>(), GetComponent <Collider>(), true);
                }
            }
        }
    }
 public void SetPromptsAndGameManager(Prompts prompts1, GameManager gameManager1, ScoreScript s)
 {
     prompts     = prompts1;
     gameManager = gameManager1;
     scoreScript = s;
     UpdateInstructions();
 }
Example #9
0
    void Start()
    {
        Text scoreText = GetComponent <Text>();

        scoreText.text = ScoreScript.GetScore();
        ScoreScript.Reset();
    }
Example #10
0
 // Start is called before the first frame update
 void Start()
 {
     _malusTimerInitializer = 20f;
     _malusTimer            = _malusTimerInitializer;
     _dayLight = DayLightScript.script;
     _score    = GameObject.Find("Player").GetComponent <ScoreScript>();
 }
Example #11
0
 // Use this for initialization
 void Start()
 {
     if (instance == null)
     {
         instance = this;
     }
 }
Example #12
0
 void Start()
 {
     scoreScript = GameObject.Find("EventManager").GetComponent <ScoreScript>();
     rb          = GetComponent <Rigidbody>();
     target      = GameObject.Find("Player").GetComponent <Transform>();
     timer       = 0;
 }
Example #13
0
 /// <summary>
 /// Create a line renderer and raycast for the laser shooting mechanic, during which the player cannot move.
 /// </summary>
 /// <returns>The coroutine.</returns>
 private IEnumerator LaserCoroutine()
 {
     canMove = false;
     while (Input.GetKey(KeyCode.Space))
     {
         Ray        ray = new Ray(gameObject.transform.position, new Vector3(0, 0, 1));
         RaycastHit hit;
         if (Physics.SphereCast(ray, 1.0f, out hit))
         {
             if (hit.collider.gameObject.CompareTag("Virus"))
             {
                 Destroy(hit.collider.gameObject);
                 ScoreScript.AddPoints();
                 GameObject.FindGameObjectWithTag("VirusDeath").GetComponent <AudioSource>().Play();
             }
             if (hit.collider.gameObject.CompareTag("RedBloodCell"))
             {
                 LoseLife();
                 Destroy(hit.collider.gameObject);
                 GameObject.FindGameObjectWithTag("RedCellDeath").GetComponent <AudioSource>().Play();
             }
         }
         laserLineRenderer.SetPosition(0, gameObject.transform.position);
         laserLineRenderer.SetPosition(1, gameObject.transform.position + new Vector3(0, 0, 60));
         laserLineRenderer.startWidth = 1f;
         laserLineRenderer.endWidth   = 1f;
         laserLineRenderer.enabled    = true;
         yield return(null);
     }
     laserLineRenderer.enabled = false;
     canMove = true;
 }
Example #14
0
    void spawnEnemies()
    {
        Vector2 floorSize = floor.getHalfSize();
        // make the enem(ies)
        int enemy_count = (int)Random.Range(enemyLowerBound, enemyUpperBound); // generate a random number of enemies

        for (int i = 0; i < enemy_count; i++)                                  // loop to create them
        {
            Vector3 EnemyLocation;
            bool    success = true;
            do
            {
                success = true;

                // calculate enemy location using width and depth of the plane
                float xPos = Random.Range(-floorSize.x, floorSize.x);
                float zPos = Random.Range(-floorSize.y, floorSize.y);
                EnemyLocation = new Vector3(xPos, 1.0f, zPos);

                float playerX = player.transform.position.x;
                float playerZ = player.transform.position.z;

                if ((playerX + spawnRadius) > EnemyLocation.x && (playerX - spawnRadius) < EnemyLocation.x &&
                    (playerZ + spawnRadius) > EnemyLocation.z && (playerZ - spawnRadius) < EnemyLocation.z)
                {
                    Debug.Log("Too close");
                    success = false;
                }
            } while (!success);

            Instantiate(enemy, EnemyLocation, Quaternion.identity);
        }
        waveCount++;
        ScoreScript.updateWaveCount(waveCount);
    }
Example #15
0
    public void Start()
    {
        // grabs the score script
        GameObject goWscript = GameObject.Find("Score UI");

        MyScoreScript = goWscript.GetComponent <ScoreScript>();
    }
Example #16
0
    // Start is called before the first frame update
    void Start()
    {
        scoreText            = GameObject.Find("ScoreText").GetComponent <Text>();
        scoreText2           = GameObject.Find("ScoreText2").GetComponent <Text>();
        timeText             = GameObject.Find("TimeText").GetComponent <Text>();
        replayScoreText      = GameObject.Find("ReplayButtonText").GetComponent <Text>();
        scoreScript          = GameObject.Find("ScoreScript").GetComponent <ScoreScript>();
        gameControllerScript = GameObject.Find("GameControllerScript").GetComponent <GameControllerScript>();
        projectileScriptv2   = GameObject.Find("Projectile Group").GetComponent <ProjectileScriptv2>();
        slingshotScriptv2    = GameObject.Find("Slingshot Group").GetComponent <SlingshotScriptv2>();
        obstaclesScript      = GameObject.Find("Obstacles Group").GetComponent <ObstaclesScript>();
        background           = GameObject.Find("Background");
        selectChar           = GameObject.Find("Selectcharacter");

        CatSelect    = GameObject.Find("CatSelect");
        PigSelect    = GameObject.Find("PigSelect");
        BearSelect   = GameObject.Find("Bear");
        PandaSelect  = GameObject.Find("Panda");
        GameStarter  = GameObject.Find("StartButton");
        ReplayButton = GameObject.Find("ReplayButton");
        Logo         = GameObject.Find("Logo");
        GameStarter.SetActive(false);
        ReplayButton.SetActive(false);
        scoreText2.enabled = false;

        Plank = GameObject.Find("Seg6");
    }
Example #17
0
 // Use this for initialization
 void Start()
 {
     EndObject = this.GetComponent<Canvas>();
        InGameUI = InGameUI.GetComponent<Canvas>();
        Score = scoretext.GetComponent<ScoreScript>();
        levelManager = GameObject.Find("LevelMan").GetComponent<LevelManager>();
 }
Example #18
0
 // Use this for initialization
 void Start()
 {
     manager = GameObject.Find("NameManager").GetComponent <NameManager>();
     script  = GameObject.Find("ScoreManager").GetComponent <ScoreScript>();
     label   = GetComponent <Text> ();
     Sender  = manager.GetName();
 }
Example #19
0
    public void OnTriggerEnter(Collider other)
    {
        if (other.tag == "PlayerGoal")
        {
            ScoreScript score = other.GetComponent <ScoreScript>();
            score.Player.Score++;

            UiManager.ScoreHasChanged();

            RedCarFastP1.GetComponent <PlayerCrontroller>().ResetPosition();   //new
            BlueCarFastP1.GetComponent <PlayerCrontroller>().ResetPosition();  //new

            StartCoroutine(ResetBall());
            audioManager.PlayGoal();
        }
        else if (other.tag == "Player2Goal")
        {
            ScoreScript score = other.GetComponent <ScoreScript>();
            score.Player2.Score++;

            UiManager.ScoreHasChanged();

            RedCarFastP1.GetComponent <PlayerCrontroller>().ResetPosition();   //new
            BlueCarFastP1.GetComponent <PlayerCrontroller>().ResetPosition();  //new

            StartCoroutine(ResetBall());
            audioManager.PlayGoal();
        }
    }
    void OnTriggerEnter2D(Collider2D other)
    {
        //Debug.Log ("Boom");
        if (other.tag == "Player")
        {
            sc = GameObject.Find("MainCamera").GetComponent <ScoreScript>();
            //audioSource.Play ();
            //audio.Play();
            Instantiate(coinEffect, transform.position, Quaternion.identity);
            //Destroy (GameObject.Find ("CoinEffect(Clone)"),1f);
            GetComponent <AudioSource>().pitch  = Random.Range(0.8f, 1.2f);
            GetComponent <AudioSource>().volume = Random.Range(0.8f, 1.2f);
            //GetComponent<AudioSource>().pitch = Random.Range(0.8f,1.2f);
            //GameObject<AudioSource>().pitch = Random.Range (0, 2);
            AudioSource.PlayClipAtPoint(clip, transform.position);

            //GetComponent<AudioSource>().Play();----------------this works too


            //audioSource.enabled = true;
            //audioSource.PlayOneShot (clip);
            Destroy(this.gameObject);
            sc.increaseScore(100);
        }
    }
Example #21
0
    void OnCollisionEnter2D(Collision2D collision)
    {
        if (collision.gameObject.tag == "Ground")
        {
            jumpedtwice = true;

            if (collision.gameObject.GetComponent <Collider2D>().isTrigger == false)
            {
                isGrounded = true;
            }
            if (nextstage)
            {
                SecondYPosition = this.transform.position.y;
                result          = SecondYPosition - FirstYPosition;
                Debug.Log("result " + result);
                if (!Dead)
                {
                    if ((result > 1.99f) && (result < 2.1f))
                    {
                        ScoreScript.AddPoint();
                        //audio.PlayOneShot(jumpSound2, 0.005F);
                        FirstYPosition = this.transform.position.y;
                    }
                }
            }
            else
            {
                FirstYPosition = this.transform.position.y;
            }

            isGrounded = true;
        }
    }
Example #22
0
    void Update()
    {
        maxX = field.bounds.extents.x;
        minX = -field.bounds.extents.x;
        maxY = field.bounds.extents.y;
        minY = -field.bounds.extents.y;

        GameObject  player = GameObject.Find("Steve_Square");
        ScoreScript steve  = player.GetComponent <ScoreScript>();

        if (steve.score == 3)
        {
            gameObject.GetComponent <SpriteRenderer>().enabled = false;
            gameObject.GetComponent <RestrictScript>().enabled = false;
        }

        HealthScript health = player.GetComponent <HealthScript>();

        if (health.hp <= 1)
        {
            gameObject.GetComponent <SpriteRenderer>().enabled = false;
            gameObject.GetComponent <RestrictScript>().enabled = false;
        }

        GameObject  clock = GameObject.Find("Timer");
        TimerScript t     = clock.GetComponent <TimerScript>();

        if (t.timer >= t.limit)
        {
            gameObject.GetComponent <SpriteRenderer>().enabled = false;
            gameObject.GetComponent <RestrictScript>().enabled = false;
        }
    }
Example #23
0
 public override void OnEated()
 {
     //Tornar os fantasmas azuis
     FindObjectOfType <SceneScript>().SetGhostMode(Mode.Fright);
     ScoreScript.AddScore(50);
     base.OnEated();
 }
Example #24
0
 // Use this for initialization
 void Start()
 {
     score     = FindObjectOfType <ScoreScript>();
     curHealth = health;
     _lockOn   = FindObjectOfType <Lock_On>();
     _targeted = FindObjectOfType <IsTargeted>();
 }
Example #25
0
 // Use this for initialization
 void Start()
 {
     rb = this.GetComponent<Rigidbody>();
     leftbrockerPositionX = Leftwall.transform.position.x;
     rightbrockerPositionX = Rightwall.transform.position.x;
     scoreS = scoreText.GetComponent<ScoreScript>();
 }
Example #26
0
 // Use this for initialization
 void Start()
 {
     //reference
     score  = FindObjectOfType <ScoreScript>();
     health = FindObjectOfType <HealthScript>();
     camera = FindObjectOfType <FollowTarget>();
 }
Example #27
0
    void Update()
    {
        GameObject  clock = GameObject.Find("Timer");
        TimerScript t     = clock.GetComponent <TimerScript>();

        timeLeft = maxTime - t.timer;

        if (timeLeft > 0)
        {
            timeBar.fillAmount = (timeLeft / maxTime);
        }

        GameObject  player = GameObject.Find("Steve_Square");
        ScoreScript steve  = player.GetComponent <ScoreScript>();

        if (steve.score == 3)
        {
            gameObject.GetComponent <Image>().enabled = false;
        }

        HealthScript health = player.GetComponent <HealthScript>();

        if (health.hp <= 1)
        {
            gameObject.GetComponent <Image>().enabled = false;
        }

        if (t.timer >= t.limit)
        {
            gameObject.GetComponent <Image>().enabled = false;
        }
    }
Example #28
0
    void Update()
    {
        GameObject  player = GameObject.Find("Steve_Square");
        ScoreScript steve  = player.GetComponent <ScoreScript>();

        if (SceneManager.GetActiveScene().buildIndex <= 5)
        {
            if (steve.score == 5)
            {
                Destroy(gameObject);
            }
        }

        if (SceneManager.GetActiveScene().buildIndex > 5 && SceneManager.GetActiveScene().buildIndex <= 9)
        {
            if (steve.score == 4)
            {
                Destroy(gameObject);
            }
        }

        if (SceneManager.GetActiveScene().buildIndex > 9)
        {
            if (steve.score == 3)
            {
                Destroy(gameObject);
            }
        }
    }
Example #29
0
 // Start is called before the first frame update
 void Start()
 {
     scoreScript = GameObject.Find("ScoreScript").GetComponent <ScoreScript>();
     myRigidbody = GetComponent <Rigidbody2D>();
     turnTimer   = 0;
     timeTrigger = 5f;
 }
Example #30
0
    // Start is called before the first frame update
    void Start()
    {
        initialize();

        player       = GameObject.Find("player").GetComponent <Player>();
        scoreManager = GameObject.Find("ScoreManager").GetComponent <ScoreScript>();
    }
Example #31
0
    // Use this for initialization
    void Start()
    {
        Text myText = GetComponent <Text> ();

        myText.text = ScoreScript.score.ToString();
        ScoreScript.Reset();
    }
Example #32
0
    // Start is called before the first frame update
    void Start()
    {
        scoreScript = GetComponent <ScoreScript>();
        cats        = FindObjectsOfType <Creature>();

        // Spawn extra cats
        Quaternion rot  = cats[0].transform.rotation;
        Vector3    pos  = cats[0].transform.position;
        Vector3    incr = new Vector3(.5f, 0, 0);

        for (int i = 0; i < LevelManager.CurrentLevel.ExtraCats; i++)
        {
            pos += incr;
            Instantiate(cats[0], pos, rot);
        }



        //int bowlsProcessed = 0;
        //foreach (var item in FindObjectsOfType<Item>()) {
        //    if (item.itemType == ItemType.Foodbowl) {
        //        var bowl = item.GetComponent<BowlScript>()
        //        bowlsProcessed++;
        //    }
        //}


        // :D
        // Disable too many extra bowls
        FindObjectsOfType <Item>()
        .Where(i => i.itemType == ItemType.Foodbowl)
        .Where(i => i.GetComponent <BowlScript>().IsExtra)
        .Skip(LevelManager.CurrentLevel.ExtraBowls)
        .ForEach(i => i.gameObject.SetActive(false));
    }
Example #33
0
    void OnGUI()
    {
        const int buttonWidth  = 84;
        const int buttonHeight = 60;

        // Draw a button to start the game
        if (
            GUI.Button(
                // Center in X, 2/3 of the height in Y
                new Rect(
                    Screen.width * 0.8f,
                    Screen.height / 2 - buttonHeight / 2,
                    buttonWidth,
                    buttonHeight
                    ),
                buttonText
                )
            )
        {
            // On Click, load the first level.
            // "Stage1" is the name of the first scene we created.
            ScoreScript.resetScore();
            Application.LoadLevel("Stage1");
        }
    }
	// Use this for initialization
	void Start () {
		groundMask = 1 << 8;
		playerGroundMask = 1 << 9; // maybe nine maybe just a number
		playerIndex = (PlayerIndex)playerNumber;
		SR = GetComponent<SpriteRenderer> ();
		SS = GameObject.Find ("ScoreObject").GetComponent<ScoreScript>();
		//SwingEffectPool = GameObject.Find ("LinePooler").GetComponent<ObjectPoolScript> ();
	}
Example #35
0
 // Use this for initialization
 void Start()
 {
     instance = this;
     //popupMaxTime = 0.25f / (float)(fadeOutSpeed);
     popups = new List<ScorePopup>();
     toRemove = new List<ScorePopup>();
     score = 0;
 }
 // Use this for initialization
 void Start()
 {
     PlaySE = this.GetComponent<AudioSource>();
     scoreS = scoreText.GetComponent<ScoreScript>();
     bonusSpawn = bonusSpawner.GetComponent<BonusSpawnerScript>();
     bonuschance = bonusLevelText.GetComponent<BonusChanceScript>();
     timeScript = TimeText.GetComponent<TimeScript>();
 }
Example #37
0
 // Use this for initialization
 void Start()
 {
     if (instance != null) {
         print ("more than one instance of Scorescript, or not");
         Destroy (this);
     } else {
         instance = this;
     }
 }
Example #38
0
    // Use this for initialization
    void Start()
    {
        if (HUDCanvas == null)
            HUDCanvas = GameObject.FindGameObjectWithTag("HUD").GetComponent<Canvas>();

        if (scoreScript == null)
            scoreScript = GameObject.FindGameObjectWithTag("Score").GetComponent<ScoreScript>();
        rb2d = GetComponent<Rigidbody2D>();
        invincibility = false;
    }
Example #39
0
    void Awake()
    {
        var controllerScript = GameObject.FindGameObjectWithTag ("GameController");
        generateScript = controllerScript.GetComponent<GenerateScript> ();
        scoreScript = controllerScript.GetComponent<ScoreScript> ();

        // recommended for debugging:
        PlayGamesPlatform.DebugLogEnabled = true;
        // Activate the Google Play Games platform
        PlayGamesPlatform.Activate ();
    }
Example #40
0
	void Awake()
	{
		myScoreRef = GameObject.Find("MoneyLabel").GetComponent<ScoreScript>();
		mySeatScriptRef = (GameObject.Find("BarSeats")).GetComponent<SeatsScript>();
		customer = this.gameObject;
		// Makes the baloon invisible at start
		baloon.SetActive(false);
		// Empties the current sprite slot
		mainDrinksScriptRef = (GameObject.Find("Drinks")).GetComponent<MainDrinksScript>();

	}
Example #41
0
    // Use this for initialization
    void Start()
    {
        // get Rigidbody
        rb = this.GetComponent<Rigidbody> ();

        // get wall x position
        leftWallPositionX = leftWall.transform.position.x;
        rightWallPositionX = rightWall.transform.position.x;

        // get score script
        scoreS = scoreText.GetComponent<ScoreScript> ();
    }
    // Use this for initialization
    void Awake()
    {
        numSpawned = 2;
        scorescript = GameObject.FindGameObjectWithTag("Player").GetComponent<ScoreScript>();
        found = false;
        player = GameObject.FindGameObjectWithTag("Player");

        c1 = Mathf.Cos (2 * Mathf.PI / 5);
        c2 = Mathf.Cos (Mathf.PI / 5);
        s1 = Mathf.Sin (2 * Mathf.PI / 5);
        s2 = Mathf.Sin (4 * Mathf.PI / 5);
    }
Example #43
0
 // Use this for initialization
 void Start()
 {
     AudioSource[] audioSources = this.GetComponents<AudioSource>();
     rankAA = audioSources[0];
     rankA = audioSources[1];
     rankBC = audioSources[2];
     rankD = audioSources[3];
     rankE = audioSources[4];
     Score = scoreScript.GetComponent<ScoreScript>();
     levelManager = GameObject.Find("LevelMan").GetComponent<LevelManager>();
     JudgeText = this.GetComponent<Text>();
     JudgeColor.a = 255f / 255f;
 }
Example #44
0
 // Use this for initialization
 void Start()
 {
     buttonsDatabase = buttonsDatabase.GetComponent<ButtonsDatabase>();
     buttonsHandler = GetComponent<ButtonsHandler>();
     endGameText = endGameText.GetComponent<Text>();
     buttonAgain = buttonAgain.GetComponent<Button>();
     imageAtEnd = imageAtEnd.GetComponent<Image>();
     buttonBackToMenu = buttonBackToMenu.GetComponent<Button>();
     scoreScript = scoreScript.GetComponent<ScoreScript>();
     buttonResetScore = buttonResetScore.GetComponent<Button>();
     textResetScore = buttonResetScore.GetComponentInChildren<Text>();
     textBackToMenu = buttonBackToMenu.GetComponentInChildren<Text>();
     textPlayAgain = buttonAgain.GetComponentInChildren<Text>();
     isRunning = true;
 }
Example #45
0
	void Start()
	{
		levelLoader = GameObject.FindObjectOfType<LevelLoader>();
		scoreScript = GameObject.FindObjectOfType<ScoreScript>();

		if( levelLoader.modeName == "Survival" )
			gameMode = GameMode.Survival;
		if( levelLoader.modeName == "Marked" )
			gameMode = GameMode.Marked;
		else if( levelLoader.modeName == "Feast" )
			gameMode = GameMode.Feast;
		else if( levelLoader.modeName == "Timed" )
			gameMode = GameMode.Timed;

		RegisterListeners();
	}
Example #46
0
 // Use this for initialization
 void Start()
 {
     _confirmScript = GameObject.FindObjectOfType<ConfirmScript>();
     _finishP1 = GameObject.Find("FinishP1");
     _dnfP1 = GameObject.Find("dnfP1");
     _finishP2 = GameObject.Find("FinishP2");
     _dnfp2 = GameObject.Find("dnfP2");
     _winnaarP2 = GameObject.Find("WinnaarP2");
     _winnaarP1 = GameObject.Find("WinnaarP1");
     _scoreScript = GameObject.FindObjectOfType<ScoreScript>();
     _musicScript = GameObject.FindObjectOfType<MusicScript>();
     _player1LevelScript = GameObject.FindObjectOfType<Player1LevelScript>();
     _player2LevelScript = GameObject.FindObjectOfType<Player2LevelScript>();
     _player1MoveScript = GameObject.FindObjectOfType<Player1MoveScript>();
     _player2MoveScript = GameObject.FindObjectOfType<Player2MoveScript>();
     _raceEnd = GameObject.FindGameObjectWithTag("RaceEnd");
 }
Example #47
0
    void Start()
    {
        currentHealth = 0f;
        slider.maxValue = startingHealth;
        slider.value = currentHealth;
        spanner.renderer.enabled = false;

        sparkles1.emit = false;
        sparkles2.emit = false;
        scoreScript = scoreText.GetComponent<ScoreScript>();
        trans = transform;
        audio = GetComponents<AudioSource>();
        FoW = GetComponent<FoWPlayerUnit>();
        fill = slider.GetComponentsInChildren<UnityEngine.UI.Image>()
            .FirstOrDefault(t => t.name == "Fill");
        canvas = GetComponentInChildren<Canvas>();
    }
Example #48
0
 void Awake()
 {
     ss = GameObject.FindObjectOfType<ScoreScript>();
 }
Example #49
0
 /**
  *	起動の際
  */
 void Awake()
 {
     instance 	= this;
     _source 	= GetComponent<AudioSource>();
 }
Example #50
0
	// Use this for initialization
	void Start () {
		player = GameObject.Find ("Player");
		hud = GameObject.Find ("HUD").GetComponent<HUD>();
		score = GetComponent<ScoreScript>();
		bomb = player.GetComponent<BombScript>();
	}
Example #51
0
    // Use this for initialization
    void Awake()
    {
        if( instance != null && instance != this )
        {
            Destroy( this.gameObject );
            //reaching here means the player died.  reset stuff
            playerTime = 0.0f;
            playerScore = 0;
            return;
        }
        else
        {
            instance = this;

        }

        DontDestroyOnLoad(transform.gameObject); //allow this script to retain data between levels
        currentLevel 	= 0;
        playerScore 	= 0;
        playerMoveCount = 0;
        playerTime 		= 0.0f;
        timerActive 	= false;
        playerName		= "mysterious stranger";
        nameKnown 		= false;
    }
Example #52
0
	// Use this for initialization
	void Awake () {
		Score = GameObject.Find("ScoreText").GetComponent<ScoreScript>();
		Score.score += point;
	
	}
Example #53
0
 // Use this for initialization
 void Start()
 {
     score = GameObject.FindGameObjectWithTag ("Player").GetComponent<ScoreScript> ();
 }
Example #54
0
    void Start()
    {
        ballsGO = new List<GameObject> ();
        ballsGO.Add((GameObject)Instantiate(Resources.Load(NameUtils.GO_BALL)));
        paddleGO = GameObject.Find(NameUtils.GO_PADDLE);
        timeScript = (TimeScript) GameObject.Find(NameUtils.GO_TIME_SCORE).GetComponent(typeof(TimeScript));
        scoreScript = (ScoreScript) GameObject.Find(NameUtils.GO_POINTS_SCORE).GetComponent(typeof(ScoreScript));

        lives = PlayerPrefs.GetInt(ScoreUtils.LIVES);
        listLives = new List<GameObject> ();

        for (int i = 0; i < lives; i++) {
            GameObject live = (GameObject)Instantiate(Resources.Load(NameUtils.GO_LIVE));
            Vector3 position = live.transform.position;
            position.x += (i * LIVE_OFFSET_X);
            live.transform.position = position;
            listLives.Insert(i, live);
        }

        GameObject[] gos = GameObject.FindGameObjectsWithTag(TagUtils.TAG_BRICKS);
        numberBricks = gos.Length;

        int levelNumber = StringUtils.getLevelBySceneName (PlayerPrefs.GetString (ScoreUtils.CURRENT_LEVEL_USER));
        basicScoreModifier = ScoreUtils.SCORE_LEVEL_MODIFIER * (levelNumber - 1);

        Time.timeScale = 1.0f;

        enableUI ();

        SoundManager.GetInstance ().changeAudio (sounds [IDX_SOUND_IN_GAME]);
        SoundManager.GetInstance ().volumeDown (0.5f);
    }
 // Use this for initialization
 void Start()
 {
     if (GameObject.FindObjectOfType<ConfirmScript>().Tutorial == false)
     {
         round = GameObject.FindObjectOfType<ConfirmScript>().Round;
     }
     _player1MoveScript = GameObject.FindObjectOfType<Player1MoveScript>();
     _player1LevelScript = GameObject.FindObjectOfType<Player1LevelScript>();
     _powerupScriptP1 = GameObject.FindObjectOfType<PowerUpScriptP1>();
     _scoreScript = GameObject.FindObjectOfType<ScoreScript>();
     _hittingWall = GameObject.Find("HittingWall");
     _player2LevelScript = GameObject.FindObjectOfType<Player2LevelScript>();
     _player2MoveScript = GameObject.FindObjectOfType<Player2MoveScript>();
     _powerUpScriptP2 = GameObject.FindObjectOfType<PowerUpScriptP2>();
     _confirmScript = GameObject.FindObjectOfType<ConfirmScript>();
 }
 // Use this for initialization
 void Start()
 {
     playerID = 1;
     currentPlayerText = currentPlayerText.GetComponent<Text>();
     buttonsDatabase = buttonsDatabase.GetComponent<ButtonsDatabase>();
     scoreScript = scoreScript.GetComponent<ScoreScript>();
     endMatch = GetComponent<EndMatch>();
 }
 // Use this for initialization
 void Start()
 {
     _confirmScript = GameObject.FindObjectOfType<ConfirmScript>();
     _p1MoveScript = GameObject.FindObjectOfType<Player1MoveScript>();
     _p2MoveScript = GameObject.FindObjectOfType<Player2MoveScript>();
     _scoreScript = GameObject.FindObjectOfType<ScoreScript>();
     _coinSound = GameObject.FindGameObjectWithTag("CoinPickUp").GetComponent<AudioSource>();
     _trackBuildScript = GameObject.FindObjectOfType<TrackBuildScript>();
 }
Example #58
0
 void Start()
 {
     scoreS = scoreText.GetComponent<ScoreScript> ();
     getSE = this.GetComponent<AudioSource> ();
 }
Example #59
0
 // private AudioClip getcoin;
 // Use this for initialization
 void Start()
 {
     scoreS = scoreText.GetComponent<ScoreScript>();
     PlaySe = this.GetComponent<AudioSource>();
       //  getcoin = this.GetComponent<AudioClip>();
 }
Example #60
0
 // Use this for initialization
 void Start()
 {
     score = GameObject.Find("Scripts").GetComponent<ScoreScript>();
     playerHealth = GameObject.Find ("player").GetComponent<PlayerHealth> ();
     sounds = GameObject.FindObjectOfType<Sounds> ();
 }