public Skill GetSkill(SkillID id) { if (database.ContainsKey(id)) { return(database[id].GetSkill()); } else { Debug.LogError("Database does not contain a skill with the ID: " + id.ToString()); } return(null); }
/// <summary> /// 使用指定id的技能 /// </summary> /// <param name="skillId">技能id</param> /// <param name="isBatter">是否为连击</param> public void UseSkill(SkillID skillId, bool isBatter = false) { if (isBatter && curSkill != null) { skillId = curSkill.nextBatterId; } curSkill = skillManager.PrepareSkill(skillId); if (curSkill == null) { Debug.Log("Can't use: " + skillId.ToString()); return; } if (curSkill.attackType == SkillAttackType.Single) { var target = SelectClosestTarget(); if (target == null) { Debug.Log("Can't find target for: " + skillId.ToString()); } else { ShowSelectedFx(false); curTarget = target; curAttackTargetSelected = curTarget.GetComponent <CharacterSelected>(); ShowSelectedFx(true); transform.LookAt(curTarget); } } else { // TODO } characterAnimation.SetTrigger(curSkill.hashAnimationName); }
public RaceSkillConditionalFeat SaveRaceSkillConditionalFeat() { SqlDataReader result; DatabaseConnection dbconn = new DatabaseConnection(); SqlCommand command = new SqlCommand(); SqlConnection connection = new SqlConnection(dbconn.SQLSEVERConnString); try { connection.Open(); command.Connection = connection; command.CommandType = CommandType.StoredProcedure; command.CommandText = "InsertUpdate_RaceSkillConditionalFeat"; command.Parameters.Add(dbconn.GenerateParameterObj("@RaceID", SqlDbType.Int, RaceID.ToString(), 0)); command.Parameters.Add(dbconn.GenerateParameterObj("@SkillID", SqlDbType.Int, SkillID.ToString(), 0)); command.Parameters.Add(dbconn.GenerateParameterObj("@ConditionalFeatID", SqlDbType.Int, ConditionalFeatID.ToString(), 0)); result = command.ExecuteReader(); result.Read(); SetReaderToObject(ref result); } catch { Exception e = new Exception(); this._insertUpdateOK = false; this._insertUpdateMessage.Append(e.Message.ToString()); throw e; } finally { command.Dispose(); connection.Close(); } return(this); }
/// <summary> /// Saves the sub skill. /// </summary> /// <returns>SubSkill object</returns> public SubSkill SaveSubSkill() { SqlDataReader result; DatabaseConnection dbconn = new DatabaseConnection(); SqlCommand command = new SqlCommand(); SqlConnection connection = new SqlConnection(dbconn.SQLSEVERConnString); try { connection.Open(); command.Connection = connection; command.CommandType = CommandType.StoredProcedure; command.CommandText = "InsertUpdate_SubSkill"; command.Parameters.Add(dbconn.GenerateParameterObj("@SubSkillID", SqlDbType.Int, SubSkillID.ToString(), 0)); command.Parameters.Add(dbconn.GenerateParameterObj("@SkillID", SqlDbType.Int, SkillID.ToString(), 0)); command.Parameters.Add(dbconn.GenerateParameterObj("@SubSkillName", SqlDbType.VarChar, SubSkillName.ToString(), 100)); command.Parameters.Add(dbconn.GenerateParameterObj("@SubSkillDescription", SqlDbType.VarChar, SubSkillDescription.ToString(), 1000)); command.Parameters.Add(dbconn.GenerateParameterObj("@Trained", SqlDbType.Bit, Trained.ToString(), 0)); result = command.ExecuteReader(); result.Read(); SetReaderToObject(ref result); } catch { Exception e = new Exception(); this._insertUpdateOK = false; this._insertUpdateMessage.Append(e.Message + " Inner Exception= " + e.InnerException); throw e; } finally { command.Dispose(); connection.Close(); } return(this); }
/// <summary> /// Delete the CharacterSkill. /// </summary> /// <returns>Boolean</returns> public bool DeleteCharacterSkill() { SqlDataReader result; DatabaseConnection dbconn = new DatabaseConnection(); SqlCommand command = new SqlCommand(); SqlConnection connection = new SqlConnection(dbconn.SQLSEVERConnString); try { connection.Open(); command.Connection = connection; command.CommandType = CommandType.StoredProcedure; command.CommandText = "Delete_CharacterSkill"; command.Parameters.Add(dbconn.GenerateParameterObj("@CharacterID", SqlDbType.Int, CharacterID.ToString(), 0)); command.Parameters.Add(dbconn.GenerateParameterObj("@SkillID", SqlDbType.Int, SkillID.ToString(), 0)); result = command.ExecuteReader(); } catch { Exception e = new Exception(); this._deleteOK = false; this._deletionMessage.Append(e.Message + " Inner Exception= " + e.InnerException); throw e; } finally { command.Dispose(); connection.Close(); } return(this.DeleteOK); }
/// <summary> /// Saves the character class level. /// </summary> /// <returns>CharacterSkill Object</returns> public CharacterSkill SaveCharacterSkill() { SqlDataReader result; DatabaseConnection dbconn = new DatabaseConnection(); SqlCommand command = new SqlCommand(); SqlConnection connection = new SqlConnection(dbconn.SQLSEVERConnString); try { connection.Open(); command.Connection = connection; command.CommandType = CommandType.StoredProcedure; command.CommandText = "InsertUpdate_CharacterSkill"; command.Parameters.Add(dbconn.GenerateParameterObj("@CharacterID", SqlDbType.Int, CharacterID.ToString(), 0)); command.Parameters.Add(dbconn.GenerateParameterObj("@SkillID", SqlDbType.Int, SkillID.ToString(), 0)); command.Parameters.Add(dbconn.GenerateParameterObj("@HalfLevel", SqlDbType.Int, HalfLevel.ToString(), 0)); command.Parameters.Add(dbconn.GenerateParameterObj("@AbilityMod", SqlDbType.Int, AbilityMod.ToString(), 0)); command.Parameters.Add(dbconn.GenerateParameterObj("@Trained", SqlDbType.Int, Trained.ToString(), 0)); command.Parameters.Add(dbconn.GenerateParameterObj("@SkillFocus", SqlDbType.Int, SkillFocus.ToString(), 0)); command.Parameters.Add(dbconn.GenerateParameterObj("@Miscellaneous", SqlDbType.Int, Miscellaneous.ToString(), 0)); command.Parameters.Add(dbconn.GenerateParameterObj("@FeatTalentMod", SqlDbType.Int, FeatTalentMod.ToString(), 0)); result = command.ExecuteReader(); result.Read(); SetReaderToObject(ref result); } catch { Exception e = new Exception(); this._insertUpdateOK = false; this._insertUpdateMessage.Append(e.Message + " Inner Exception= " + e.InnerException); throw e; } finally { command.Dispose(); connection.Close(); } return(this); }
public GameObject CreateEffectGo(SkillID path) { GameObject effectGo = null; OccupationType type = (OccupationType)PlayerInfoModel.Instance.SelectedPlayer.occupation; string occupation = type.ToString(); if (skillEffectGoDic.ContainsKey(path)) { effectGo = skillEffectGoDic[path]; effectGo.SetActive(true); Destroy script = effectGo.GetComponent <Destroy>(); script.ReAwake(); } else { //生成新的对象 GameObject effectPrefab = ResourceManager.Instance.Load("Effect_Prefeb/" + occupation + "_" + path.ToString()); effectGo = GameObject.Instantiate(effectPrefab); skillEffectGoDic.Add(path, effectGo); } return(effectGo); }