コード例 #1
0
ファイル: Ranking.cs プロジェクト: Arsendeur/TpEpsiAtelier3
 public Ranking(PointSystem system, Club [] clubs)
 {
     this.system = system;
     this.entries=new RankingEntry[clubs.Length];
     for(int i=0; i<clubs.Length; i++)
         this.entries[i]=new RankingEntry(clubs[i], system.InitialPoints);
 }
コード例 #2
0
 public void Increment(PointSystem.ITotal with)
 {
     this.points += ((TotalMock)with).points;
 }
コード例 #3
0
ファイル: EnemyDeath.cs プロジェクト: mindedj/unity
 private void Start()
 {
     hs = this.gameObject.GetComponent <HealthSystem>();
     ps = GameObject.FindGameObjectWithTag("GameController").GetComponent <PointSystem>();
 }
コード例 #4
0
	void Start () {
		thePointSystem = GameObject.Find ("PointSystem").GetComponent<PointSystem>();
		theRainbowBar = ((GameObject)Instantiate (rainbowBarPrefab)).guiTexture;
		theRainbowBar.transform.parent = transform;
	}
コード例 #5
0
 // Use this for initialization
 void Start()
 {
     pointSystem     = GameObject.Find("Points").GetComponent <PointSystem>();         // gets the points attribute from the pointsystem component
     upgradeLocation = new Vector3(25.0f, transform.position.y, transform.position.z); //constant location when upgrade spwawns
 }
コード例 #6
0
 void Start()
 {
     rb = GetComponent <Rigidbody2D>();
     ps = GameObject.Find("Score").GetComponent <PointSystem>();
 }
コード例 #7
0
        public void Given_GamesPlayed_When_CalculateTable_Then_CorrectTable()
        {
            //Arrange
            var pointSystem = new PointSystem(3, 1, 0);

            var teamLiverpool = new TeamCompetitor
            {
                Team = new Team {
                    Name = "Liverpool"
                }
            };
            var teamChelsea = new TeamCompetitor
            {
                Team = new Team {
                    Name = "Chelsea"
                }
            };
            var teamManCity = new TeamCompetitor
            {
                Team = new Team {
                    Name = "Manchester City"
                }
            };
            var teamTottenham = new TeamCompetitor
            {
                Team = new Team {
                    Name = "Tottenham Hotspur"
                }
            };
            var teams = new List <TeamCompetitor> {
                teamLiverpool, teamChelsea, teamManCity, teamTottenham
            };

            teams = teams.OrderBy(t => t.Team.Name).ToList();

            #region Rounds
            var rounds = new List <TeamLeagueRound>
            {
                new TeamLeagueRound
                {
                    Matches = new List <TeamLeagueMatch>
                    {
                        new TeamLeagueMatch
                        {
                            MatchEntries = new List <TeamMatchEntry>
                            {
                                new TeamMatchEntry
                                {
                                    HomeAway = HomeAway.Home,
                                    Team     = teamLiverpool.Team,
                                    Score    = new IntegerScore {
                                        Value = 2
                                    }
                                },
                                new TeamMatchEntry
                                {
                                    HomeAway = HomeAway.Away,
                                    Team     = teamChelsea.Team,
                                    Score    = new IntegerScore {
                                        Value = 0
                                    }
                                }
                            }
                        },
                        new TeamLeagueMatch
                        {
                            MatchEntries = new List <TeamMatchEntry>
                            {
                                new TeamMatchEntry
                                {
                                    HomeAway = HomeAway.Home,
                                    Team     = teamManCity.Team,
                                    Score    = new IntegerScore {
                                        Value = 1
                                    }
                                },
                                new TeamMatchEntry
                                {
                                    HomeAway = HomeAway.Away,
                                    Team     = teamTottenham.Team,
                                    Score    = new IntegerScore {
                                        Value = 0
                                    }
                                }
                            }
                        }
                    }
                },
                new TeamLeagueRound
                {
                    Matches = new List <TeamLeagueMatch>
                    {
                        new TeamLeagueMatch
                        {
                            MatchEntries = new List <TeamMatchEntry>
                            {
                                new TeamMatchEntry
                                {
                                    HomeAway = HomeAway.Home,
                                    Team     = teamManCity.Team,
                                    Score    = new IntegerScore {
                                        Value = 1
                                    }
                                },
                                new TeamMatchEntry
                                {
                                    HomeAway = HomeAway.Away,
                                    Team     = teamLiverpool.Team,
                                    Score    = new IntegerScore {
                                        Value = 1
                                    }
                                }
                            }
                        },
                        new TeamLeagueMatch
                        {
                            MatchEntries = new List <TeamMatchEntry>
                            {
                                new TeamMatchEntry
                                {
                                    HomeAway = HomeAway.Home,
                                    Team     = teamTottenham.Team,
                                    Score    = new IntegerScore {
                                        Value = 2
                                    }
                                },
                                new TeamMatchEntry
                                {
                                    HomeAway = HomeAway.Away,
                                    Team     = teamChelsea.Team,
                                    Score    = new IntegerScore {
                                        Value = 2
                                    }
                                }
                            }
                        }
                    }
                }
            };
            #endregion

            //Act
            var table = new TeamLeagueTable();
            table.CalculateTable(teams, rounds, pointSystem);

            //Assert
            var position1 = table.Items[0];
            position1.Position.Should().Be(1);
            position1.Team.Should().Be(teamLiverpool.Team);
            position1.GamesWon.Should().Be(1);
            position1.GamesDrawn.Should().Be(1);
            position1.GamesLost.Should().Be(0);
            position1.GoalsFor.Should().Be(3);
            position1.GoalsAgainst.Should().Be(1);
            position1.GoalDifference.Should().Be(2);
            position1.Points.Should().Be(4);

            var position2 = table.Items[1];
            position2.Position.Should().Be(2);
            position2.Team.Should().Be(teamManCity.Team);
            position2.GamesWon.Should().Be(1);
            position2.GamesDrawn.Should().Be(1);
            position2.GamesLost.Should().Be(0);
            position2.GoalsFor.Should().Be(2);
            position2.GoalsAgainst.Should().Be(1);
            position2.GoalDifference.Should().Be(1);
            position2.Points.Should().Be(4);

            var position3 = table.Items[2];
            position3.Position.Should().Be(3);
            position3.Team.Should().Be(teamTottenham.Team);
            position3.GamesWon.Should().Be(0);
            position3.GamesDrawn.Should().Be(1);
            position3.GamesLost.Should().Be(1);
            position3.GoalsFor.Should().Be(2);
            position3.GoalsAgainst.Should().Be(3);
            position3.GoalDifference.Should().Be(-1);
            position3.Points.Should().Be(1);

            var position4 = table.Items[3];
            position4.Position.Should().Be(4);
            position4.Team.Should().Be(teamChelsea.Team);
            position4.GamesWon.Should().Be(0);
            position4.GamesDrawn.Should().Be(1);
            position4.GamesLost.Should().Be(1);
            position4.GoalsFor.Should().Be(2);
            position4.GoalsAgainst.Should().Be(4);
            position4.GoalDifference.Should().Be(-2);
            position4.Points.Should().Be(1);
        }
コード例 #8
0
 private void Start()
 {
     ps = GameObject.Find("Score").GetComponent <PointSystem>();
     em = GameObject.Find("MenuHandler").GetComponent <EscapeMenu>();
 }
コード例 #9
0
    void LookForTargetDown()
    {
        var hitNPCdown    = Physics2D.Raycast((Center.position - transform.up * 0.225f), Vector2.down, distance, visibleObjects);
        var hitPlayerdown = Physics2D.Raycast((Center.position - transform.up * 0.225f), Vector2.down, distance, layerMaskPlayer);

        if (hitPlayerdown && (hitPlayerdown.transform.tag == "Player1"))
        {
            linerenderer.SetPosition(1, new Vector3(0, -hitPlayerdown.distance, 0));

            x = Random.Range(0, 19);
            Instantiate(deathAnimPlayers, hitPlayerdown.transform.position, Quaternion.identity);
            hitPlayerdown.transform.parent.gameObject.transform.position = GameObject.Find("NPC" + x).transform.position;
            Destroy(GameObject.Find("NPC" + x));
            PointSystem.AddScoreP1(innocentKillPoint);
            PointSystem.AddScoreP2(playerKillPoint);
        }

        if (hitPlayerdown && (hitPlayerdown.transform.tag == "Player3"))
        {
            linerenderer.SetPosition(1, new Vector3(0, -hitPlayerdown.distance, 0));

            x = Random.Range(0, 19);
            Instantiate(deathAnimPlayers, hitPlayerdown.transform.position, Quaternion.identity);
            hitPlayerdown.transform.parent.gameObject.transform.position = GameObject.Find("NPC" + x).transform.position;
            Destroy(GameObject.Find("NPC" + x));
            PointSystem.AddScoreP3(innocentKillPoint);
            PointSystem.AddScoreP2(playerKillPoint);
        }

        if (hitPlayerdown && (hitPlayerdown.transform.tag == "Player4"))
        {
            linerenderer.SetPosition(1, new Vector3(0, -hitPlayerdown.distance, 0));

            x = Random.Range(0, 19);
            Instantiate(deathAnimPlayers, hitPlayerdown.transform.position, Quaternion.identity);
            hitPlayerdown.transform.parent.gameObject.transform.position = GameObject.Find("NPC" + x).transform.position;
            Destroy(GameObject.Find("NPC" + x));
            PointSystem.AddScoreP4(innocentKillPoint);
            PointSystem.AddScoreP2(playerKillPoint);
        }

        if (hitNPCdown && (hitNPCdown.transform.tag == "NPC"))
        {
            linerenderer.SetPosition(1, new Vector3(0, -hitNPCdown.distance, 0));

            Instantiate(deathAnimPlayers, hitNPCdown.transform.position, Quaternion.identity);
            Destroy(hitNPCdown.transform.gameObject);
            PointSystem.AddScoreP2(innocentKillPoint);
        }

        if (hitNPCdown && (hitNPCdown.transform.tag == "Target"))
        {
            linerenderer.SetPosition(1, new Vector3(0, -hitNPCdown.distance, 0));

            Instantiate(deathAnimTarget, hitNPCdown.transform.position, Quaternion.identity);
            hitNPCdown.transform.position = GameObject.Find("Respawn").transform.position;
            NPC_Spawner.timerActive();
            PointSystem.AddScoreP2(playerKillPoint);
        }
        if (hitNPCdown && (hitNPCdown.transform.tag == "Wall"))
        {
            Debug.Log("Hit the Wall");
            linerenderer.SetPosition(1, new Vector3(0, -distance, 0));
        }
    }
コード例 #10
0
    void LookForTargetRight()
    {
        var hitNPCright    = Physics2D.Raycast((Center.position + transform.right * 0.225f), Vector2.right, distance, visibleObjects);
        var hitPlayerright = Physics2D.Raycast((Center.position + transform.right * 0.225f), Vector2.right, distance, layerMaskPlayer);

        linerenderer.SetPosition(0, Vector3.zero);        //sets line position to where the object is.

        if (hitPlayerright && (hitPlayerright.transform.tag == "Player1"))
        {
            linerenderer.SetPosition(1, new Vector3(hitPlayerright.distance, 0, 0));

            x = Random.Range(0, 19);
            Instantiate(deathAnimPlayers, hitPlayerright.transform.position, Quaternion.identity);
            hitPlayerright.transform.parent.gameObject.transform.position = GameObject.Find("NPC" + x).transform.position;
            Destroy(GameObject.Find("NPC" + x));
            PointSystem.AddScoreP1(innocentKillPoint);
            PointSystem.AddScoreP2(playerKillPoint);
        }

        if (hitPlayerright && (hitPlayerright.transform.tag == "Player3"))
        {
            linerenderer.SetPosition(1, new Vector3(hitPlayerright.distance, 0, 0));

            x = Random.Range(0, 19);
            Instantiate(deathAnimPlayers, hitPlayerright.transform.position, Quaternion.identity);
            hitPlayerright.transform.parent.gameObject.transform.position = GameObject.Find("NPC" + x).transform.position;
            Destroy(GameObject.Find("NPC" + x));
            PointSystem.AddScoreP3(innocentKillPoint);
            PointSystem.AddScoreP2(playerKillPoint);
        }

        if (hitPlayerright && (hitPlayerright.transform.tag == "Player4"))
        {
            linerenderer.SetPosition(1, new Vector3(hitPlayerright.distance, 0, 0));

            x = Random.Range(0, 19);
            Instantiate(deathAnimPlayers, hitPlayerright.transform.position, Quaternion.identity);
            hitPlayerright.transform.parent.gameObject.transform.position = GameObject.Find("NPC" + x).transform.position;
            Destroy(GameObject.Find("NPC" + x));
            PointSystem.AddScoreP4(innocentKillPoint);
            PointSystem.AddScoreP2(playerKillPoint);
        }

        if (hitNPCright && (hitNPCright.transform.tag == "NPC"))
        {
            linerenderer.SetPosition(1, new Vector3(hitNPCright.distance, 0, 0));

            Instantiate(deathAnimPlayers, hitNPCright.transform.position, Quaternion.identity);
            Destroy(hitNPCright.transform.gameObject);
            PointSystem.AddScoreP2(innocentKillPoint);
        }

        if (hitNPCright && (hitNPCright.transform.tag == "Target"))
        {
            linerenderer.SetPosition(1, new Vector3(hitNPCright.distance, 0, 0));

            Instantiate(deathAnimTarget, hitNPCright.transform.position, Quaternion.identity);
            hitNPCright.transform.position = GameObject.Find("Respawn").transform.position;
            NPC_Spawner.timerActive();
            PointSystem.AddScoreP2(playerKillPoint);
        }

        if (hitNPCright && (hitNPCright.transform.tag == "Wall"))
        {
            Debug.Log("Hit the Wall");
            linerenderer.SetPosition(1, new Vector3(distance, 0, 0));
        }
    }
コード例 #11
0
 // Start is called before the first frame update
 void Start()
 {
     pointSystem = GameObject.Find("Game_manager").GetComponent <PointSystem>();
 }
コード例 #12
0
ファイル: PointSystem.cs プロジェクト: alexander12356/Runner
 private void Awake()
 {
     Instance = this;
 }
コード例 #13
0
ファイル: EnemyA.cs プロジェクト: amendez8/Galactic-Warfare
    private PointSystem pointSystem;  // save points into this variable

    void Start()
    {
        pointSystem = GameObject.Find("Points").GetComponent <PointSystem>();
    }
コード例 #14
0
 void Start()
 {
     PS = GameObject.FindGameObjectWithTag("GameManager").GetComponent <PointSystem>();
 }
コード例 #15
0
 void Awake()
 {
     Instance = this;
 }
コード例 #16
0
ファイル: Ranking.cs プロジェクト: Arsendeur/TpEpsiAtelier3
 public RankingEntry(Club club, PointSystem.ITotal points)
 {
     this.club = club;
     this.points = points;
 }
コード例 #17
0
        public void FillPieContent(Dictionary <int, double> DashboardDic, double Total, IEnumerable <MapLogData> maplogs)
        {
            string data  = "";
            string label = "";

            foreach (KeyValuePair <int, Double> entry in DashboardDic)
            {
                data  += PointSystem.PointCalculate(entry.Value) + ",";
                label += GetLabelCategory(entry.Key) + ",";
            }
            data  = data.Remove(data.Length - 1);
            label = label.Remove(label.Length - 1);

            string Wdata  = "";
            string Wlabel = "";

            foreach (MapLogData maplog in maplogs)
            {
                Wdata  += PointSystem.PointCalculate(maplog.Calories) + ",";
                Wlabel += "\"" + maplog.MealDate.DayOfWeek + "\"" + ",";
            }
            if (Wdata.Length > 0)
            {
                Wdata  = Wdata.Remove(Wdata.Length - 1);
                Wlabel = Wlabel.Remove(Wlabel.Length - 1);
            }
            string web1 = "<!doctype html>" +
                          "<html>" +
                          "<head> " +
                          "<script src=\"file:///android_asset/Chart.bundle.js\"></script>" +
                          "<script src=\"file:///android_asset/utils.js\"></script>" +

                          "</head>" +
                          "<body>" +
                          "<div style=\"margin:0 auto;width: 70%\" id=\"canvas - holder\">" +
                          "<canvas id=\"chart - area\" />" +
                          "</div>" +
                          "<div style=\"width: 100%; \">" +
                          "<canvas id=\"canvas\"></canvas> " +
                          "</div>" +
                          "<script>" +
                          "var data = [" + data + "];" +
                          "var config = {" +
                          " type: 'pie',  data: { datasets: [{ " +
                          " data: data,  backgroundColor: [window.chartColors.blue, window.chartColors.yellow, window.chartColors.orange, window.chartColors.green], " +
                          " label: " +
                          " 'Calories'  }]," +
                          " labels: [" + label + "] },  options: {legend: {position: 'bottom'} ,title: {display: true, text: 'Points per meal' } }}; " +
                          "var color = Chart.helpers.color; " +
                          "var barChartData = { " +
                          "labels: [" + Wlabel + "], " +
                          "datasets: [{ type: \"bar\", label: \"Week Points\", backgroundColor: color(window.chartColors.blue).alpha(0.4).rgbString(), ";



            string web2 = "borderColor: window.chartColors.blue, data: [ " + Wdata + "]}] }; " +
                          "window.onload = function() {" +
                          "var ctx1 = document.getElementById(\"chart - area\").getContext(\"2d\"); " +
                          "window.myPie = new Chart(ctx1, config); " +
                          "var ctx = document.getElementById(\"canvas\").getContext(\"2d\"); " +
                          "window.myBar = new Chart(ctx, { type: \"bar\", data: barChartData,  options: {legend: {position: 'bottom'} ,title: {display: true, text: 'Points per day' } }}); }; " +
                          "</script>" +
                          "</body>" +
                          "</html>";

            webview.Html = web1 + web2;
        }