Exemple #1
0
 public void setPlayer2Text(string value)
 {
     mainObj          = GameObject.Find("undestructable");
     gm               = mainObj.GetComponent <globalMatchManager> ();
     player2Text      = GameObject.Find("player2Panel").GetComponent <Text> ();
     player2Text.text = value + ":" + gm.player2Score;
 }
    void Start()
    {
        mainObj = GameObject.Find("undestructable");
        gm      = mainObj.GetComponent <globalMatchManager> ();
        string     jsonData = File.ReadAllText(@"Assets/jsonSettings.txt");
        jsonConfig json     = JsonUtility.FromJson <jsonConfig>(jsonData);


        keeperAnim = GameObject.Find("keeper").GetComponent <Animator> ();
        ballAnim   = GameObject.Find("bowler").GetComponent <Animator> ();
        touch      = 0;
        if (GameObject.Find("Main Camera"))
        {
            fs = GameObject.Find("Main Camera").GetComponent <FastBall> ();
        }
        else
        {
            fs = GameObject.Find("ground").GetComponent <FastBall> ();
        }
        updated = 0;
        mainmenu.gameObject.SetActive(false);
        canvasRendered = 0;
        keepercaught   = 0;
        temp           = 0;
    }
    public void updateOpponentScoreCard()
    {
        mainObj = GameObject.Find("undestructable");
        gm      = mainObj.GetComponent <globalMatchManager> ();

        oppTeamPlayers = gm.opponentTeamPlayers;

        if (GameObject.Find("details"))
        {
            GameObject triggerCanvas = GameObject.Find("Canvas");
            GameObject scoreBoardPanel;
            if (GameObject.Find("details"))
            {
                string na = "--";
                for (int i = 0; i < 11; i++)
                {
                    if (i == 0)
                    {
                        scoreBoardPanel = GameObject.Find("oNames");
                        scoreBoardPanel.GetComponent <Text> ().text = oppTeamPlayers [i].playerName.ToString();
                        scoreBoardPanel = GameObject.Find("oRuns");
                        scoreBoardPanel.GetComponent <Text> ().text = oppTeamPlayers [i].score.ToString();
                    }
                    else
                    {
                        scoreBoardPanel = GameObject.Find("oNames (" + (i - 1).ToString() + ")");
                        scoreBoardPanel.GetComponent <Text> ().text = oppTeamPlayers [i].playerName;
                        scoreBoardPanel = GameObject.Find("oRuns (" + (i - 1).ToString() + ")");
                        scoreBoardPanel.GetComponent <Text> ().text = oppTeamPlayers [i].score.ToString();
                    }
                }
            }
        }
    }
Exemple #4
0
 public void setScoreText(string value)
 {
     mainObj        = GameObject.Find("undestructable");
     gm             = mainObj.GetComponent <globalMatchManager> ();
     scoreText      = GameObject.Find("scorePanel").GetComponent <Text> ();
     scoreText.text = "Score: " + value + "/" + gm.fallOfWickets;
 }
    void Start()
    {
        mainObj = GameObject.Find("undestructable");
        gm      = mainObj.GetComponent <globalMatchManager> ();
        string     jsonData = File.ReadAllText(@"Assets/jsonSettings.txt");
        jsonConfig json     = JsonUtility.FromJson <jsonConfig>(jsonData);

        sb = new scoreBoardManager();
        string matchText = json.myTeam + " vs " + json.opponentTeam;

        sb.setMatchText(matchText);
        hit = 0;

        if (json.Overs == "2")
        {
            gm.totalBalls = 12;
        }
        else if (json.Overs == "1")
        {
            gm.totalBalls = 6;
        }
        else
        {
            gm.totalBalls = 30;
        }
        gm.init();
        sb.SetTargetText(gm.target.ToString());

        setMaterial(json.myTeam);
        k        = 0;
        userAnim = GameObject.Find("bowler").GetComponent <Animator> ();
        fw       = new feilder_working();
        fs       = new FastBall();
    }
Exemple #6
0
    public void updateTriggerCanvas()
    {
        mainObj = GameObject.Find("undestructable");
        gm      = mainObj.GetComponent <globalMatchManager> ();

        yourTeamPlayers = gm.yourTeamPlayers;
        fallOfWickets   = gm.fallOfWickets;

        if (GameObject.Find("details"))
        {
            GameObject triggerCanvas = GameObject.Find("Canvas");
            GameObject scoreBoardPanel;
            if (GameObject.Find("details"))
            {
                string na = "--";
                for (int i = 0; i < 11; i++)
                {
                    if (i == 0)
                    {
                        scoreBoardPanel = GameObject.Find("Names");
                        scoreBoardPanel.GetComponent <Text> ().text = yourTeamPlayers [i].playerName.ToString();
                        scoreBoardPanel = GameObject.Find("Runs");
                        scoreBoardPanel.GetComponent <Text> ().text = yourTeamPlayers [i].score.ToString();
                        scoreBoardPanel = GameObject.Find("Balls");
                        scoreBoardPanel.GetComponent <Text> ().text = yourTeamPlayers [i].balls.ToString();
                        scoreBoardPanel = GameObject.Find("Strike Rate");
                        scoreBoardPanel.GetComponent <Text> ().text = yourTeamPlayers [i].stRate.ToString();
                    }
                    else
                    {
                        if (i < fallOfWickets + 2)
                        {
                            scoreBoardPanel = GameObject.Find("Names (" + (i - 1).ToString() + ")");
                            scoreBoardPanel.GetComponent <Text> ().text = yourTeamPlayers [i].playerName;
                            scoreBoardPanel = GameObject.Find("Runs (" + (i - 1).ToString() + ")");
                            scoreBoardPanel.GetComponent <Text> ().text = yourTeamPlayers [i].score.ToString();
                            scoreBoardPanel = GameObject.Find("Balls (" + (i - 1).ToString() + ")");
                            scoreBoardPanel.GetComponent <Text> ().text = yourTeamPlayers [i].balls.ToString();
                            scoreBoardPanel = GameObject.Find("Strike Rate (" + (i - 1).ToString() + ")");
                            scoreBoardPanel.GetComponent <Text> ().text = yourTeamPlayers [i].stRate.ToString();
                        }
                        else
                        {
                            scoreBoardPanel = GameObject.Find("Names (" + (i - 1).ToString() + ")");
                            scoreBoardPanel.GetComponent <Text> ().text = yourTeamPlayers [i].playerName;
                            scoreBoardPanel = GameObject.Find("Runs (" + (i - 1).ToString() + ")");
                            scoreBoardPanel.GetComponent <Text> ().text = na;
                            scoreBoardPanel = GameObject.Find("Balls (" + (i - 1).ToString() + ")");
                            scoreBoardPanel.GetComponent <Text> ().text = na;
                            scoreBoardPanel = GameObject.Find("Strike Rate (" + (i - 1).ToString() + ")");
                            scoreBoardPanel.GetComponent <Text> ().text = na;
                        }
                    }
                }
                updateBarGraph();
                updateScatterGraph();
            }
        }
    }
 public void updateMatchConclusionBoard()
 {
     mainObj = GameObject.Find("undestructable");
     gm      = mainObj.GetComponent <globalMatchManager> ();
     if (gm.isGameOver)
     {
     }
 }
Exemple #8
0
    // Use this for initialization


    void Start()
    {
        //TODO: Actual code

        mainObj = GameObject.Find("undestructable");
        gm      = mainObj.GetComponent <globalMatchManager> ();

        //setTarget (json.myTeam,json.opponentTeam);
    }
Exemple #9
0
    public void newBatsmenUpdate(YourPlayer batsmen, string runs, bool isOut)
    {
        mainObj = GameObject.Find("undestructable");
        gm      = mainObj.GetComponent <globalMatchManager> ();

        currentScoreText = GameObject.Find("currentScoreUpdate").GetComponent <Text> ();

        currentScoreText.text = "New Bastsmen In!!" + "\n" + "Name:" + batsmen.playerName + " is out!!";
    }
Exemple #10
0
    public int setTarget(string yourTeam, string oppTeam)
    {
        teams = JsonUtility.FromJson <TeamList>(jsonData);
        json  = JsonUtility.FromJson <jsonConfig>(jsonData1);
        if (json.Overs == "2")
        {
            minScore = 15;
            maxScore = 25;
        }
        else if (json.Overs == "1")
        {
            minScore = 10;
            maxScore = 15;
        }
        int             totTeams = teams.Teams.Count;
        List <TeamInfo> teamsInfo = teams.Teams;
        int             yourTeamRating = 0, oppTeamRating = 0;
        int             minRate = 100000, maxRate = 0;

        for (int i = 0; i < totTeams; i++)
        {
            int teamRating = int.Parse(teamsInfo [i].team_rating);

            if (maxRate < teamRating)
            {
                maxRate = teamRating;
            }

            if (minRate > teamRating)
            {
                minRate = teamRating;
            }

            if (teamsInfo [i].team == yourTeam)
            {
                yourTeamRating = teamRating;
            }
            else if (teamsInfo [i].team == oppTeam)
            {
                oppTeamRating = teamRating;
            }
        }

        int genScore    = computeScoreByRatings(yourTeamRating, oppTeamRating, minRate, maxRate);
        int lowerBound  = genScore - 5;
        int higherBoundBound = genScore + 5;
        int finalTarget = Random.Range(lowerBound, higherBoundBound);

        //populateAutoPlayScore (finalTarget);
        sbm = new scoreBoardManager();
        sbm.SetTargetText(finalTarget.ToString());
        mainObj   = GameObject.Find("undestructable");
        gm        = mainObj.GetComponent <globalMatchManager> ();
        gm.target = finalTarget;
        return(finalTarget);
    }
Exemple #11
0
 void Start()
 {
     k         = 0;
     hit       = 0;
     unfeilded = 1;
     mainObj   = GameObject.Find("undestructable");
     gm        = mainObj.GetComponent <globalMatchManager> ();
     sound     = GameObject.Find("Pitch").GetComponent <AudioSource> ();
     cheergirl = GameObject.Find("cheerleader").GetComponent <Animator> ();
     cheergirl.SetBool("idle", true);
     cheergirl.Play("idle", 0);
 }
 public void updateMatchOverCanvas(string message, string manOfTheMatch)
 {
     mainObj           = GameObject.Find("undestructable");
     gm                = mainObj.GetComponent <globalMatchManager> ();
     matchWonText      = GameObject.Find("matchWonText").GetComponent <Text> ();
     manOfTheMatchText = GameObject.Find("manOfTheMatchText").GetComponent <Text> ();
     if (GameObject.Find("details"))
     {
         matchWonText.text      = message;
         manOfTheMatchText.text = manOfTheMatch;
     }
 }
    private void Awake()
    {
        if (_instance != null && _instance != this)
        {
            Destroy(this.gameObject);
        }
        else
        {
            _instance = this;

            DontDestroyOnLoad(this.gameObject);
        }
    }
    void Start()
    {
        mainObj = GameObject.Find("dummyxyz");
        gm      = mainObj.GetComponent <globalMatchManager> ();
        string     jsonData = File.ReadAllText(@"Assets/jsonSettings.txt");
        jsonConfig json     = JsonUtility.FromJson <jsonConfig>(jsonData);

        sb = new scoreBoardManager();
        string matchText = json.myTeam + " vs " + json.opponentTeam;

        sb.setMatchText(matchText);

        k = 0;
    }
Exemple #15
0
 public void currentScoreUpdate(string batsmenName, string runs, bool isOut)
 {
     mainObj          = GameObject.Find("undestructable");
     gm               = mainObj.GetComponent <globalMatchManager> ();
     currentScoreText = GameObject.Find("currentScoreUpdate").GetComponent <Text> ();
     if (isOut)
     {
         currentScoreText.text = "\n" + batsmenName + " is out!!";
     }
     else
     {
         currentScoreText.text = "\n" + batsmenName + " has hit " + "\n" + runs + " run(s)";
     }
 }
Exemple #16
0
    void Start()
    {
        mainObj   = GameObject.Find("undestructable");
        gm        = mainObj.GetComponent <globalMatchManager> ();
        positions = new List <Vector3> ();
        string objConst;

        for (int i = 0; i < 5; i++)
        {
            objConst = "over" + (i + 1).ToString() + "Mark";
            GameObject obj = GameObject.Find(objConst);
            positionA = obj.transform.position;
            positions.Add(positionA);
        }
    }
 public void updateBarGraph()
 {
     mainObj  = GameObject.Find("undestructable");
     gm       = mainObj.GetComponent <globalMatchManager> ();
     allOvers = gm.allOvers;
     for (int i = 0; i < 4; i++)
     {
         string objConst;
         objConst = "over" + (i + 1).ToString() + "Bar";
         GameObject obj = GameObject.Find(objConst);
         obj.GetComponent <RectTransform> ().sizeDelta = new Vector2(0, (float)allOvers[i] / (float)10);
         objConst = "over" + (i + 1).ToString() + "Score";
         obj      = GameObject.Find(objConst);
         obj.GetComponent <Text>().text = allOvers[i].ToString() + " RUNS";
     }
 }
 public void updateScatterGraph()
 {
     mainObj  = GameObject.Find("undestructable");
     gm       = mainObj.GetComponent <globalMatchManager> ();
     allOvers = gm.allOvers;
     for (int i = 0; i < 5; i++)
     {
         int    init = -170;
         string objConst;
         objConst = "over" + (i + 1).ToString() + "Mark";
         GameObject obj     = GameObject.Find(objConst);
         int        current = init + (allOvers [i] * 8);
         obj.GetComponent <RectTransform> ().anchoredPosition = new Vector2(obj.GetComponent <RectTransform> ().anchoredPosition.x, current);
         objConst = "over" + (i + 1).ToString() + "Score1";
         obj      = GameObject.Find(objConst);
         obj.GetComponent <Text>().text = allOvers[i].ToString() + " RUNS";
     }
 }
    void Start()
    {
        mainObj   = GameObject.Find("undestructable");
        matchMngr = mainObj.GetComponent <globalMatchManager> ();


        score         = 0;
        ballCount     = 0;
        bouncerCount  = 0;
        player1Score  = 0;
        player2Score  = 0;
        target        = 0;
        fallOfWickets = 0;
        prevBallNum   = 0;

        //matchMngr = mainObj.GetComponent<globalMatchManager>();
        sbm = new scoreBoardManager();
    }
    // Update is called once per frame
    void Update()
    {
        mainObj = GameObject.Find("undestructable");
        gm      = mainObj.GetComponent <globalMatchManager> ();

        GameObject   line = GameObject.Find("scatterPlotLine");
        LineRenderer lr   = line.GetComponent <LineRenderer> ();


        string objConst;

        lr.numPositions = (gm.ballCount / 6) + 1;
        for (int i = 0; i <= gm.ballCount / 6; i++)
        {
            objConst = "over" + (i).ToString() + "Mark";
            GameObject obj = GameObject.Find(objConst);
            positionA = obj.transform.position;
            lr.SetPosition(i, positionA);
        }
    }
Exemple #21
0
 public void setUpdateText()
 {
     mainObj    = GameObject.Find("undestructable");
     gm         = mainObj.GetComponent <globalMatchManager> ();
     updateText = GameObject.Find("updatePanel").GetComponent <Text> ();
     if (gm.isGameOver)
     {
         if (gm.didWon)
         {
             updateText.text = gm.yourTeam + " won the match!!";
         }
         else
         {
             updateText.text = gm.oppTeam + " won the match!!";
         }
     }
     else
     {
         updateText.text = gm.yourTeam + " need " + (gm.target - gm.score).ToString() + " runs to win from " + (gm.totalBalls - gm.ballCount).ToString() + " Balls";
     }
 }
    public void UnfeildedRuns(int n, int wicket)
    {
        if (runscalled == 0)
        {
            runscalled = 1;
            if (unfeilded == 1)
            {
                if (!gm)
                {
                    mainObj = GameObject.Find("undestructable");
                    gm      = mainObj.GetComponent <globalMatchManager> ();
                }
                if (wicket == 1)
                {
                    gm.globalOutStatus = true;
                }


                if (!gm.isGameOver)
                {
                    gm.score = gm.score + n;
                    gm.ballCount++;
                }

                if (n >= 4)
                {
                    StartCoroutine(DanceDelay());
                    StartCoroutine(Dance1Delay());
                    Instantiate(fireWorksLeft);
                    Instantiate(fireWorksRight);
                    //TODO: Audio
                    //fireWorksSource.Play();
                    StartCoroutine(DelaySound());
                }


                int k = Random.Range(0, 1);
                if ((n == 4) && (k == 0))
                {
                    clip = fourRunsClip1;
                    StartCoroutine(DelaySound());
                }
                if ((n == 4) && (k == 1))
                {
                    clip = fourRunsClip2;
                    StartCoroutine(DelaySound());
                }
                if ((n == 1) && (k == 0))
                {
                    clip = oneRunsClip1;
                    StartCoroutine(DelaySound());
                }
                if ((n == 1) && (k == 1))
                {
                    clip = oneRunsClip2;
                    StartCoroutine(DelaySound());
                }
                if ((n == 2) && (k == 0))
                {
                    clip = twoRunsClip1;
                    StartCoroutine(DelaySound());
                }
                if ((n == 2) && (k == 1))
                {
                    clip = twoRunsClip2;
                    StartCoroutine(DelaySound());
                }
                if ((n == 3) && (k == 0))
                {
                    clip = threeRunsClip1;
                    StartCoroutine(DelaySound());
                }
                if ((n == 3) && (k == 1))
                {
                    clip = threeRunsClip2;
                    StartCoroutine(DelaySound());
                }
                if (wicket == 1)
                {
                    clip = wicketClip;
                    StartCoroutine(DelaySound());
                }
            }
        }
    }
 void Start()
 {
     mainObj = GameObject.Find("undestructable");
     gm      = mainObj.GetComponent <globalMatchManager> ();
 }
Exemple #24
0
    public void UnfeildedRuns(int n, int wicket)
    {
        n = 4;
        if (unfeilded == 1)
        {
            if (!gm)
            {
                mainObj = GameObject.Find("undestructable");
                gm      = mainObj.GetComponent <globalMatchManager> ();
            }
            if (wicket == 1)
            {
                gm.globalOutStatus = true;
            }


            if (!gm.isGameOver)
            {
                gm.score = gm.score + n;
                gm.ballCount++;
            }

            if (n >= 4)
            {
                Instantiate(fireWorksLeft);
                Instantiate(fireWorksRight);
                //TODO: Audio
            }


            if ((n == 4) && (k == 0))
            {
                clip = Resources.Load <AudioClip>("UsedSounds/Four_runs");
                StartCoroutine(DelaySound());
            }
            if ((n == 4) && (k == 1))
            {
                clip = Resources.Load <AudioClip>("UsedSounds/Four_runs1");
                StartCoroutine(DelaySound());
            }
            if ((n == 1) && (k == 0))
            {
                clip = Resources.Load <AudioClip>("UsedSounds/One_run");
                StartCoroutine(DelaySound());
            }
            if ((n == 1) && (k == 1))
            {
                clip = Resources.Load <AudioClip>("UsedSounds/One_run1");
                StartCoroutine(DelaySound());
            }
            if ((n == 2) && (k == 0))
            {
                clip = Resources.Load <AudioClip>("UsedSounds/Two_runs");
                StartCoroutine(DelaySound());
            }
            if ((n == 2) && (k == 1))
            {
                clip = Resources.Load <AudioClip>("UsedSounds/Two_runs1");
                StartCoroutine(DelaySound());
            }
            if ((n == 3) && (k == 0))
            {
                clip = Resources.Load <AudioClip>("UsedSounds/Three_runs");
                StartCoroutine(DelaySound());
            }
            if ((n == 3) && (k == 1))
            {
                clip = Resources.Load <AudioClip>("UsedSounds/Three_runs1");
                StartCoroutine(DelaySound());
            }
            if (wicket == 1)
            {
                clip = Resources.Load <AudioClip>("UsedSounds/Wicket_b");
                StartCoroutine(DelaySound());
            }
        }
    }