public PlayerProfile(float id) : base(id) { this.Name = "N/A"; this.Rank = WoodshopRank.Amateur; this.Stats = new PlayerStatistics(id); }
// Use this for initialization void Start() { //Grabs the instance of playerStatistic that we want from the player character //IF THE CHARACTER'S NAME CHANGES FROM 'CharacterRobotBoy' it MUST be changed here and in other instances playerStatistics = GameObject.Find(GameConst.PLAYER_OBJECT_NAME).GetComponent <PlayerStatistics>(); finalText = GameObject.Find("Stamina Last Text").GetComponent <Text>(); }
public SpriteShip(Sprite sprite) : base(sprite, false) { _boundary = new Rectangle { X = 10, Y = 50, Height = (int)World.Instance.WorldSize.Y - 80, Width = (int)World.Instance.WorldSize.X - 10 }; Scale.X = Scale.Y = 0.15f; PlayerStats = new PlayerStatistics(); Controller = new NullController(); // Create collider for ship CircleCollider cldr = new CircleCollider() { Radius = (int)230 * Scale.X, Position = Position }; cldr.Center.X = (Width / 2) - 9; cldr.Center.Y = (Height / 2) - 9; Collider = cldr; _weapon = new SingleBlaster(Width); Sprite.Frames.Add(new Rectangle { X = 0, Y = 0, Width = 405, Height = 488 }); Sprite.CenterPoint = new Vector2D { X = 405f / 2f, Y = 488f / 2f }; }
public void SaveDataBetweenScenes() { dataToLoad = true; PlayerManager.Instance.playerStats.SaveStats(); playerStatistics = PlayerManager.Instance.playerStats.GetPlayerStatistics(); inventory = Inventory.Instance.GetCurrentInventory(); stackedItems = Inventory.Instance.GetStackedItems(); currentPlayerGold = Inventory.Instance.GetGoldCount(); currentEquipment = EquipmentManager.Instance.currentEquipment; currentPlayerAbilities.Clear(); foreach (KeyValuePair <KeyCode, Ability> entry in PlayerManager.Instance.selectedAbilities) { currentPlayerAbilities.Add(entry.Key, entry.Value.GetAbilityId()); } int activeSceneIndex = SceneManager.GetActiveScene().buildIndex; if (playerLocationDictionary.ContainsKey(activeSceneIndex)) { playerLocationDictionary[activeSceneIndex] = PlayerManager.Instance.transform.position; } else { playerLocationDictionary.Add(activeSceneIndex, PlayerManager.Instance.transform.position); } }
public virtual void Show() { Console.WriteLine("-------------------"); Console.WriteLine("Player: " + this.ToString()); PlayerStatistics playerStatistics = new PlayerStatistics(cardList); Console.WriteLine("getMaxValue(); " + playerStatistics.MaxValue); Console.WriteLine("getOrderedValues(); " + playerStatistics.OrderedValues); for (int i = 1; i <= 5; i++) { Console.WriteLine("hasSameValue(" + i + "); " + playerStatistics.HasSameValue(i)); Console.WriteLine("getOrderedValues(" + i + "); " + playerStatistics.GetOrderedValues(i)); } for (int i = 1; i <= 5; i++) { Console.WriteLine("hasSameColor(" + i + "); " + playerStatistics.HasSameColor(i)); } Console.WriteLine("hasTwoPairs(); " + playerStatistics.HasTwoPairs()); foreach (Value value in Value.Values()) { if (Value.INFANTE.Greater(value)) { Console.WriteLine("hasStairStart(" + value.Title + "); " + playerStatistics.HasStairStart(value)); } } Console.WriteLine("hasStair(); " + playerStatistics.HasStair()); }
public override bool Equals(object obj) { if (this == obj) { return(true); } if (obj == null || GetType() != obj.GetType()) { return(false); } PlayerStatistics otherStat = (PlayerStatistics)obj; if (this.ID != otherStat.ID) { return(false); } if (this.AssociatedProfileID != otherStat.AssociatedProfileID) { return(false); } if (this.TotalNumberOfProjectsCompleted != otherStat.TotalNumberOfProjectsCompleted) { return(false); } if (this.TotalScore != otherStat.TotalScore) { return(false); } if (this.TotalCashEarned != otherStat.TotalCashEarned) { return(false); } if (this.TotalPerfectLinesCut != otherStat.TotalPerfectLinesCut) { return(false); } if (this.TotalPerfectDadosCut != otherStat.TotalPerfectDadosCut) { return(false); } if (this.TotalPerfectGluings != otherStat.TotalPerfectGluings) { return(false); } if (this.TotalPerfectSandings != otherStat.TotalPerfectSandings) { return(false); } if (this.TotalPerfectShines != otherStat.TotalPerfectShines) { return(false); } if (this.TotalPerfectPaints != otherStat.TotalPerfectPaints) { return(false); } return(true); }
public void initPlayerStats() { if (SceneManager.GetActiveScene().name == "SearchLevel") { localPlayerData = GlobalControl.Instance.savedPlayerData; localPlayerData.inventory = new List <Item>(); } if (SceneManager.GetActiveScene().name == "BattleScene1" || SceneManager.GetActiveScene().name == "BattleScene2" || SceneManager.GetActiveScene().name == "BattleScene3") { localPlayerData = GlobalControl.Instance.savedPlayerData; if (localPlayerData.inventory.Exists((x) => x is Weapon)) { switch (localPlayerData.getWeaponType()) { case Weapon.weaponType.Distance: anim.SetInteger("weaponType", 2); break; case Weapon.weaponType.Melee: anim.SetInteger("weaponType", 1); break; case Weapon.weaponType.Shield: anim.SetInteger("weaponType", 3); break; } } } }
// Start is called before the first frame update void Start() { worldSettings = FindObjectOfType <WorldSettings>(); controller = GetComponent <CharacterController>(); worldSettings = FindObjectOfType <WorldSettings>(); anim = GetComponent <Animator>(); raycast = GetComponent <RaycastController>(); if (raycast != null) { int inventoryLayerMask = 1 << LayerMask.NameToLayer("Enemy"); raycast.AddLayerMask(inventoryLayerMask); } equipper = GetComponent <ItemEquipper>(); attack = GetComponent <PlayerAttack>(); treeController = GetComponent <TreeController>(); cameraAdjuster = GetComponent <CameraAdjuster>(); playerStatistics = GetComponent <PlayerStatistics>(); itemCollector = GetComponent <ItemCollector>(); totalSwingTime = GetSwimgTimeByAnimator(anim); reticleMissColor = reticle.color; }
public static void UpdatePlayerStatistics(Mobile pm) { AuthorStatistics ast; bool newUser = false; if (ForumCore.PlayerStatistics.ContainsKey(pm.Serial.Value)) { ast = ForumCore.GetAuthorStatistics(pm.Serial.Value); } else { ast = new AuthorStatistics(pm.Serial.Value, pm.Name, DateTime.Now, 0); newUser = true; } ast.PostCount++; if (newUser) { if (!PlayerStatistics.ContainsKey(ast.Serial)) { PlayerStatistics.Add(ast.Serial, ast); } } }
/// <summary> /// Init all the objects /// </summary> void Start() { Input.multiTouchEnabled = false; PlayerStatistics.ResetPlayer(); m_GameCreator.CreateGame(); m_InitHUD.Init(); }
private void Start() { var bottomLeft = Camera.main.ViewportToWorldPoint(new Vector3(0, 0, 0)); var bottomRight = Camera.main.ViewportToWorldPoint(new Vector3(1, 0, 0)); screenCenter = (bottomLeft.x + bottomRight.x) / 2f; taskHandlerClass = FindObjectOfType <TaskHandler>(); anim = GetComponent <Animator>(); playerStats = FindObjectOfType <PlayerStatistics>(); if (isBlinking) { anim.enabled = false; } if (!isBlinking) { foreach (Transform child in transform) { if (child.gameObject.name == "Head") { child.GetChild(0).gameObject.SetActive(false); } } } }
private void ListOnlineGames() { int gameCount = sm.GetMatchCount(); for (int i = 0; i < gameCount; i++) { MatchStatistics ms = sm.GetMatchByIndex(i); int pCount = ms.GetPlayerCount(); int hpCount = 0; for (int j = 0; j < pCount; j++) { PlayerStatistics ps = ms.GetPlayer(j); if (!ps.IsAI) { hpCount++; if (hpCount > 1) { ListGameIndexIfPrerequisitesMet(i); break; } } } } }
private MLRequestModel CreatePredictionRequestBody(PlayerStatistics aggregatedStats) { var inputs = new MLRequestInputModel[] { new MLRequestInputModel { MIN = aggregatedStats.MIN.ToString(), FGA = aggregatedStats.FGA.ToString(), FG3A = aggregatedStats.FG3A.ToString(), FTA = aggregatedStats.FTA.ToString(), OREB = aggregatedStats.OREB.ToString(), DREB = aggregatedStats.DREB.ToString(), AST = aggregatedStats.AST.ToString(), TOV = aggregatedStats.TOV.ToString(), STL = aggregatedStats.STL.ToString(), BLK = aggregatedStats.BLK.ToString(), PF = aggregatedStats.PF.ToString(), PTS = aggregatedStats.PTS.ToString() } }; var input1 = new MLRequestInputListModel { input1 = inputs }; var request = new MLRequestModel { Inputs = input1, GlobalParameters = new { } }; return(request); }
private void ListPvPGames() { int gameCount = sm.GetMatchCount(); for (int i = 0; i < gameCount; i++) { MatchStatistics ms = sm.GetMatchByIndex(i); int pCount = ms.GetPlayerCount(); int pTeam = -1; for (int j = 0; j < pCount; j++) { PlayerStatistics ps = ms.GetPlayer(j); if (!ps.IsAI && !ps.WasSpectator) { // If we find a single player on a different team than another player, // we'll count the game as a PvP game if (pTeam > -1 && (ps.Team != pTeam || ps.Team == 0)) { ListGameIndexIfPrerequisitesMet(i); break; } pTeam = ps.Team; } } } }
private void ListGameIndexIfPrerequisitesMet(int gameIndex) { MatchStatistics ms = sm.GetMatchByIndex(gameIndex); if (cmbGameModeFilter.SelectedIndex != 0) { string gameMode = cmbGameModeFilter.Items[cmbGameModeFilter.SelectedIndex].Text; if (ms.GameMode != gameMode) { return; } } PlayerStatistics ps = ms.Players.Find(p => p.IsLocalPlayer); if (ps != null && !chkIncludeSpectatedGames.Checked) { if (ps.WasSpectator) { return; } } listedGameIndexes.Add(gameIndex); }
public static void resetStatistics() { player = new PlayerStatistics(); cpu1 = new PlayerStatistics(); cpu2 = new PlayerStatistics(); cpu3 = new PlayerStatistics(); }
/* * Function: SaveData * * Description: saves all relevant player and quest data to disk, data contained * in the PlayerStatistics class * Creator: Myles Hagen */ public void SaveData() { sceneNum = SceneManager.GetActiveScene().buildIndex; if (!Directory.Exists("Saves")) { Directory.CreateDirectory("Saves"); } BinaryFormatter formatter = new BinaryFormatter(); FileStream saveFile = File.Create("Saves/save.binary"); LocalCopyOfData = PlayerState.Instance.localPlayerData; formatter.Serialize(saveFile, LocalCopyOfData); saveFile.Close(); FileStream saveQuestFile = File.Create(Application.persistentDataPath + "/questInfo.dat"); QuestStatistic qs = new QuestStatistic(); // foreach (var item in saveQuest) { // // } FindNPCSaveBool(); qs.questStatistic = saveQuest; formatter.Serialize(saveQuestFile, qs); saveQuestFile.Close(); }
void Awake() { character_movement = GetComponent <PlayerMoveAction>(); look_Position = transform.GetChild(0); player_movement = GetComponentInChildren <MovementSound>(); player_statistics = GetComponent <PlayerStatistics>(); }
public virtual PlayerStatistics GetPlayerStatistics(int playerId) { var playerStatistics = new PlayerStatistics(); var gameDefinitionTotals = GetGameDefinitionTotals(playerId); playerStatistics.GameDefinitionTotals = gameDefinitionTotals; var topLevelTotals = GetTopLevelTotals(gameDefinitionTotals); playerStatistics.TotalGames = topLevelTotals.TotalGames; playerStatistics.TotalGamesLost = topLevelTotals.TotalGamesLost; playerStatistics.TotalGamesWon = topLevelTotals.TotalGamesWon; if (playerStatistics.TotalGames > 0) { playerStatistics.WinPercentage = (int)((decimal)playerStatistics.TotalGamesWon / (playerStatistics.TotalGames) * 100); } playerStatistics.NemePointsSummary = GetNemePointsSummary(playerId); //had to cast to handle the case where there is no data: //http://stackoverflow.com/questions/6864311/the-cast-to-value-type-int32-failed-because-the-materialized-value-is-null playerStatistics.AveragePlayersPerGame = (float?)_dataContext.GetQueryable <PlayedGame>() .Where(playedGame => playedGame.PlayerGameResults.Any(result => result.PlayerId == playerId)) .Average(game => (int?)game.NumberOfPlayers) ?? 0F; return(playerStatistics); }
void Awake() { player = GameObject.FindGameObjectWithTag("Player"); playerStatistics = player.gameObject.GetComponent<PlayerStatistics>(); playerAnimator = player.gameObject.GetComponent<PlayerAnimator>(); animHashes = player.GetComponent<HashIDs>(); }
private void OnConsume() { var item = EquippedItem as ConsumableItem; if (item.Consumptions > 0) { if (consumeSFX) { AudioSource.PlayClipAtPoint(consumeSFX, transform.position); } item.Consume(); PlayerStatistics playerStatistics = GetComponent <PlayerStatistics>(); playerStatistics.ChangePlayerHealth(item.Properties.HealthOnConsume); playerStatistics.ChangePlayerHunger(item.Properties.HungerOnConsume); playerStatistics.ChangePlayerRadiation(item.Properties.RadiationOnConsume); if (item.Consumptions == 0) { RemoveEquipment(); ItemCollector itemCollector = GetComponent <ItemCollector>(); itemCollector.RemoveFromInventory(item); } } }
public void UpdateStats() { MyEventStatsUpdate msg = new MyEventStatsUpdate(); msg.StatsBuilder = PlayerStatistics.GetObjectBuilder(); Peers.SendToAll(ref msg, NetDeliveryMethod.Unreliable); }
void Update() { DebugPlayerList(); //Create a list of players in the Unity Game GameObject[] players = GameObject.FindGameObjectsWithTag("student"); Debug.Log("Amoung of players " + players.Count().ToString()); //Add any player thats in the Unity Game but not in the playerList (The player joined the game) foreach (GameObject player in players) { PlayerStatistics playerStats = player.GetComponent <PlayerStatistics>(); if (playerStats.name != "" && !playerList.ContainsKey(playerStats.name)) { Debug.Log("Adding " + playerStats.name + " to player list."); playerList.Add(playerStats.name, playerStats); } } //Create a set of playernames from the Players List var playerNames = from i in Enumerable.Range(0, players.Count()) select players[i].GetComponent <PlayerStatistics>().name; playerNames = new HashSet <string>(playerNames); //Remove any playername thats in the playerList but not in the Unity Game (The player left the game) foreach (KeyValuePair <string, PlayerStatistics> entry in playerList.Reverse()) { if (!playerNames.Contains(entry.Key)) { playerList.Remove(entry.Key); } } }
void Start() { var mapGenerator = GetComponent <MapGenerator>(); blockRenderer = GetComponent <BlockRenderer>(); stats = GetComponent <PlayerStatistics>(); spawnSerializer = GetComponent <SpawnSerializer>(); canvasController = GetComponent <GameCanvasController>(); sounds = GetComponent <SoundController>(); map = mapGenerator.Generate(90, 90); Func <Spawn, VectorI2> GetStart = (s) => { int rndId = UnityEngine.Random.Range(0, s.spawnPoints.Count); SpawnPoint sp = s.spawnPoints[rndId]; var vec = new VectorI2((int)sp.playerSpawn.x, (int)sp.playerSpawn.y); map[vec.X, vec.Y] = Constants.Objects.Floor; var vecRadio = new VectorI2((int)sp.radioSpawn.x, (int)sp.radioSpawn.y); map[vecRadio.X, vecRadio.Y] = Constants.Objects.Radio; return(vec); }; playerPos = GetStart(spawnSerializer.GetSpawn()); blockRenderer.Initialize(SquareIsValid, map, playerPos.X, playerPos.Y); StartCoroutine(ReduceOxygen()); StartCoroutine(RunDownRadio()); }
private void Awake() { playerHealth = FindObjectOfType <PlayerHealthManager>(); playerMana = FindObjectOfType <PlayerManaManager>(); playerStats = FindObjectOfType <PlayerStatistics>(); playerDamage = FindObjectOfType <DamageEnemy>(); }
void Awake() { // singleton enforcement // if (FindObjectsOfType(typeof(PlayerStatManager)).Length > 1) // { // Debug.Log("PSM: Already found instance of script in scene; destroying."); // DestroyImmediate(gameObject); // } if (_instance != null && _instance != this) { GameObject.Destroy(this.gameObject); } else { _instance = this; playerStats = new PlayerStatistics[4]; for (int i = 0; i < 4; i++) { playerStats[i] = new PlayerStatistics(5, 5, 3f, 4f, 3); } DontDestroyOnLoad(gameObject); } }
public PlayerProfile() : base() { this.Name = "N/A"; this.Rank = WoodshopRank.Amateur; this.Stats = null; }
// Use this for initialization void Start() { playerStatistics = GameObject.Find(GameConst.PLAYER_OBJECT_NAME).GetComponent <PlayerStatistics>(); dialogueEvent = GameObject.Find("Dialogue Canvas").GetComponent <DialogueManager>().dialogueEvent; //UnityEventTools.AddPersistentListener<int>(dialogueEvent, dialogueEventHandler); dialogueEvent.AddListener(dialogueEventHandler); }
public PlayerProfile(float id, string name, WoodshopRank rank, PlayerStatistics stats) : base(id) { this.Name = name; this.Rank = rank; this.Stats = stats; }
public void ItGetsTheGamesPlayedMetrics() { PlayerStatistics playerStatistics = _playerRetriever.GetPlayerStatistics(testPlayer1.Id); int totalGamesForPlayer1 = testPlayedGames .Count(playedGame => playedGame.PlayerGameResults .Any(playerGameResult => playerGameResult.PlayerId == testPlayer1.Id)); Assert.That(playerStatistics.TotalGames, Is.EqualTo(totalGamesForPlayer1)); int totalWinsForPlayer1 = testPlayedGames .Count(playedGame => playedGame.PlayerGameResults .Any(playerGameResult => playerGameResult.PlayerId == testPlayer1.Id && playerGameResult.GameRank == 1)); Assert.That(playerStatistics.TotalGamesWon, Is.EqualTo(totalWinsForPlayer1)); int totalLossesForPlayer1 = testPlayedGames .Count(playedGame => playedGame.PlayerGameResults .Any(playerGameResult => playerGameResult.PlayerId == testPlayer1.Id && playerGameResult.GameRank != 1)); Assert.That(playerStatistics.TotalGamesLost, Is.EqualTo(totalLossesForPlayer1)); int winPercentageForPlayer1 = (int)((decimal)totalWinsForPlayer1 / (totalGamesForPlayer1) * 100); Assert.That(playerStatistics.WinPercentage, Is.EqualTo(winPercentageForPlayer1)); }
private Dictionary <int, PlayerStatistics> ParsePlayerStatistics(List <Player> rawPlayersData) { Dictionary <int, PlayerStatistics> allPlayersStatistics = new Dictionary <int, PlayerStatistics>(); foreach (Player player in rawPlayersData) { if (player.MatchPlayers != null && player.MatchPlayers.Count() != 0) { // Player played a match if (!allPlayersStatistics.ContainsKey(player.Id)) { PlayerStatistics newstatsToTrack = new PlayerStatistics() { PlayerId = player.Id, PlayerName = player.Name, PlayerTeam = player.Team.Name, MatchesPlayed = player.MatchPlayers.Count(), GoalsScored = CountGoals(player.MatchPlayers) }; allPlayersStatistics.Add(player.Id, newstatsToTrack); } } } return(allPlayersStatistics.OrderByDescending(ps => ps.Value.GoalsScored).ToDictionary(ps => ps.Key, ps => ps.Value)); }
private void Start() { slowmoClass = slowmotion.GetComponent <Slowmotion>(); playerClass = GetComponent <Player>(); playerStats = FindObjectOfType <PlayerStatistics>(); //objectPooler = ObjectPooler.Instance; }
void Awake() { anim = GetComponent<Animator>(); animHashes = GetComponent<HashIDs>(); playerStatistics = GetComponent<PlayerStatistics>(); combatController = GameObject.Find("GameManager").GetComponent<CombatController>(); anim.speed = animSpeed; }
public void Add(string _player) { #if DEBUG if ( Get (_player) != null ) { Debug.LogError("Trying to add already existing player!"); } #endif m_Statistics[_player] = new PlayerStatistics(_player); }
private Animator animator; //Used to store a reference to the Player's animator component. //Start overrides the Start function of MovingObject /*protected override void Start() { SurroundingHexes = new List<Grid>(); //Get a component reference to the Player's animator component animator = GetComponent<Animator>(); rb2D = GetComponent<Rigidbody2D>(); //Call the Start function of the MovingObject base class. //base.Start(); }*/ public void InitPlayer(int index) { _rb2D = GetComponent<Rigidbody2D>(); Stats = new PlayerStatistics("Gafda", 100, 100, 100, 10, 0, 50, 50, 2, 1, 1); CurrentIndexPosition = index; CurrentPosY = index / Scene.Height; CurrentPosX = index - CurrentPosY * Scene.Height; _start = true; }
void Awake() { playerStatistics = GameObject.FindGameObjectWithTag("Player").GetComponent<PlayerStatistics>(); makeDecision = GameObject.Find("GameManager").GetComponent<DecisionNetwork.MakeDecision>(); mainMenuRects[0] = new Rect(750, 310, 400, 100); mainMenuRects[1] = new Rect(750, 436, 400, 100); mainMenuRects[2] = new Rect(750, 562, 400, 100); mainMenuRects[3] = new Rect(750, 688, 400, 100); newMainMenuRects[0] = new Rect(170, 310, 400, 100); newMainMenuRects[1] = new Rect(170, 436, 400, 100); newMainMenuRects[2] = new Rect(170, 562, 400, 100); newMainMenuRects[3] = new Rect(170, 688, 400, 100); }
internal PlayerModel() { CurrentCargo = new CargoStorage(); Missions = new MissionList(); Statistics = new PlayerStatistics(); LegalRecords = new LegalRecords(); foreach (var allegiance in Enums.All_Allegiances) LegalRecords.Add(allegiance, new LegalRecord()); MilitaryRanks = new MilitaryRecords { { Allegiance.Alliance, new MilitaryRecord() }, { Allegiance.Empire, new MilitaryRecord() } }; IsPlayer = true; }
public void Load() { BinaryFormatter formatter = new BinaryFormatter(); FileStream saveFile = File.Open("Saves/save.binary", FileMode.Open); LocalCopyOfData = (PlayerStatistics)formatter.Deserialize(saveFile); savedPlayerData = LocalCopyOfData; saveFile.Close(); IsBeingLoaded = true; }
//player data load success callback private void OnLoadSuccess() { EventsAggregator.Network.RemoveListener(ENetworkEvent.PlayerDataLoadSuccess, OnLoadSuccess); //TODO: assign correct values Resources = new PlayerResources(10, 2500, 100); Inventory = new PlayerInventory(); Heroes = new PlayerHeroes(new BaseHero[] { new BaseHero(UnitsConfig.Instance.GetHeroData(EUnitKey.Hero_Sniper), 0) }, 0); HeroSkills = new PlayerHeroSkills(); City = new PlayerCity(); StoryProgress = new PlayerStoryProgress(); Statistics = new PlayerStatistics(); VIPStatus = EPlayerVIP.None; }
void Awake() { if (Instance == null) Instance = this; if (Instance != this) Destroy(gameObject); GlobalObject.Instance.Player = gameObject; GlobalObject.Instance.fpsTransform = gameObject.transform; localPlayerData = GlobalObject.Instance.savedPlayerData; if (GlobalObject.Instance.IsBeingLoaded == true) playerPosition.position = new Vector3(localPlayerData.PositionX, localPlayerData.PositionY, localPlayerData.PositionZ); GlobalObject.Instance.IsBeingLoaded = false; }
public Fruits(GameObject gameObject, float mass, string description, byte itemValue, PlayerStatistics stats) { this.Name = stats.Name; this.GType = GlobalType.Fruits; this.Mass = mass; this.Description = description; this.Count = 1; this.gameObject = gameObject; this.isUsable = true; this.ItemValue = itemValue; this._stats = stats; this.isStackable = true; switch(itemValue) { case ItemValues.Apple: InventorySprite = FruitResources.IN_Apple; InGameSprite = FruitResources.IG_Apple; this.Type = ItemType.Apple; break; case ItemValues.Banana: InventorySprite = FruitResources.IN_Banana; InGameSprite = FruitResources.IG_Banana; this.Type = ItemType.Banana; break; case ItemValues.Coconut: InventorySprite = FruitResources.IN_Coconut; InGameSprite = FruitResources.IG_Coconut; this.Type = ItemType.Coconut; break; case ItemValues.GreenMushroom: InventorySprite = FruitResources.IN_GreenMushroom; InGameSprite = FruitResources.IG_GreenMushroom; this.Type = ItemType.Mushroom01; break; case ItemValues.Orange: InventorySprite = FruitResources.IN_Orange; InGameSprite = FruitResources.IG_Orange; this.Type = ItemType.Orange; break; case ItemValues.Pear: InventorySprite = FruitResources.IN_Pear; InGameSprite = FruitResources.IG_Pear; this.Type = ItemType.Pear; break; } }
// There's a lot more statistics available but since we are focusing on who plays clan wars, I'm just grabbing battles for now. private PlayerStatistics GetPlayerStatistics(JToken jToken) { var playerStatistics = new PlayerStatistics(); var battles = (int)jToken["battles"]; playerStatistics.Battles = battles; return playerStatistics; }
public void Start() { m_Mine = new PlayerStatistics(Network.player.guid); m_Total = new TotalStatistics (); m_Statistics = new Dictionary<string, PlayerStatistics> (); Global.Player().postConnected += ListenPlayerConnected; }
private async Task<PlayerStatistics> Calculate(int playerId, int days, IDictionary<int, string> allPlayers) { var result = new PlayerStatistics(); var minDate = days >= int.MaxValue ? new DateTime(2000, 1, 1) : DateTime.UtcNow.AddDays(-days); var positionsQuery = from position in _db.PlayerPositions join game in _db.Games on position.GameId equals game.Id where game.Date >= minDate && position.PlayerId == playerId select new { Position = position, Game = game }; var firstDate = DateTime.MaxValue; var lastDate = DateTime.MinValue; var offenseCount = 0; var defenseCount = 0; var teamMateCount = new Dictionary<int, int>(); var winPlayerCount = new Dictionary<int, int>(); var lostPlayerCount = new Dictionary<int, int>(); foreach (var x in positionsQuery) { var otherPositions = await _db.PlayerPositions.Where(y => y.GameId == x.Game.Id && y.PlayerId != playerId).ToListAsync(); if (x.Position.Position == PlayerPositionTypes.Blue || x.Position.Position == PlayerPositionTypes.Red) { result.SingleGames++; } else { result.TeamGames++; } if (x.Position.IsRedPosition) { result.GoalsScored += x.Game.RedScore; result.GoalsTaken += x.Game.BlueScore; if (x.Game.RedWins) { result.RedWins++; AddOrIncrease(winPlayerCount, otherPositions.Where(y => y.IsBluePosition).Select(y => y.PlayerId)); } else { result.RedLosses++; AddOrIncrease(lostPlayerCount, otherPositions.Where(y => y.IsBluePosition).Select(y => y.PlayerId)); } } else if (x.Position.IsBluePosition) { result.GoalsScored += x.Game.BlueScore; result.GoalsTaken += x.Game.RedScore; if (x.Game.BlueWins) { AddOrIncrease(winPlayerCount, otherPositions.Where(y => y.IsRedPosition).Select(y => y.PlayerId)); result.BlueWins++; } else { AddOrIncrease(lostPlayerCount, otherPositions.Where(y => y.IsRedPosition).Select(y => y.PlayerId)); result.BlueLosses++; } } if (x.Position.Position == PlayerPositionTypes.BlueDefense || x.Position.Position == PlayerPositionTypes.RedDefense) { defenseCount++; } else if (x.Position.Position == PlayerPositionTypes.BlueOffense || x.Position.Position == PlayerPositionTypes.RedOffense) { offenseCount++; } if (x.Position.Position == PlayerPositionTypes.BlueDefense) { AddOrIncrease(teamMateCount, otherPositions.Where(y => y.Position == PlayerPositionTypes.BlueOffense).Select(y => y.PlayerId).FirstOrDefault()); } else if (x.Position.Position == PlayerPositionTypes.BlueOffense) { AddOrIncrease(teamMateCount, otherPositions.Where(y => y.Position == PlayerPositionTypes.BlueDefense).Select(y => y.PlayerId).FirstOrDefault()); } else if (x.Position.Position == PlayerPositionTypes.RedDefense) { AddOrIncrease(teamMateCount, otherPositions.Where(y => y.Position == PlayerPositionTypes.RedOffense).Select(y => y.PlayerId).FirstOrDefault()); } else if (x.Position.Position == PlayerPositionTypes.RedOffense) { AddOrIncrease(teamMateCount, otherPositions.Where(y => y.Position == PlayerPositionTypes.RedDefense).Select(y => y.PlayerId).FirstOrDefault()); } if (x.Game.Date < firstDate) { firstDate = x.Game.Date; } if (x.Game.Date > lastDate) { lastDate = x.Game.Date; } } if (offenseCount > defenseCount) { result.FavoritePosition = "Offense"; result.FavoritePositionGames = offenseCount; } else if (offenseCount < defenseCount) { result.FavoritePosition = "Defense"; result.FavoritePositionGames = defenseCount; } else if (offenseCount > 0 && defenseCount > 0 && offenseCount == defenseCount) { result.FavoritePosition = "Awesome everywhere"; result.FavoritePositionGames = offenseCount; } if (lastDate > DateTime.MinValue) { result.LastGameDate = lastDate.ToString("dd MMMM yyyy, HH:mm") + " UTC"; } if (firstDate < DateTime.MaxValue) { result.FirstGameDate = firstDate.ToString("dd MMMM yyyy, HH:mm") + " UTC"; } int key; if (teamMateCount.Any()) { key = teamMateCount.Aggregate((l, r) => l.Value > r.Value ? l : r).Key; if (allPlayers.ContainsKey(key)) { result.PlayedMostGamesWith = allPlayers[key]; result.PlayedMostGamesWithCount = teamMateCount[key]; } } if (winPlayerCount.Any()) { key = winPlayerCount.Aggregate((l, r) => l.Value > r.Value ? l : r).Key; if (allPlayers.ContainsKey(key)) { result.WonMostGamesAgainst = allPlayers[key]; result.WonMostGamesAgainstCount = winPlayerCount[key]; } } if (lostPlayerCount.Any()) { key = lostPlayerCount.Aggregate((l, r) => l.Value > r.Value ? l : r).Key; if (allPlayers.ContainsKey(key)) { result.LostMostGamesAgainst = allPlayers[key]; result.LostMostGamesAgainstCount = lostPlayerCount[key]; } } return result; }
// Use this for initialization void Start() { sound = GameObject.FindGameObjectWithTag("Sound Manager").GetComponent<Soundmanager>(); gameObject.GetComponent<Renderer>().material.color = Color.red; gameObject.GetComponent<Rigidbody> ().maxAngularVelocity = Speed; player = gameObject.GetComponent<PlayerStatistics> (); //bullet.tag = "Player Bullet"; // Tags bullets created by player as a player bullet. }
//At start, load data from GlobalControl. void Start() { localPlayerData = GlobalObject.Instance.savedPlayerData; }
//At start, load data from GlobalControl. void Start() { localPlayerData = GlobalControl.Instance.savedPlayerData; }
public void Start() { mine = new PlayerStatistics(Network.player.guid); mine.kill.postAdd += (_value, _change) => { mine.consecutiveKill.Add(_change); mine.consecutiveDeath.Clear(); }; mine.death.postAdd += (_value, _change) => { mine.consecutiveDeath.Add(_change); mine.consecutiveKill.Clear(); }; Global.Player().postConnected += ListenPlayerConnected; }
public void SaveData() { if (!Directory.Exists("Saves")) Directory.CreateDirectory("Saves"); FireSaveEvent(); BinaryFormatter formatter = new BinaryFormatter(); FileStream saveFile = File.Create("Saves/save.binary"); FileStream SaveObjects = File.Create("saves/saveObjects.binary"); LocalCopyOfData = PlayerState.Instance.localPlayerData; formatter.Serialize(saveFile, LocalCopyOfData); formatter.Serialize(SaveObjects, SavedLists); saveFile.Close(); SaveObjects.Close(); print("Saved!"); }
public void LoadData() { BinaryFormatter formatter = new BinaryFormatter(); FileStream saveFile = File.Open("Saves/save.binary", FileMode.Open); FileStream saveObjects = File.Open("Saves/saveObjects.binary", FileMode.Open); LocalCopyOfData = (PlayerStatistics)formatter.Deserialize(saveFile); SavedLists = (List<SavedDroppableList>)formatter.Deserialize(saveObjects); saveFile.Close(); saveObjects.Close(); print("Loaded"); }
public void Init() { //NAME//HEALTH//STAMINA//MANA//ARMOR//EXP//DRINK//EAT//STRENGTH//AGILITY//CHARISMA PearStats = new PlayerStatistics("Pear", 0.2f, 0.2f, 0.2f, 0, 0.1f, 1.7f, 4.0f, 0, 0, 0); AppleStats = new PlayerStatistics("Apple", 0.2f, 0.2f, 0.2f, 0, 0.1f, 0.7f, 5.0f, 0, 0, 0); CoconutStats = new PlayerStatistics("Coconut", 0.2f, 0.2f, 0.4f, 0, 0.1f, 7.0f, 0.2f, 0, 0, 0); BananaStats = new PlayerStatistics("Banana", 0.4f, 0.2f, 0.2f, 0, 0.1f, 0.2f, 7.0f, 0, 0, 0); OrangeStats = new PlayerStatistics("Orange", 0.2f, 0.4f, 0.2f, 0, 0.1f, 3.0f, 2.0f, 0, 0, 0); Mushroom01Stats = new PlayerStatistics("Green mushroom", 3f, 3f, -2f, 0, 0.1f, 0.5f, -2.0f, 0, 0, 0); }
void OnDestroy() { player = null; statistic = null; }
void Start() { player = GameObject.FindGameObjectWithTag("Player").GetComponent<PlayerStatistics>(); }
// ได้รับข้อมูลสถิติการเล่นกลับมา private void getStatisticsCallback(PlayerStatistics statistics) { if (statistics != null) { _statistics = statistics; FirstAveragePointTextBlock.Text = _statistics.FirstAveragePoint.ToString(); FirstHighScorePointTextBlock.Text = _statistics.FirstHighScorePoint.ToString(); SecondAveragePointTextBlock.Text = _statistics.SecondAveragePoint.ToString(); SecondHighScorePointTextBlock.Text = _statistics.SecondHighScorePoint.ToString(); ThirdAveragePointTextBlock.Text = _statistics.ThirdAveragePoint.ToString(); ThirdHighScorePointTextBlock.Text = _statistics.ThirdHighScorePoint.ToString(); PercentileTextBlock.Text = _statistics.Percentile.ToString(); TimeTextBlock.Text = _statistics.Time.ToString(); AllAveragePointTextBlock.Text = Convert.ToString(_statistics.FirstAveragePoint + _statistics.SecondAveragePoint + _statistics.ThirdAveragePoint); AllHighScorePointTextBlock.Text = _statistics.AllHighScorePoint.ToString(); if (_callbackCompleted) displayCardInformationByScore( _statistics.FirstHighScorePoint + _statistics.SecondHighScorePoint + _statistics.ThirdHighScorePoint); else _callbackCompleted = true; } }
void Awake() { makeDecision = GameObject.Find("GameManager").GetComponent<DecisionNetwork.MakeDecision>(); playerStatistics = GameObject.FindGameObjectWithTag("Player").GetComponent<PlayerStatistics>(); actionHashes = new Hashtable(); }
// Use this for initialization void Start () { dialogueBox.SetActive (false); dialogueBoxFader = dialogueBox.GetComponent<FadeAfterTime> (); playerStats = GetComponent<PlayerStatistics> (); }
void Start() { stats = GetComponent<PlayerStatistics>(); }