コード例 #1
0
ファイル: Ball.cs プロジェクト: NetkoNefarious/Pong
    private void UpdateAndContinue(string goalScore, bool isOutOfBounds)
    {
        if (!isOutOfBounds)
        {
            KeepScore.IncreaseTextUIScore(goalScore);
        }

        switch (Direction.x > 0)
        {
        case true:
            // This one is especially important for AI in order to not get scored on repeatedly
            Direction = Vector2.right.normalized;
            break;

        default:
            // Makes the ball go horizontally straight after scoring (in this case to the left)
            Direction = Vector2.left.normalized;
            break;
        }

        // Reset ball position
        transform.position = new Vector2(0, 0);

        // Staart the countdown
        StartCoroutine(score.Countdown());
    }
コード例 #2
0
    private static void PlaySound(string soundName)
    {
        var audioSource = KeepScore.GetInstance().GetComponent <AudioSource>();

        audioSource.clip = Resources.Load <AudioClip>(soundName);
        audioSource.Play();
    }
コード例 #3
0
 // Start is called before the first frame update
 void Start()
 {
     gm         = GameObject.FindGameObjectWithTag("scoremem").GetComponent <KeepScore>();
     score.text = "" + gm.score;
     retry.onClick.AddListener(() => reloadGame());
     quit.onClick.AddListener(() => quitGame());
 }
コード例 #4
0
 // Update is called once per frame
 void Update()
 {
     if (KeepScore.IsHighScore())
     {
         textDisplay.GetComponent <Text>().text = "You have acheived a new high score, enter initials: ";
     }
 }
コード例 #5
0
    public void EndGame()
    {
        GameTime -= Time.deltaTime;
        T         = GameTime;

        readval    = Player.GetComponent <KeepScore>();
        score      = readval.Points;
        Score.text = GameTime.ToString("0");

        if (GameTime < 0 && ended == false)
        {
            if (PlayerPrefs.GetInt("HighScore") < score)
            {
                PlayerPrefs.SetInt("HighScore", score);
            }
            Score.text = "GAME OVER: Score " + score.ToString();

            ended = true;
            FindObjectOfType <PlayerBehaviour>().enabled = false;
            FindObjectOfType <MobileMovement>().enabled  = false;
            FindObjectOfType <CoinMovement>().enabled    = false;
            FindObjectOfType <KeepScore>().enabled       = false;
            FindObjectOfType <TextDisplay>().enabled     = false;
            FindObjectOfType <TextDisplay>().enabled     = false;
            initscore.GetComponent <Text>().enabled      = false;
            FindObjectOfType <CameraMovement>().enabled  = false;


            Invoke("Pause", delay);
        }
    }
コード例 #6
0
    public void TotalScore()
    {
        // get the text object
        Text text = totalScoreText.GetComponent <Text> ();
        // get the players end score
        GameObject scoreText = GameObject.Find("ScoreText");
        KeepScore  script    = scoreText.GetComponent <KeepScore> ();

        totalScore = script.ScoreVal;
        text.text  = "Total Score: " + script.ScoreVal;
        // unlock ship 2
        if (script.ScoreVal >= 10000)
        {
            GameObject  GameControl = GameObject.Find("GameController");
            GameControl gameScript  = GameControl.GetComponent <GameControl> ();
            if (gameScript.unlockedShips[1] == true)
            {
                Debug.Log("Ship 2 already unlocked");
            }
            else if (gameScript.unlockedShips[1] == false)
            {
                GameObject          canvasManager = GameObject.Find("CanvasManager");
                ToggleNewShipCanvas NSCS          = canvasManager.GetComponent <ToggleNewShipCanvas> ();
                NSCS.newShip = true;
                Debug.Log("UNLOCK SHIP 2");
            }
            gameScript.unlockedShips[1] = true;
        }
    }
コード例 #7
0
ファイル: ChasePlayer.cs プロジェクト: atduskgreg/TenSeconds
	void Start () {
		player = GameObject.Find("player");
		bonusLifecycle = GameObject.Find("ObstacleManager").GetComponent<BonusLifecycle>();
		score = (KeepScore)GameObject.Find("progress_bar").GetComponent(typeof(KeepScore));

		minSpeed += Random.Range(-0.015f, 0.005f);
		maxSpeed += Random.Range(-0.08f, 0.01f);
	}
コード例 #8
0
    void ResetScore()
    {
        // reset the score
        GameObject scoreText   = GameObject.Find("ScoreText");
        KeepScore  scoreScript = scoreText.GetComponent <KeepScore>();

        scoreScript.Rest_Score();
    }
コード例 #9
0
	void Start () {
		score = (KeepScore)GameObject.Find("progress_bar").GetComponent(typeof(KeepScore));

		audioSource.clip = geigerSounds[Random.Range(0, geigerSounds.Length)];
		audioSource.Play();


	}
コード例 #10
0
 // Start is called before the first frame update
 void Start()
 {
     blueText.text = "Blue Points: 0";
     redText.text  = "Red Points: 0";
     scoreable     = true;
     keepScore     = FindObjectOfType <KeepScore>();
     playPS        = FindObjectOfType <PlayParticleSystem>();
 }
コード例 #11
0
    void AddToScore()
    {
        // add to score
        GameObject scoreText   = GameObject.Find("ScoreText");
        KeepScore  scoreScript = scoreText.GetComponent <KeepScore>();

        scoreScript.AddScore(GetPoints());
    }
コード例 #12
0
    public static void minusKills()
    {
        Lives -= 1;

        KeepScore textChanger = KeepScore.GetInstance();

        textChanger.ChangeText();

        PlaySound(LOSER_SOUND);
    }
コード例 #13
0
ファイル: Ball.cs プロジェクト: NetkoNefarious/Pong
    // Use this for initialization
    void Start()
    {
        Direction          = new Vector2();
        rigidBody          = GetComponent <Rigidbody2D>();
        rigidBody.velocity = Vector2.right * speed;

        score       = GameObject.Find("ScoreTimeCanvas").GetComponent <KeepScore>();
        topWallY    = GameObject.Find("Top Wall").transform.position.y;
        bottomWallY = GameObject.Find("Bottom Wall").transform.position.y;
    }
コード例 #14
0
    public static void addScore()
    {
        Score += 1;

        KeepScore textChanger = KeepScore.GetInstance();

        textChanger.ChangeText();

        PlaySound(VICTORY_SOUND);
    }
コード例 #15
0
	void Start () {
		score = (KeepScore)GameObject.Find("progress_bar").GetComponent(typeof(KeepScore));
		wipeoutDisplay = (UpdateWipeoutDisplay)GameObject.Find("WipeoutDisplay").GetComponent(typeof(UpdateWipeoutDisplay));

//		numWipeouts = startingWipeouts;

		currentTraps = new ArrayList();
		currentBonuses = new ArrayList();
		for(int i = 0; i < numStartingBonuses; i++){
			PlaceBonus();
		}
	}
コード例 #16
0
ファイル: KeepScore.cs プロジェクト: Fireez30/xmasjam18
 // Start is called before the first frame update
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
         DontDestroyOnLoad(this.gameObject);
     }
     else
     {
         Destroy(this.gameObject);
     }
 }
コード例 #17
0
 // Start is called before the first frame update
 void Start()
 {
     //may need to change this once we put in more than one particle system in the scene
     //playPS = FindObjectOfType<PlayParticleSystem>();
     keepScore      = FindObjectOfType <KeepScore>();
     herdAgent      = FindObjectOfType <HerdAgent>();
     mediumMaturity = herdAgent.mediumMaturity;
     fullMaturity   = herdAgent.fullMaturity;
     red            = redScore.GetComponent <Animator>();
     blue           = blueScore.GetComponent <Animator>();
     soundMidPlay   = FMODUnity.RuntimeManager.CreateInstance(soundMid);
     soundFullPlay  = FMODUnity.RuntimeManager.CreateInstance(soundFull);
 }
コード例 #18
0
	void Start () {
		manager = (ManageTutorial)GameObject.Find("TutorialManager").GetComponent(typeof(ManageTutorial));
		bl = (BonusLifecycle)GameObject.Find("ObstacleManager").GetComponent(typeof(BonusLifecycle));
		score = (KeepScore)GameObject.Find("progress_bar").GetComponent(typeof(KeepScore));

		if(isCollectionTarget || isTimed){
			GetComponent<Collider2D>().enabled = false;
		}
		if(ObjectsToAdd.Length > 0){
			for(int i = 0; i< ObjectsToAdd.Length; i++){
				ObjectsToAdd[i].SetActive(false);
			}
		}
	}
コード例 #19
0
    void OnCollisionEnter(Collision col)
    {
        collidedWith = col.gameObject;

        if (collidedWith.GetComponent <AudioSource>() != null && collidedWith.GetComponent <AudioSource>().isPlaying == true)
        {
            Destroy(collidedWith);
            KeepScore.addScore();
            CreateNewCube();
        }
        else
        {
            KeepScore.minusKills();
        }
    }
コード例 #20
0
ファイル: Sheep.cs プロジェクト: memonika/sheldons_sheeps
    void OnTriggerExit2D(Collider2D other)
    {
        SpriteRenderer renderer    = GetComponent <SpriteRenderer>();
        KeepScore      scoreKeeper = mainGame.GetComponent <KeepScore> ();

        if (correctKeyPressed == true)
        {
            renderer.sprite = sheepGreen;
            scoreKeeper.increaseScore();
        }
        else
        {
            renderer.sprite = sheepRed;
            scoreKeeper.decreaseScore();
        }
    }
コード例 #21
0
    void Start()
    {
        foreach (Image x in hillTimers)
        {
            x.color = new Color(255, 255, 255, 0f);
        }
        parameterSetByName = GameObject.FindObjectOfType <ParameterSetByName>();
        DontDestroyOnLoad(this);
        keepScore = FindObjectOfType <KeepScore>();
        Debug.Log(keepScore);
        winner             = "hi";
        hillCollection     = hills.GetComponentsInChildren <Transform>();
        timePassed_seconds = 1.0f;

        hillCollection = ConstructHillArray(hillCollection);
        foreach (Transform element in hillCollection)
        {
            element.gameObject.SetActive(false);
        }
        index      = Random.Range(0, hillCollection.Length);
        activeHill = hillCollection[index];
        activeHill.gameObject.SetActive(true);
        activatedHills.Add(index);
        changeTimerColor(activeHill);

        crystalSpawners  = GameObject.FindGameObjectsWithTag("crystalSpawner");
        desertSpawners   = GameObject.FindGameObjectsWithTag("desertSpawner");
        tropicalSpawners = GameObject.FindGameObjectsWithTag("tropicalSpawner");
        bisonSpawn       = crystalSpawners[0].GetComponent <BisonSpawn>();

        int totalBison = bisonCount * 2 * (crystalSpawners.Length + desertSpawners.Length + tropicalSpawners.Length);

        bisonNames = new string[totalBison];
        bisonNames = GenerateNames(totalBison);
        for (int k = 0; k < bisonNames.Length; k++)
        {
            //Debug.Log("bisonNames: " + bisonNames[k]);
            //Debug.Log("bisonNames: " + bisonNames[k]);
        }
        determineSpawnLocation(bisonCount, 0);
        parameterSetByName.TimeGet(gameTime_seconds, activeHill);
        refreshed = false;
        // Start time marker
        timeMarker.GetComponent <Transform>().DOLocalRotate(new Vector3(0f, 0f, 0f), 360f, RotateMode.Fast).SetEase(Ease.Linear);
    }
コード例 #22
0
    public void GetRank()
    {
        // get saved data
        GameObject  gameControl = GameObject.Find("GameController");
        GameControl gameScript  = gameControl.GetComponent <GameControl> ();
        // get score value
        KeepScore scoreScript = scoreText.GetComponent <KeepScore>();

        // for each one post the score
        for (int i = 0; i <= 4; i++)
        {
            if (highScore == false)
            {
                if (gameScript.scores[i] < scoreScript.ScoreVal)
                {
                    Rank      = i + 1;
                    highScore = true;
                }
            }
        }
    }
コード例 #23
0
    // Update is called once per frame
    void Update()
    {
        if (int.Parse(pourcentile.pourcentageTxt.text.Substring(0, pourcentile.pourcentageTxt.text.Length - 1)) <= 0)
        {
            gameOver_Sound.Play();

            objG.gravity = 5;
            if (spotlight.range > 0)
            {
                spotlight.range -= 0.1f;
            }

            cnv.enabled = true;

            if (endGame)
            {
                score.text = "Score: " + levelTxtBox.text;
                KeepScore.WriteHighScore(int.Parse(levelTxtBox.text)); //Checker si new highscoer avec le fichier text
                highscore.text = "Top score: " + KeepScore.ReadHighScore();
                endGame        = false;
            }
        }
    }
コード例 #24
0
ファイル: GetScoreOnUI.cs プロジェクト: PWalik/FFtest
 private void Start()
 {
     //find object of type is not a perfect solution, but since it's the only object of this type in scene and it goes through different scenes, it's the simplest one
     keep = FindObjectOfType <KeepScore>();
     PutUIScore();
 }
コード例 #25
0
ファイル: PushAndPull.cs プロジェクト: atduskgreg/TenSeconds
	// Use this for initialization
	void Start () {
		score = (KeepScore)GameObject.Find("progress_bar").GetComponent(typeof(KeepScore));
		animator.StopPlayback();

	}
コード例 #26
0
 void Update()
 {
     readval    = Player.GetComponent <KeepScore>();
     score      = readval.Points;
     Score.text = score.ToString();
 }
コード例 #27
0
ファイル: GetHit.cs プロジェクト: atduskgreg/TenSeconds
	void Start () {
		score = (KeepScore)GameObject.Find("progress_bar").GetComponent(typeof(KeepScore));
	}
コード例 #28
0
 void Awake()
 {
     Instance = this;
 }