Ejemplo n.º 1
0
        public Player(String name, Color color, IComponentAI componentAI, int orderID, int[][] personality, bool gen)
        {
            this.orderID = orderID;
            this.gen = gen;
            points = new int[(int) PlayerPoints.Count];
            prevSource = new SourceAll(0);
            source = new SourceAll(0);
            transactionSource = new SourceAll(0);
            sumSpentSources = new SourceAll(0);

            ClearCollectSources();
            collectSourcesNormal = new SourceAll(0);

            buildingCount = new int[(int) Building.Count];
            for (int loop1 = 0; loop1 < (int)Building.Count; loop1++)
            {
                buildingCount[loop1] = 0;
            }

            licenceMarket = new LicenceKind[(int)SourceKind.Count];
            for (int loop1 = 0; loop1 < (int)SourceBuildingKind.Count; loop1++)
            {
                licenceMarket[loop1] = LicenceKind.NoLicence;
            }

            upgradeMonastery = new UpgradeKind[(int) SourceBuildingKind.Count];
            for (int loop1 = 0; loop1 < (int)SourceBuildingKind.Count; loop1++)
            {
                upgradeMonastery[loop1] = UpgradeKind.NoUpgrade;
            }

            this.color = color;
            this.name = name;
            this.componentAI = componentAI;
            this.personality = personality;

            materialChanged = false;
            active = true;

            monastery = new List<IMonastery>();
            market = new List<IMarket>();
            fort = new List<IFort>();
            town = new List<ITown>();
            road = new List<IRoad>();

            statistic = new Statistic();
        }
Ejemplo n.º 2
0
        private void DrawGraph(Statistic.Kind kind)
        {
            List<Player> players = GameMaster.Inst().GetPlayers();

            Color c;
            int[][] statistic;
            int sum;
            int k = (int)kind;

            int playerID = 0;
            float offset = 1.0f;

            foreach (Player player in players)
            {
                c = player.GetColor();
                sum = 0;
                statistic = player.GetStatistic().GetStat();
                primitiveBatch.Begin(PrimitiveType.LineStrip);
                primitiveBatch.AddVertex(new Vector2(playerID * offset + border + 0 * (windowWidth - border * 2) / (float)columnNumber,
                                                     windowHeight - border - sum * (windowHeight - border * 2) / (float)rowNumber), c);

                for (int loop1 = 0; loop1 <= columnNumber; loop1++)
                {
                    if (k == (int)Statistic.Kind.SumSources)
                        sum = statistic[k][loop1];
                    else
                        sum += statistic[k][loop1];

                    float xbase = border + loop1 * (windowWidth - border * 2) / (float)columnNumber;
                    float ybase = windowHeight - border;
                    primitiveBatch.AddVertex(new Vector2(playerID * offset + xbase,
                                                         ybase - sum * (windowHeight - border * 2) / (float)rowNumber + 1), c);
                }

                primitiveBatch.End();
                playerID++;
            }

            DrawAxisNumbers();
        }