/// <summary> /// Get Player Abilities list /// </summary> /// <param name="playerId"></param> /// <returns></returns> public static Abilities GetPlayerAbility(int playerId, SkillType skillType) { using (MySqlConnection connection = new MySqlConnection(connectionString)) { connection.Open(); Abilities abilities = new Abilities(); using (MySqlCommand command = connection.CreateCommand()) { command.CommandText = "GAME_PLAYER_ABILITY_GET"; command.CommandType = System.Data.CommandType.StoredProcedure; command.Parameters.AddWithValue("@in_PlayerId", playerId); command.Parameters.AddWithValue("@in_AbilityType", skillType); var reader = command.ExecuteReader(); if (reader.HasRows) { while (reader.Read()) { int abilityId = reader.GetInt32(1); int abilityLevel = reader.GetInt32(2); abilities.AddAbility(abilityId, abilityLevel); } } } connection.Close(); return abilities; } }
/// <summary> /// Get Player Abilities list /// </summary> /// <param name="playerId"></param> /// <returns></returns> public static Abilities GetPlayerAbility(int playerId, SkillType skillType) { using (MySqlConnection connection = new MySqlConnection(connectionString)) { connection.Open(); Abilities abilities = new Abilities(); using (MySqlCommand command = connection.CreateCommand()) { command.CommandText = "GAME_PLAYER_ABILITY_GET"; command.CommandType = System.Data.CommandType.StoredProcedure; command.Parameters.AddWithValue("@in_PlayerId", playerId); command.Parameters.AddWithValue("@in_AbilityType", skillType); var reader = command.ExecuteReader(); if (reader.HasRows) { while (reader.Read()) { int abilityId = reader.GetInt32(1); int abilityLevel = reader.GetInt32(2); abilities.AddAbility(abilityId, abilityLevel); } } } connection.Close(); return(abilities); } }
/// <summary> /// Called once per frame. /// </summary> public void Update() { if (Manager.Get().GameInProgress) { if (Input.GetKeyDown(KeyCode.Delete)) { try { List <AgentAI> agents = AgentAI.GetAgents(); AgentAI soldier = agents[0]; Abilities abilities = soldier.GetAbilities(); Manager.GetUIManager().ShowMessagePopup(abilities.ToString()); abilities.AddAbility(999); } catch (Exception e) { Debug.Log(e.Message + "\n" + e.StackTrace); Manager.GetUIManager().ShowMessagePopup(e.Message); } } } }