Exemple #1
0
        public static HeroEntity IncreaseStat(HeroEntity tempHero, string stat2inc)
        {
            switch (stat2inc)
            {
            case "Attack":
                tempHero.Attack++;
                break;

            case "Health":
                tempHero.Health      += 3;
                tempHero.AddedHealth += 3;
                //tempHero.DefaultHealth++;
                break;

            case "Speed":
                tempHero.Speed++;
                break;

            case "Accuracy":
                tempHero.Accuracy += 5;
                break;
            }

            return(tempHero);
        }
Exemple #2
0
        public string Add2Leaderboard(string TableName, string User2Add)
        {
            string        jsonGetData = string.Empty;
            int           responseCode;
            StringBuilder theMessage = new StringBuilder();

            // Add user to Leaderboard
            theMessage.Append("Adding User " + User2Add + " to LeaderBoard");
            responseCode = JTAzureTableRESTCommands.GetEntityProperty("GET", storageName, sAS, TableName, out jsonGetData, "Hero", "User");
            HeroEntity       userHero = JsonConvert.DeserializeObject <HeroEntity>(jsonGetData);
            LeaderBoardEntry newEntry = new LeaderBoardEntry();

            newEntry.RowKey       = User2Add;
            newEntry.AttackCount  = userHero.AttackCount;
            newEntry.RespawnCount = userHero.RespawnCount;
            newEntry.Score        = userHero.Score;
            newEntry.AttackDate   = DateTime.Now.ToShortDateString();

            // Create new Leaderboard Entry
            responseCode = JTAzureTableRESTCommands.ChangeEntity("POST", storageName, sAS, TableName, JsonConvert.SerializeObject(newEntry), string.Empty, string.Empty);
            theMessage.Append(responseCode + newLine);

            responseCode = 200; // Leaderboard Entry Added

            ResponseMessage response = new ResponseMessage(theMessage.ToString(), responseCode);

            return(JsonConvert.SerializeObject(response));
        }
Exemple #3
0
        //public HeroEntity aHero;
        //public BossEntity aBoss;

        public AnyEntity(HeroEntity theHero)
        {
            PartitionKey = theHero.PartitionKey;
            RowKey       = theHero.RowKey;
            Health       = theHero.Health;
            Attack       = theHero.Attack;
            Speed        = theHero.Speed;
            Accuracy     = theHero.Accuracy;
            XP           = theHero.XP;
            AttackCount  = theHero.AttackCount;
            Image        = theHero.Image;
            AddedHealth  = theHero.AddedHealth;
            RespawnCount = theHero.RespawnCount;
            Score        = theHero.Score;
        }