Beispiel #1
0
    public void Start()
    {
        m_StartTime = Time.time;

        GameObject[] objs = GameObject.FindGameObjectsWithTag("Player");
        Debug.Log("A: " + objs.Length);

        for (var i = 0; i < objs.Length; i++)
        {
            if (objs[i].GetComponent <PlayerPoints>().typePlayer == 1)
            {
                pp1 = objs[i].GetComponent <PlayerPoints>();
            }
            if (objs[i].GetComponent <PlayerPoints>().typePlayer == 2)
            {
                pp2 = objs[i].GetComponent <PlayerPoints>();
            }
        }


        score_p1 = pp1.score;
        score_p2 = pp2.score;

        life_p1 = pp1.life;
        life_p2 = pp2.life;

        ammo_p1 = pp1.ammo;
        ammo_p2 = pp2.ammo;
    }
Beispiel #2
0
 // Start is called before the first frame update
 void Start()
 {
     playerPoints = PlayerPoints.Get();
     playerHp     = UIPlayerHealth.Get();
     rig          = player.GetComponent <Rigidbody>();
     force        = -7000;
 }
Beispiel #3
0
    // Update is called once per frame
    public override void Update()
    {
        if (Input.GetMouseButtonDown(0))
        {
            BallStart();
        }

        if (transform.position.x > 8)
        {
            PlayerPoints++;
            PlayerSide.text = "Player  " + PlayerPoints.ToString();
            BallFinish();
        }
        else if (transform.position.x < -8)
        {
            EnemyPoints++;
            EnemySide.text = EnemyPoints.ToString() + "  Computer";
            BallFinish();
        }

        if (PlayerPoints == 3)
        {
            SceneManager.LoadScene("Winner");
        }
        else if (EnemyPoints == 3)
        {
            SceneManager.LoadScene("Looser");
        }
    }
Beispiel #4
0
    public void Start()
    {
        pp = GetComponent <PlayerPoints>();

        _shotParticles[0].GetComponent <ParticleSystem>().Emit(0);
        _shotParticles[1].GetComponent <ParticleSystem>().Emit(0);
    }
Beispiel #5
0
    /// <summary>
    /// Start is called before the first frame update
    /// </summary>
    void Start()
    {
        if (!animator)
        {
            animator = GetComponent <Animator>();
        }
        if (!input)
        {
            input = GetComponent <PlayerInput>();
        }
        if (!playerMove)
        {
            playerMove = GetComponent <PlayerMoveScript>();
        }
        if (!points)
        {
            points = GetComponent <PlayerPoints>();
        }

        rigidbody = GetComponent <Rigidbody>();

        if (AttackPanel != null)
        {
            AttackPanel.transform.parent.gameObject.SetActive(gameObject.activeInHierarchy);
        }
    }
Beispiel #6
0
        public async Task <bool> TryInvokeAsync(IMessage message)
        {
            if (message == null)
            {
                return(false);
            }
            (bool success, string character) = ParseArgs(message.Content);

            if (!success)
            {
                return(false);
            }

            PlayerPoints dkp = await dkpProcessor.GetDkp(character);

            string dkpMessage = $"{character.UppercaseFirst()} has **{dkp.PointsCurrentWithTwink}** available to spend.\n```\nLifetime DKP for {character}: Earned {dkp.PointsEarnedWithTwink} - Spent {dkp.PointsSpentWithTwink} - Adjustments {dkp.PointsAdjustmentWithTwink}.```";

            string memePath = config.MemeDkpPath + character + ".jpg";

            ;

            if (config.EnableMemeDkp && File.Exists(memePath))
            {
                log.LogInformation($"{character} dkp memes!");
                await message.Channel.SendFileAsync(memePath, dkpMessage);
            }
            else
            {
                await message.Channel.SendMessageAsync(dkpMessage);
            }
            return(true);
        }
Beispiel #7
0
        private IEnumerable <PlayerPoints> GetPlayersPoints(DbChessGame game)
        {
            if (game.BlackPlayer.Id == game.WhitePlayer.Id)
            {
                return(Enumerable.Empty <PlayerPoints>());
            }

            var whitePlayer = new PlayerPoints()
            {
                Username         = game.WhitePlayer.UserName,
                IsBot            = game.WhitePlayer.Bot,
                AveragePlyPoints = GetPoints(ChessPlayer.White, game.Status) / GetNumberOfMoves(ChessPlayer.White, game.History)
            };

            var blackPlayer = new PlayerPoints()
            {
                Username         = game.BlackPlayer.UserName,
                IsBot            = game.BlackPlayer.Bot,
                AveragePlyPoints = GetPoints(ChessPlayer.Black, game.Status) / GetNumberOfMoves(ChessPlayer.Black, game.History)
            };

            return(new[]
            {
                whitePlayer,
                blackPlayer
            });
        }
Beispiel #8
0
 // Start is called before the first frame update
 void Start()
 {
     playerPoints = PlayerPoints.Get();
     if (!isMatchOver)
     {
         playerPoints.points = 0;
     }
 }
 public GameWindow()
 {
     InitializeComponent();
     display = new QuestionDisplayer();
     points  = new PlayerPoints(0);
     DisplayQuestion();
     next = true;
 }
Beispiel #10
0
    void Start()
    {
        currentState = 0;

        audioSource = this.gameObject.GetComponent <AudioSource> ();

        globalElement = GameObject.Find("GlobalElement");
        playerPoints  = globalElement.GetComponent <PlayerPoints> ();
    }
    void OnDestroy()
    {
        PlayerPoints playerPoints = FindObjectOfType <PlayerPoints>();

        if (playerPoints != null)
        {
            playerPoints.UpdatePoints(points);
        }
    }
        public virtual Player GetWinner()
        {
            var winningPoint = (IsComplete)
               ? PlayerPoints.OrderByDescending(point => point.Amount).First()
               : null;

            return((winningPoint != null)
                ? Players.FirstOrDefault(player => player.PlayerID == winningPoint.PlayerID)
                : null);
        }
Beispiel #13
0
 // Start is called before the first frame update
 void Start()
 {
     ball.GetComponent <MeshRenderer>().enabled   = false;
     ball.GetComponent <SphereCollider>().enabled = false;
     playerHP              = UIPlayerHealth.Get();
     playerPoints          = PlayerPoints.Get();
     crosshairImage        = crosshair.GetComponent <RawImage>();
     defaultCrosshairColor = crosshair.GetComponent <RawImage>().color;
     ammo = 10;
 }
Beispiel #14
0
    // Start is called before the first frame update
    void Start()
    {
        playerPoints          = PlayerPoints.Get();
        defaultColor          = transform.gameObject.GetComponent <MeshRenderer>().material.color;
        GhostHunterProjectile = ball.gameObject.GetComponent <GhostHunter_ball>();
        ghostModel            = transform.gameObject.GetComponent <MeshRenderer>();
        rig          = player.GetComponent <Rigidbody>();
        playerStatus = playerHp.GetComponent <UIPlayerHealth>();

        movementTimer = 5;
    }
 private void AssignVariables()
 {
     savedata        = new SaveData();
     sceneController = GetComponent <SceneController>();
     lObjGame        = objGameController.GetComponent <LoadObject>();
     gCondition      = objGameController.GetComponent <GameCondition>();
     lvl             = lObjGame.GetLevel;
     objPlayer       = lObjGame.GetPlayer;
     playerPoints    = objPlayer.GetComponent <PlayerPoints>();
     playerHealth    = objPlayer.GetComponent <PlayerHealth>();
 }
Beispiel #16
0
    private void Awake()
    {
        if (instance != null)
        {
            Destroy(gameObject);
            return;
        }

        instance = this;
        DontDestroyOnLoad(gameObject);
    }
Beispiel #17
0
    void Awake()
    {
        _aSource  = GetComponent <AudioSource>();
        _animator = GetComponent <Animator>();
        hitboxes  = GetComponentsInChildren <BoxCollider>();
        points    = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerPoints>(); // find points component in player

        if (isTrainingMode)
        {
            TargetInactive();
        }
    }
Beispiel #18
0
    private void PlayerStayed(Collider other)
    {
        PlayerPoints pPoints = other.gameObject.GetComponent <PlayerPoints>();

        pPoints.playerPlaying = false;
        pPoints.IncrementScore(pointsForWinning[pPoints.turnManager.NumberOfPlayersWon()]);
        other.gameObject.SetActive(false);
        turnManager.PlayerWon(turnManager.IndexOfPlayer(other.gameObject));
        //Add the points
        //Remove the player object, activate a flag for that player having finished
        //Destroy (this.gameObject);
    }
Beispiel #19
0
        public async Task <TableResult> UpdatePlayer(PlayerPoints playerPoints)
        {
            var mergeAction = TableOperation.Merge(playerPoints);
            var mergeResult = await _pointsTable.ExecuteAsync(mergeAction);

            if (mergeResult.HttpStatusCode >= 500)
            {
                throw new WebException($"Error updating player (Player: {playerPoints.PlayerName}, Source: {playerPoints.PartitionKey})  : {mergeResult.Result} ",
                                       WebExceptionStatus.UnknownError);
            }

            return(mergeResult);
        }
Beispiel #20
0
        private void Update()
        {
            if (isExploting)
            {
                return;
            }

            playerPoints = CanvasHelper.GetPlayerPoints(GetScreenPosition(), 5);

            if (Input.GetButton("Fire1"))
            {
                presenter.OnFirePressed();
            }
        }
    void Start()
    {
        gController = GetComponent <GameController>();
        loadObj     = GetComponent <LoadObject> ();
        GameObject player = loadObj.GetPlayer;

        if (player != null)
        {
            playerHealth = player.GetComponent <PlayerHealth> ();
            playerPoins  = player.GetComponent <PlayerPoints> ();
        }
        Time.timeScale = 1.0f;
        lvl            = loadObj.GetLevel;
    }
Beispiel #22
0
    void Start()
    {
        GameEvents.current.OnBulletChange += RefreshButton;
        playerPoints = GetComponent <PlayerPoints>();

        // lets get the 3 action buttons in an array and add listener so we can set callback
        actionButtons = GetComponentsInChildren <Button>();
        actionButtons[0].onClick.AddListener(delegate { SendActionOnClick(0, SelectedAction.Reload, id); }); //button Reload
        actionButtons[1].onClick.AddListener(delegate { SendActionOnClick(1, SelectedAction.Block, id); });  //button Block
        actionButtons[2].onClick.AddListener(delegate { SendActionOnClick(2, SelectedAction.Shoot, id); });  //button Shoot

        actionButtons[2].interactable = false;                                                               // default : no  bullets so button deactivated

        actionCombo = GetComponent <ActionCombo>();
    }
Beispiel #23
0
    private void Awake()
    {
        m_Body = GetComponent <Rigidbody>();

        //gameController = GameObject.Find("Game Manager").GetComponent<GameController>();

        GameObject[] objs = GameObject.FindGameObjectsWithTag("Player");

        for (var i = 0; i < objs.Length; i++)
        {
            if (objs[i].GetComponent <PlayerPoints>().typePlayer == type)
            {
                pp = objs[i].GetComponent <PlayerPoints>();
            }
        }
    }
Beispiel #24
0
    void Update()
    {
        List <Collider> tempObjectCrossingList = new List <Collider>(objectCrossingList);

        for (int count = 0; count < tempObjectCrossingList.Count; count++)
        {
            PlayerPoints playerPoints = tempObjectCrossingList [count].gameObject.GetComponent <PlayerPoints> ();
            if (playerPoints != null)
            {
                playerPoints.IncrementPoints();
            }
        }

        for (int count = 0; count < tempObjectCrossingList.Count; count++)
        {
            objectCrossingList.Remove(tempObjectCrossingList [count]);
        }
    }
Beispiel #25
0
        public void Draw(SpriteBatch Target)
        {
            Br.Draw(Target);
            Vs.Draw(Target);
            Cardchoose.Draw(Target);
            ChooseText.Draw(Target);
            ChooseConfirm.Draw(Target);
            ChooseOrderText.Draw(Target);

            UI_Bottom.Draw(Target);
            UI_BottomLeft.Draw(Target);
            UI_Up.Draw(Target);
            UI_UpRight.Draw(Target);
            UI_UpLeft.Draw(Target);

            EnemyTurnSprite.Draw(Target);
            EnemyTurnText.Draw(Target);
            NewTurnText.Draw(Target);

            PlayerIcon.Draw(Target);
            OpponentIcon.Draw(Target);
            PlayerName.Draw(Target);
            OpponentName.Draw(Target);
            PlayerPoints.Draw(Target);
            OpponentPoints.Draw(Target);
            PlayerMoney.Draw(Target);
            RoundTime.Draw(Target);

            foreach (var cp in CPInfos)
            {
                cp.Draw(Target);
            }

            TileName.Draw(Target);
            Btn_Move.Draw(Target);
            Btn_Attack.Draw(Target);
            Btn_EndTurn.Draw(Target);
            Btn_Stats.Draw(Target);
            Btn_GameMenu.Draw(Target);
            Btn_Chat.Draw(Target);
            Inf.Draw(Target);

            EndGame.Draw(Target);
        }
        public override Player GetWinner()
        {
            Player winningPlayer;

            if (!IsComplete)
            {
                winningPlayer = null;
            }
            else
            {
                var winningPoint = PlayerPoints.Cast <GamePoint>().ToList()
                                   .OrderByDescending(playerPoint => playerPoint.Amount)
                                   .FirstOrDefault(point => point.HasAdvantage || point.Amount == MininumPointsToWinGame);

                winningPlayer = Players.FirstOrDefault(player => player.PlayerID == winningPoint.PlayerID);
            }

            return(winningPlayer);
        }
Beispiel #27
0
    private void OnTriggerEnter(Collider other)
    {
        PlayerPoints pp = other.GetComponent <PlayerPoints>();

        if (pp != null)
        {
            if (effect == Item.coin)
            {
                pp.score += amount;
            }
            if (effect == Item.box_ammo)
            {
                pp.ammo += amount;
            }

            if (effect == Item.box_missile)
            {
                PlayerShot ps = other.GetComponent <PlayerShot>();

                Transform arrow1 = Instantiate(ps.missil, ps.canhao.position, Quaternion.identity);
                arrow1.GetComponent <MissileGuidance>().m_Target = ps.target;

                arrow1.GetComponent <Rigidbody>().velocity        = other.GetComponent <Rigidbody>().velocity * 10;
                arrow1.GetComponent <Rigidbody>().angularVelocity = other.GetComponent <Rigidbody>().angularVelocity;
            }
            if (effect == Item.health_up)
            {
                pp.life += amount;
            }

            if (effect == Item.speed_up)
            {
                speed++;
                if (speed < 5)
                {
                    other.GetComponent <CarKinematics>().m_MaxMotorTorque += 100;
                }
            }
            Destroy(gameObject);
        }
    }
Beispiel #28
0
        public async Task <AuctionBid> AddOrUpdateBid(string item, string character, string rank, int bid, IMessage message)
        {
            // First make sure we can make a valid bid out of it.
            if (!ranks.TryGetValue(rank, out RankConfiguration rankConfig))
            {
                throw new ArgumentException($"Rank {rank} does not exist.");
            }

            if (!state.Auctions.TryGetValue(item, out Auction auction))
            {
                throw new AuctionNotFoundException(item);
            }

            int characterId = await dkpProcessor.GetCharacterId(character);

            PlayerPoints points = await dkpProcessor.GetDkp(characterId);

            int pointsAlreadyBid = state.Auctions.Values.SelectMany(x => x.Bids)
                                   .Where(b => b.CharacterId == characterId && // From This character
                                          b.Auction != auction)                  // Don't count this current auction, because we're replacing it.
                                   .Sum(x => x.BidAmount) * rankConfig.PriceMultiplier;
            decimal availableDkp = (points.PointsCurrentWithTwink - pointsAlreadyBid) / rankConfig.PriceMultiplier;

            if (availableDkp < bid)
            {
                throw new InsufficientDkpException($"{character} only has {availableDkp} left to bid with. Cancel some bids, or bid less!");
            }

            AuctionBid newBid = auction.Bids.AddOrUpdate(new AuctionBid(auction, character, characterId, bid, rankConfig, message.Author));

            log.LogInformation($"Created bid: {newBid}");

            await message.Channel.SendMessageAsync($"Bid accepted for **{newBid.Auction}**\n"
                                                   + $"```\"{auction.Name}\" {newBid}```"
                                                   + $"If you win, you could pay up to **{newBid.BidAmount * newBid.Rank.PriceMultiplier}**.\n"
                                                   + $"If you wish to modify your bid before the auction completes, simply enter a new bid in the next **{auction.MinutesRemaining:##.#}** minutes.\n"
                                                   + "If you wish to cancel your bid use the following syntax:\n"
                                                   + $"```\"{newBid.Auction.Name}\" cancel```");

            return(newBid);
        }
 protected override void Increase(int winningPlayerID)
 {
     if (IsDeuce())
     {
         (PlayerPoints[winningPlayerID] as GamePoint).HasAdvantage = true;
     }
     else if (IsDeuceSavePoint(winningPlayerID))
     {
         (PlayerPoints.Cast <GamePoint>().ToList())
         .FirstOrDefault(pp => pp.HasAdvantage)
         .HasAdvantage = false;
     }
     else if (IsWinPoint(winningPlayerID))
     {
         (PlayerPoints[winningPlayerID] as GamePoint).IsFinished = true;
     }
     else
     {
         UpdateWinningPlayerScore(winningPlayerID);
     }
 }
        public void PlayerPointsDeserialize()
        {
            //Arrange

            XmlSerializer serializer = new XmlSerializer(typeof(PointsResponse));

            //Act
            PointsResponse r      = serializer.Deserialize(new StringReader(TestResources.MaggDkp)) as PointsResponse;
            PlayerPoints   points = r?.Players.FirstOrDefault()?.Points?.FirstOrDefault();

            //Assert
            Assert.IsNotNull(points);
            Assert.AreEqual(959, points.PointsCurrent);
            Assert.AreEqual(547, points.PointsCurrentWithTwink);
            Assert.AreEqual(4602, points.PointsEarned);
            Assert.AreEqual(8554, points.PointsEarnedWithTwink);
            Assert.AreEqual(3793, points.PointsSpent);
            Assert.AreEqual(7957, points.PointsSpentWithTwink);
            Assert.AreEqual(150, points.PointsAdjustment);
            Assert.AreEqual(-50, points.PointsAdjustmentWithTwink);
        }
Beispiel #31
0
	public void Save (PlayerPoints points)
	{
		Load();
		playerPoints.Add(points);
		playerPoints.Sort();
		playerPoints.Reverse();
		BinaryFormatter bf = new BinaryFormatter();
		try
		{
			FileStream file = File.Create(fileWay);

			Data2Save data = new Data2Save(playerPoints);
			bf.Serialize(file, data);

			file.Close();
		}
		catch (IOException exception)
		{
			Debug.LogError("Error saving: " + exception.Message);
		}

	}
 public void SetData(PlayerPoints data)
 {
     this.data = data;
 }
Beispiel #33
0
        private static void Main()
        {
            string userInput = string.Empty;
            char[,] gameField = CreateGameField();
            char[,] bombsPositions = PlaceBombs();
            int counter = 0;
            bool haveExplode = false;
            List<PlayerPoints> highscoresChart = new List<PlayerPoints>(6);
            int row = 0;
            int collumn = 0;
            bool gameStart = true;
            const int MaksTurns = 35;
            bool gameEnd = false;

            do
            {
                if (gameStart)
                {
                    Console.WriteLine(
                        "Lets Play “Minesweeper”. Try ti find fields withouth mines."
                        + " Input 'top' shows chart list, 'restart' starts new game, 'exit' exits the game !");
                    PrintGameField(gameField);
                    gameStart = false;
                }

                Console.Write("Enter Row and Column values : ");
                userInput = Console.ReadLine().Trim();
                if (userInput.Length >= 3)
                {
                    bool validRow = int.TryParse(userInput[0].ToString(), out row);
                    bool validColumn = int.TryParse(userInput[2].ToString(), out collumn);
                    bool validRowIndex = row <= gameField.GetLength(0);
                    bool validColumnIndex = collumn <= gameField.GetLength(1);
                    bool validInput = validRow && validColumn && validRowIndex && validColumnIndex;

                    if (validInput)
                    {
                        userInput = "turn";
                    }
                }

                switch (userInput)
                {
                    case "top":
                        CreateHighscoresChart(highscoresChart);
                        break;
                    case "restart":
                        gameField = CreateGameField();
                        bombsPositions = PlaceBombs();
                        PrintGameField(gameField);
                        haveExplode = false;
                        gameStart = false;
                        break;
                    case "exit":
                        Console.WriteLine("Game Over!");
                        break;
                    case "turn":
                        if (bombsPositions[row, collumn] != '*')
                        {
                            if (bombsPositions[row, collumn] == '-')
                            {
                                ChangeTurnOfPlayer(gameField, bombsPositions, row, collumn);
                                counter++;
                            }

                            if (MaksTurns == counter)
                            {
                                gameEnd = true;
                            }
                            else
                            {
                                PrintGameField(gameField);
                            }
                        }
                        else
                        {
                            haveExplode = true;
                        }

                        break;
                    default:
                        Console.WriteLine("\n Invalid Input !\n");
                        break;
                }

                if (haveExplode)
                {
                    PrintGameField(bombsPositions);
                    Console.Write("\n You Loose! You finished the game with {0} points. Enter your nickname : ", counter);
                    string playerName = Console.ReadLine();
                    PlayerPoints t = new PlayerPoints(playerName, counter);
                    if (highscoresChart.Count < 5)
                    {
                        highscoresChart.Add(t);
                    }
                    else
                    {
                        for (int i = 0; i < highscoresChart.Count; i++)
                        {
                            if (highscoresChart[i].PLayerPoints < t.PLayerPoints)
                            {
                                highscoresChart.Insert(i, t);
                                highscoresChart.RemoveAt(highscoresChart.Count - 1);
                                break;
                            }
                        }
                    }

                    highscoresChart.Sort((PlayerPoints nameA, PlayerPoints nameB) => nameB.PlayerName.CompareTo(nameA.PlayerName));
                    highscoresChart.Sort((PlayerPoints pointA, PlayerPoints pointB) => pointB.PLayerPoints.CompareTo(pointA.PLayerPoints));
                    CreateHighscoresChart(highscoresChart);

                    gameField = CreateGameField();
                    bombsPositions = PlaceBombs();
                    counter = 0;
                    haveExplode = false;
                    gameStart = true;
                }

                if (gameEnd)
                {
                    Console.WriteLine("\n Congratulations ! You opened 35 boxes without touching a mine.");
                    PrintGameField(bombsPositions);
                    Console.WriteLine("Enter your nickname : ");
                    string playerName = Console.ReadLine();
                    PlayerPoints points = new PlayerPoints(playerName, counter);
                    highscoresChart.Add(points);
                    CreateHighscoresChart(highscoresChart);
                    gameField = CreateGameField();
                    bombsPositions = PlaceBombs();
                    counter = 0;
                    gameEnd = false;
                    gameStart = true;
                }
            }

            while (userInput != "exit");
            Console.WriteLine("Thank you for playing Minesweeper Game !");
            Console.WriteLine("Good Bye.");
            Console.Read();
        }
Beispiel #34
0
 public int GetActionPoints(PlayerPoints action)
 {
     switch (action)
     {
         case PlayerPoints.Fort: return Settings.pointsFort;
         case PlayerPoints.FortCaptureHexa: return Settings.pointsFortCapture;
         case PlayerPoints.FortParade: return Settings.pointsFortParade;
         case PlayerPoints.FortStealSources: return Settings.pointsFortSteal;
         case PlayerPoints.LicenceLvl1: return Settings.pointsMarketLvl1;
         case PlayerPoints.LicenceLvl2: return Settings.pointsMarketLvl2;
         case PlayerPoints.Market: return Settings.pointsMarket;
         case PlayerPoints.RoadID: return Settings.goalRoadID;
         case PlayerPoints.TownID: return Settings.goalTownID;
         case PlayerPoints.Mill: return Settings.pointsMill;
         case PlayerPoints.Mine: return Settings.pointsMine;
         case PlayerPoints.Monastery: return Settings.pointsMonastery;
         case PlayerPoints.Quarry: return Settings.pointsQuarry;
         case PlayerPoints.Road: return Settings.pointsRoad;
         case PlayerPoints.Saw: return Settings.pointsSaw;
         case PlayerPoints.Stepherd: return Settings.pointsStepherd;
         case PlayerPoints.Town: return Settings.pointsTown;
         case PlayerPoints.UpgradeLvl1: return Settings.pointsUpgradeLvl1;
         case PlayerPoints.UpgradeLvl2: return Settings.pointsUpgradeLvl2;
     }
     return 0;
 }
Beispiel #35
0
 public GuiPlayerPoints(PlayerPoints data)
 {
     this.data = data;
     useText(GuiPlayerPointsTextType.None);
 }
Beispiel #36
0
 public void RemovePoints(PlayerPoints which)
 {
     if (points[(int)which] > 0)
     {
         points[(int)which]--;
         statistic.AddStat(Statistic.Kind.Points, -1, GameMaster.Inst().GetTurnNumber());
     }
 }
Beispiel #37
0
 public int GetPoints(PlayerPoints kind)
 {
     return points[(int)kind];
 }
Beispiel #38
0
        public void AddPoints(PlayerPoints which)
        {
            bool areTherePoints = false;
            switch (which)
            {
                case PlayerPoints.Fort: areTherePoints = Settings.pointsFort > 0 && Settings.pointsFort > points[(int) which]; break;
                case PlayerPoints.FortCaptureHexa: areTherePoints = Settings.pointsFortCapture > 0 && Settings.pointsFortCapture > points[(int)which]; break;
                case PlayerPoints.FortParade: areTherePoints = Settings.pointsFortParade > 0 && Settings.pointsFortParade > points[(int)which]; break;
                case PlayerPoints.FortStealSources: areTherePoints = Settings.pointsFortSteal > 0 && Settings.pointsFortSteal > points[(int)which]; break;
                case PlayerPoints.LicenceLvl1: areTherePoints = Settings.pointsMarketLvl1 > 0 && Settings.pointsMarketLvl1 > points[(int)which]; break;
                case PlayerPoints.LicenceLvl2: areTherePoints = Settings.pointsMarketLvl2 > 0 && Settings.pointsMarketLvl2 > points[(int)which]; break;
                case PlayerPoints.Market: areTherePoints = Settings.pointsMarket > 0 && Settings.pointsMarket > points[(int)which]; break;
                case PlayerPoints.RoadID: areTherePoints = Settings.goalRoadID > 0 && Settings.goalRoadID > points[(int)which]; break;
                case PlayerPoints.TownID: areTherePoints = Settings.goalTownID > 0 && Settings.goalTownID > points[(int)which]; break;
                case PlayerPoints.Mill: areTherePoints = Settings.pointsMill > 0 && Settings.pointsMill > points[(int)which]; break;
                case PlayerPoints.Mine: areTherePoints = Settings.pointsMine > 0 && Settings.pointsMine > points[(int)which]; break;
                case PlayerPoints.Monastery: areTherePoints = Settings.pointsMonastery > 0 && Settings.pointsMonastery > points[(int)which]; break;
                case PlayerPoints.Quarry: areTherePoints = Settings.pointsQuarry > 0 && Settings.pointsQuarry > points[(int)which]; break;
                case PlayerPoints.Road: areTherePoints = Settings.pointsRoad > 0 && Settings.pointsRoad > points[(int)which]; break;
                case PlayerPoints.Saw: areTherePoints = Settings.pointsSaw > 0 && Settings.pointsSaw > points[(int)which]; break;
                case PlayerPoints.Stepherd: areTherePoints = Settings.pointsStepherd > 0 && Settings.pointsStepherd > points[(int)which]; break;
                case PlayerPoints.Town: areTherePoints = Settings.pointsTown > 0 && Settings.pointsTown > points[(int)which]; break;
                case PlayerPoints.UpgradeLvl1: areTherePoints = Settings.pointsUpgradeLvl1 > 0 && Settings.pointsUpgradeLvl1 > points[(int)which]; break;
                case PlayerPoints.UpgradeLvl2: areTherePoints = Settings.pointsUpgradeLvl2 > 0 && Settings.pointsUpgradeLvl2 > points[(int)which]; break;
            }
            if (!areTherePoints)
                return;

            points[(int) which] ++;
            statistic.AddStat(Statistic.Kind.Points, 1, GameMaster.Inst().GetTurnNumber());
        }
Beispiel #39
0
        private int DrawPoints(Player[] players, string text1, string text2, Texture2D texture2D, PlayerPoints pointKind, int goal, int pointNumber)
        {
            SpriteBatch spriteBatch = ScreenManager.SpriteBatch;

            int x = 500 + pointNumber * 80;
            int y = 300;
            spriteBatch.Draw(texture2D, new Vector2(x, y - texture2D.Height), Color.White);

            SpriteFont font = GameResources.Inst().GetFont(EFont.MedievalBig);
            int count = 0;
            foreach (Player player in players)
            {
                int points = player.GetPoints()[(int)pointKind];
                switch (pointKind)
                {
                    case PlayerPoints.Corn: points = player.GetCollectSourcesNormal().GetCorn(); break;
                    case PlayerPoints.Meat: points = player.GetCollectSourcesNormal().GetMeat(); break;
                    case PlayerPoints.Stone: points = player.GetCollectSourcesNormal().GetStone(); break;
                    case PlayerPoints.Wood: points = player.GetCollectSourcesNormal().GetWood(); break;
                    case PlayerPoints.Ore: points = player.GetCollectSourcesNormal().GetOre(); break;
                    default: points = player.GetPoints()[(int)pointKind]; break;
                }

                int showPoints = (goal - points);
                if (showPoints < 0)
                    showPoints = 0;
                spriteBatch.DrawString(font, "" + showPoints, new Vector2(x + 20, y + 50 * count + 12), Settings.colorMenuText);
                count++;
            }

            return pointNumber + 1;
        }