Exemple #1
0
    // Use this for initialization
    private void Start()
    {
        CircleCol = GetComponent<CircleCollider2D>();
        ring = GameObject.Instantiate(Resources.Load("Ring", typeof(Ring)), this.transform.position, Quaternion.identity) as Ring;
        floatingText = GameObject.Instantiate(Resources.Load("Score", typeof(FloatingScore)), this.transform.position, Quaternion.identity) as FloatingScore;
        currentRenderer = GetComponent<SpriteRenderer>();
        ring.circle = this;
        floatingText.Circle = this;
        ring.gameObject.SetActive(false);
        floatingText.gameObject.SetActive(false);

        tapSoundSource = this.GetComponent<AudioSource>();

        shadow = transform.GetChild(0).gameObject;
        shadowOriginalPosition = shadow.transform.position;

		if (GameController.IsHardMode) 
		{			
			origScale = gameObject.transform.localScale.x;
			GetComponent<SpriteRenderer> ().enabled = false;
			shadow.GetComponent<SpriteRenderer>().enabled = false;

			float llx, trx;
			float yll, ytr;

			if (name == "1" || name == "4" || name == "7") {
				llx = GameController.llCorner.x;
				trx = GameController.trCorner.x - ((GameController.boardWidth / 3f) * 2f);
			} else if (name == "2" || name == "5" || name == "8") {
				llx = GameController.llCorner.x + (GameController.boardWidth / 3f);
				trx = GameController.trCorner.x - (GameController.boardWidth / 3f);
			} else {
				llx = GameController.llCorner.x + ((GameController.boardWidth/3f)*2f);
				trx = GameController.trCorner.x;
			}

			if (name == "7" || name == "8" || name == "9") {
				yll = GameController.llCorner.y;
				ytr = GameController.trCorner.y - ((GameController.boardHeight / 3f)*2f);
			} else if (name == "4" || name == "5" || name == "6") {
				yll = GameController.llCorner.y + (GameController.boardHeight / 3f);
				ytr = GameController.trCorner.y - (GameController.boardHeight / 3f);
			} else {
				yll = GameController.llCorner.y + ((GameController.boardHeight / 3f)*2f);
				ytr = GameController.trCorner.y;
			}

			quadLLCor = new Vector2 (llx, yll);
			quadTRCor = new Vector2 (trx, ytr);
		}

        GameController.AddCircle(this);
    }
Exemple #2
0
        //=========================================================================================
        /// <summary>
        /// Adds a floating score into the level at the given position.
        /// </summary>
        /// <param name="score"> Score amount to add </param>
        /// <param name="position"> Position to add it at </param>
        //=========================================================================================
        public void AddScore( float score , Vector2 position )
        {
            // Make a new score

            FloatingScore s = new FloatingScore();

            s.TimeAlive = 0;
            s.Score     = (int) Math.Ceiling(score);
            s.Position  = position;

            // Add it into the list

            m_scores.AddLast(s);
        }
    public void Totaliza()
    {
        List<Vector3> fsPts;

        chain = 0;         // resets the score chain
        // Add fsRun to the _Scoreboard score
        if (fsRun != null) {
            // Create points for the Bezier curve
            fsPts = new List<Vector3>();
            fsPts.Add( fsPosRun );
            fsPts.Add( fsPosMid2 );
            fsPts.Add( fsPosEnd );
            fsRun.reportFinishTo = Scoreboard.S.gameObject;
            fsRun.Init(fsPts, 0, 1);
            // Also adjust the fontSize
            fsRun.fontSizes = new List<float>(new float[] {28,36,4});
            fsRun = null; // Clear fsRun so it's created again
        }
    }
    public void addPoints()
    {
        List<Vector3> fsPts;

        chain++;
        // Create a FloatingScore for this score
        FloatingScore fs;
        // Move it from the mousePosition to fsPosRun
        Vector3 p0 = Input.mousePosition;
        p0.x /= Screen.width;
        p0.y /= Screen.height;
        fsPts = new List<Vector3>();
        fsPts.Add( p0 );
        fsPts.Add( fsPosMid );
        fsPts.Add( fsPosRun );
        fs = Scoreboard.S.CreateFloatingScore(chain,fsPts);
        fs.fontSizes = new List<float>(new float[] {4,50,28});
        if (fsRun == null) {
            fsRun = fs;
            fsRun.reportFinishTo = null;
        } else {
            fs.reportFinishTo = fsRun.gameObject;
        }
    }
Exemple #5
0
 // ScoreManager handles all of the scoring
 void ScoreManager(ScoreEvent sEvt)
 {
     List<Vector3> fsPts;
     switch (sEvt) {
         // Same things need to happen whether it's a draw, a win, or a loss
     case ScoreEvent.draw: // Drawing a card
     case ScoreEvent.gameWin: // Won the round
     case ScoreEvent.gameLoss: // Lost the round
         chain = 0; // resets the score chain
         score += scoreRun; // add scoreRun to total score
         scoreRun = 0; // reset scoreRun
         // Add fsRun to the _Scoreboard score
         if (fsRun != null) {
             // Create points for the Bezier curve
             fsPts = new List<Vector3>();
             fsPts.Add( fsPosRun );
             fsPts.Add( fsPosMid2 );
             fsPts.Add( fsPosEnd );
             fsRun.reportFinishTo = Scoreboard.S.gameObject;
             fsRun.Init(fsPts, 0, 1);
             // Also adjust the fontSize
             fsRun.fontSizes = new List<float>(new float[] {28,36,4});
             fsRun = null; // Clear fsRun so it's created again
         }
         break;
     case ScoreEvent.mine: // Remove a mine card
         chain++; // increase the score chain
         scoreRun += chain; // add score for this card to run
         // Create a FloatingScore for this score
         FloatingScore fs;
         // Move it from the mousePosition to fsPosRun
         Vector3 p0 = Input.mousePosition;
         p0.x /= Screen.width;
         p0.y /= Screen.height;
         fsPts = new List<Vector3>();
         fsPts.Add( p0 );
         fsPts.Add( fsPosMid );
         fsPts.Add( fsPosRun );
         fs = Scoreboard.S.CreateFloatingScore(chain,fsPts);
         fs.fontSizes = new List<float>(new float[] {4,50,28});
         if (fsRun == null) {
             fsRun = fs;
             fsRun.reportFinishTo = null;
         } else {
             fs.reportFinishTo = fsRun.gameObject;
         }
         break;
     }
     // This second switch statement handles round wins and losses
     switch (sEvt) {
     case ScoreEvent.gameWin:
         // If it's a win, add the score to the next round
         // static fields are NOT reset by Application.LoadLevel()
         Prospector.SCORE_FROM_PREV_ROUND = score;
         print ("You won this round! Round score: "+score);
         break;
     case ScoreEvent.gameLoss:
         // If it's a loss, check against the high score
         if (Prospector.HIGH_SCORE <= score) {
             print("You got the high score! High score: "+score);
             Prospector.HIGH_SCORE = score;
             PlayerPrefs.SetInt("ProspectorHighScore", score);
         } else {
             print ("Your final score for the game was: "+score);
         }
         break;
     default:
         print ("score: "+score+" scoreRun:"+scoreRun+" chain:"+chain);
         break;
     }
 }
Exemple #6
0
    void ScoreManager(ScoreEvent sEvt)
    {
        List<Vector3> fsPts;

        switch (sEvt) {
        case ScoreEvent.draw:
        case ScoreEvent.gameWin:
        case ScoreEvent.gameLoss:
            chain = 0;
            score += scoreRun;
            scoreRun = 0;

            if (fsRun != null) {
                fsPts = new List<Vector3>();
                fsPts.Add (fsPosRun);
                fsPts.Add (fsPosMid2);
                fsPts.Add (fsPosEnd);
                fsRun.reportFinishTo = Scoreboard.S.gameObject;
                fsRun.Init (fsPts,0,1);
                fsRun.fontSizes = new List<float>(new float[] {28,36,4});
                fsRun = null;
            }
            break;

        case ScoreEvent.mine:
            chain++;
            scoreRun += chain;
            FloatingScore fs;
            Vector3 p0 = Input.mousePosition;
            p0.x /= Screen.width;
            p0.y /= Screen.height;
            fsPts = new List<Vector3>();
            fsPts.Add (p0);
            fsPts.Add (fsPosMid);
            fsPts.Add (fsPosRun);
            fs = Scoreboard.S.CreateFloatingScore (chain,fsPts);
            fs.fontSizes = new List<float>(new float[] {4,50,28});
            if(fsRun == null) {
                fsRun = fs;
                fsRun.reportFinishTo = null;
            } else {
                fs.reportFinishTo = fsRun.gameObject;
            }
            break;
        }

        switch (sEvt) {
        case ScoreEvent.gameWin:
            GTGameOver.text = "Round Over";
            Prospector.SCORE_FROM_PREV_ROUND = score;
            print ("You won this round! Round score: "+score);
            GTRoundResult.text = "You won this Round!\nRound Score: "+score;
            ShowResultGTs(true);
            break;
        case ScoreEvent.gameLoss:
            GTGameOver.text = "Game Over";
            if (Prospector.HIGH_SCORE <= score) {
                print ("You got the high score! High score: "+score);
                string sRR = "You got the high score!\nHigh score: "+score;
                GTRoundResult.text = sRR;
                Prospector.HIGH_SCORE = score;
                PlayerPrefs.SetInt("ProspectorHighScore", score);
            } else {
                print ("Your final score for the game was: "+score);
                GTRoundResult.text = "Your final score was: "+score;
            }
            ShowResultGTs(true);
            break;

        default:
            print ("score: "+score+" scoreRun:"+scoreRun+" chain:"+chain);
            break;
        }
    }
 public void FSCallback(FloatingScore fs)
 {
     // When this callback is called by SendMessage,
     // add the score from the calling FloatingScore
     score += fs.score;
 }
Exemple #8
0
    private void ScoreManager(ScoreEvent scoreEvent)
    {
        List <Vector3> fsPts;

        switch (scoreEvent)
        {
        case ScoreEvent.Draw:
        case ScoreEvent.GameWin:
        case ScoreEvent.GameLoss:
            this.Chain    = 0;
            this.Score   += this.ScoreRun;
            this.ScoreRun = 0;
            if (this.FsRun != null)
            {
                fsPts = new List <Vector3>();
                fsPts.Add(this.FsPosRun);
                fsPts.Add(this.FsPosMid2);
                fsPts.Add(this.FsPosEnd);
                this.FsRun.ReportFinishTo = Scoreboard.S.gameObject;
                this.FsRun.Init(fsPts, 0, 1);
                this.FsRun.FontSizes = new List <float>(new float[] { 28, 36, 4 });
                this.FsRun           = null;
            }
            break;

        case ScoreEvent.Mine:
            this.Chain++;
            this.ScoreRun += this.Chain;
            FloatingScore fs;
            Vector3       p0 = Input.mousePosition;
            p0.x /= Screen.width;
            p0.y /= Screen.height;
            fsPts = new List <Vector3>();
            fsPts.Add(p0);
            fsPts.Add(this.FsPosMid);
            fsPts.Add(this.FsPosRun);
            fs           = Scoreboard.S.CreateFloatingScore(this.Chain, fsPts);
            fs.FontSizes = new List <float>(new float[] { 4, 50, 28 });
            if (this.FsRun == null)
            {
                this.FsRun = fs;
                this.FsRun.ReportFinishTo = null;
            }
            else
            {
                fs.ReportFinishTo = this.FsRun.gameObject;
            }
            break;
        }

        switch (scoreEvent)
        {
        case ScoreEvent.GameWin:
            Prospector.ScoreFromPrevRound = this.Score;
            print("You won this round!Round score:" + this.Score);
            break;

        case ScoreEvent.GameLoss:
            if (Prospector.HighScore <= this.Score)
            {
                print("You got the high score! High score:" + this.Score);
                Prospector.HighScore = this.Score;
                PlayerPrefs.SetInt("ProspectorHighScore", this.Score);
            }
            else
            {
                print("Your final score for the game was:" + this.Score);
            }
            break;

        default:
            print("score:" + this.Score + " scoreRun:" + this.ScoreRun + " chain:" + this.Chain);
            break;
        }
    }
    // ScoreManager handles all of the scoring
    void ScoreManager(ScoreEvent sEvt)
    {
        List <Vector3> fsPts;

        switch (sEvt)
        {
        // Same things need to happen whether it's a draw, a win, or a loss
        case ScoreEvent.draw:     // Drawing a card
        case ScoreEvent.gameWin:  // Won the round
        case ScoreEvent.gameLoss: // Lost the round
            chain    = 0;         // resets the score chain
            score   += scoreRun;  // add scoreRun to total score
            scoreRun = 0;         // reset scoreRun
                                  // Add fsRun to the _Scoreboard score
            if (fsRun != null)
            {
                // Create points for the Bezier curve
                fsPts = new List <Vector3>();

                fsPts.Add(fsPosRun);
                fsPts.Add(fsPosMid2);
                fsPts.Add(fsPosEnd);
                fsRun.reportFinishTo = Scoreboard.S.gameObject;
                fsRun.Init(fsPts, 0, 1);
                // Also adjust the fontSize
                fsRun.fontSizes = new List <float>(new float[] { 28, 36, 4 });
                fsRun           = null; // Clear fsRun so it's created again
            }
            break;

        case ScoreEvent.mine:     // Remove a mine card
            chain++;              // increase the score chain
            scoreRun += chain;    // add score for this card to run
                                  // Create a FloatingScore for this score
            FloatingScore fs;
            // Move it from the mousePosition to fsPosRun
            Vector3 p0 = Input.mousePosition;
            p0.x /= Screen.width;
            p0.y /= Screen.height;
            fsPts = new List <Vector3>();
            fsPts.Add(p0);
            fsPts.Add(fsPosMid);
            fsPts.Add(fsPosRun);
            fs           = Scoreboard.S.CreateFloatingScore(chain, fsPts);
            fs.fontSizes = new List <float>(new float[] { 4, 50, 28 });
            if (fsRun == null)
            {
                fsRun = fs;
                fsRun.reportFinishTo = null;
            }
            else
            {
                fs.reportFinishTo = fsRun.gameObject;
            }
            break;
        }
        // This second switch statement handles round wins and losses
        switch (sEvt)
        {
        case ScoreEvent.gameWin:
            GTGameOver.text = "Round Over";
            // If it's a win, add the score to the next round
            // static fields are NOT reset by Application.LoadLevel()
            Prospector.SCORE_FROM_PREV_ROUND = score;
            print("You won this round! Round score: " + score);
            GTRoundResult.text = "You won this round!\nRound Score: " + score;
            ShowResultGTs(true);
            break;

        case ScoreEvent.gameLoss:
            GTGameOver.text = "Game Over";
            // If it's a loss, check against the high score
            if (Prospector.HIGH_SCORE <= score)
            {
                print("You got the high score! High score: " + score);
                string sRR = "You got the high score!\nHigh score: " + score;
                GTRoundResult.text    = sRR;
                Prospector.HIGH_SCORE = score;
                PlayerPrefs.SetInt("ProspectorHighScore", score);
            }
            else
            {
                GTRoundResult.text = "Your final score was: " + score;
                print("Your final score for the game was: " + score);
            }
            break;

        default:
            print("score: " + score + "  scoreRun:" + scoreRun + "  chain:" + chain);
            break;
        }
    }
 public void FSCallback(FloatingScore fs)
 {
     // When this callback is called by SendMessage,
     //  add the score from the calling FloatingScore
     score += fs.score;
 }
Exemple #11
0
    // Handle FloatingScore movement

    void FloatingScoreHandler(eScoreEvent evt)
    {
        List <Vector2> fsPts;

        switch (evt)
        {
        // Same things need to happen whether it's a draw, a win, or a loss

        case eScoreEvent.draw:         // Drawing a card

        case eScoreEvent.gameWin:      // Won the round

        case eScoreEvent.gameLoss:     // Lost the round

            // Add fsRun to the Scoreboard score

            if (fsRun != null)
            {
                // Create points for the Bézier curve1

                fsPts = new List <Vector2>();

                fsPts.Add(fsPosRun);

                fsPts.Add(fsPosMid2);

                fsPts.Add(fsPosEnd);

                fsRun.reportFinishTo = Scoreboard.S.gameObject;

                fsRun.Init(fsPts, 0, 1);

                // Also adjust the fontSize

                fsRun.fontSizes = new List <float>(new float[] { 28, 36, 4 });

                fsRun = null;     // Clear fsRun so it's created again
            }

            break;



        case eScoreEvent.mine:     // Remove a mine card

            // Create a FloatingScore for this score

            FloatingScore fs;

            // Move it from the mousePosition to fsPosRun

            Vector2 p0 = Input.mousePosition;

            p0.x /= Screen.width;

            p0.y /= Screen.height;

            fsPts = new List <Vector2>();

            fsPts.Add(p0);

            fsPts.Add(fsPosMid);

            fsPts.Add(fsPosRun);

            fs = Scoreboard.S.CreateFloatingScore(ScoreManager.CHAIN, fsPts);

            fs.fontSizes = new List <float>(new float[] { 4, 50, 28 });

            if (fsRun == null)
            {
                fsRun = fs;

                fsRun.reportFinishTo = null;
            }
            else
            {
                fs.reportFinishTo = fsRun.gameObject;
            }

            break;
        }
    }
Exemple #12
0
 public void FSCallback(FloatingScore fs)
 {
     //当这个回传函数被SendMessage调用,score属性被重新设置
     score += fs.score;
 }
Exemple #13
0
	}//end of ReloadLevel

	void ScoreManager (ScoreEvent sEvt) {
		List<Vector3> fsPts;

		switch (sEvt) {
		case ScoreEvent.draw:
		case ScoreEvent.gameWin:
		case ScoreEvent.gameLoss:
			chain = 0;
			score += scoreRun;
			scoreRun = 0;
			if (fsRun != null){
				fsPts = new List<Vector3>();
				fsPts.Add (fsPosRun);
				fsPts.Add (fsPosMid2);
				fsPts.Add (fsPosEnd);
				fsRun.reportFinishTo = Scoreboard.S.gameObject;
				fsRun.Init (fsPts, 0, 1);
				fsRun.fontSizes = new List<float>(new float[] {14,18,2});
				fsRun = null;
			}//end of if
			break;
		case ScoreEvent.mine:
			chain++;
			scoreRun += chain;
			FloatingScore fs;
			Vector3 p0 = Input.mousePosition;
			p0.x /= Screen.width;
			p0.y /= Screen.height;
			fsPts = new List<Vector3>();
			fsPts.Add (p0);
			fsPts.Add (fsPosMid);
			fsPts.Add (fsPosRun);
			fs = Scoreboard.S.CreateFloatingScore (chain,fsPts);
			fs.fontSizes = new List<float>(new float[] {4, 50, 28});
			if (fsRun == null){
				fsRun = fs;
				fsRun.reportFinishTo = null;
			}//end of if
			else fs.reportFinishTo = fsRun.gameObject;
			break;
		}//end of switch

		switch (sEvt) {
		case ScoreEvent.gameWin:
			GTGameOver.text = "Round Over";
			Prospector.SCORE_FROM_PREV_ROUND = score;
			print ("You won this round! Round score: " + score);
			GTRoundResult.text = "You won this round! \nRound score: "+score;
			ShowResultGTs (true);
			break;
		case ScoreEvent.gameLoss:
			GTGameOver.text = "Game Over";
			if (Prospector.HIGH_SCORE <= score) {
				print ("You got the high score! High score: " + score);
				string sRR = "You got the high score!\nHigh score: "+score;
				GTRoundResult.text = sRR;
				Prospector.HIGH_SCORE = score;
				PlayerPrefs.SetInt ("ProspectorHighScore", score);
			}//end of if
			else {
				print ("Your final score for the game was : " + score);
				GTRoundResult.text = "Your final score was: "+score;
			}//end of else

			ShowResultGTs (true);
			break;
		default:
			print ("score: " + score + "   scoreRun:" + scoreRun + "    chain:" + chain);
			break;
		}//end of switch
	}//end of ScoreManager
 public void FSCallback(FloatingScore fs)
 {
     //called by SendMessage
     score += fs.score;
 }
 public void FSCallback(FloatingScore fs)
 {
     // When this callback is called by SendMessage,
     //  add the score from the calling FloatingScore
     score += fs.score;
 }
Exemple #16
0
// When called by SendMessage, this adds the fs.score to this.score
    public void FSCallback(FloatingScore fs)
    {
        score += fs.score;
    }
Exemple #17
0
 public void FSCallback(FloatingScore fs)
 {
     score += fs.score;
 }
Exemple #18
0
 public void FSCallback(FloatingScore fs)
 {
     //when this callback is called by sendmessage,
     //add the score from the calling floatingscore
     score += fs.score;
 }