override public void LoadData(string sTextToParse) { base.LoadData(sTextToParse); m_cColor = (Color)GetElementValue(sTextToParse, "Color", m_cColor); m_bMain = (bool)GetElementValue(sTextToParse, "IsMain", m_bMain); m_eMainColor = (ECharactorMainColor)GetElementValue(sTextToParse, "MainColor", m_eMainColor); m_eSubColor = (ECharactorSubColor)GetElementValue(sTextToParse, "SubColor", m_eSubColor); if (m_bMain) { m_sElementName = string.Format("M{0}", (int)m_eMainColor + 1); } else { m_sElementName = string.Format("S{0}", (int)m_eSubColor + 1); } }
public void Randomize(ECharactorAttackType eCharactorAttack, ECharactorMoveType eMove, EHumanoidType eGendle, ECharactorSubColor subC, bool bFix = false) { m_eAttackType = eCharactorAttack; m_eMoveType = eMove; m_eCharactorType = ECharactorType.ECT_Humanoid; m_eHumanType = eGendle; m_eVisible = ECharactorVisible.ECV_None; m_eCamp = ECharactorCamp.ECC_Max; m_pAllShowModelRenderer = new List <MeshRenderer>(); m_pAllLODRenderer = new List <MeshRenderer>(); #region Decide components if (ECharactorMoveType.ECMT_Sky != eMove && Random.Range(0.0f, 1.0f) > 0.7f) { ShowWithIndex(m_pBacks[Random.Range(0, m_pBacks.Length)]); } if (ECharactorMoveType.ECMT_Sky == eMove) { ShowWithIndex(m_pWings[Random.Range(0, m_pWings.Length)], false); } if (eGendle == EHumanoidType.EHT_Female) { ShowWithIndex(m_pFemaleBody[Random.Range(0, m_pFemaleBody.Length)], false); ShowWithIndex(m_pFemaleFeet[Random.Range(0, m_pFemaleFeet.Length)]); ShowWithIndex(m_pFemaleHead[Random.Range(0, m_pFemaleHead.Length)], false); } else { ShowWithIndex(m_pMaleBody[Random.Range(0, m_pMaleBody.Length)], false); ShowWithIndex(m_pMaleFeet[Random.Range(0, m_pMaleFeet.Length)]); ShowWithIndex(m_pMaleHead[Random.Range(0, m_pMaleHead.Length)], false); } #region Decide weapon List <EHumanoidWeapon> weapons = new List <EHumanoidWeapon>(); switch (eCharactorAttack) { case ECharactorAttackType.ECAT_Mele: weapons.Add(EHumanoidWeapon.EHT_SingleHand_Fight); weapons.Add(EHumanoidWeapon.EHT_DoubleHand_Fight); break; case ECharactorAttackType.ECAT_Range: weapons.Add(EHumanoidWeapon.EHT_Shoot); break; case ECharactorAttackType.ECAT_Wizard: weapons.Add(EHumanoidWeapon.EHT_SingleHand_Wizard); weapons.Add(EHumanoidWeapon.EHT_DoubleHand_Wizard); weapons.Add(EHumanoidWeapon.EHW_BareHand); break; } m_eHumanWeapon = weapons[Random.Range(0, weapons.Count)]; bool bDoubleHandSWeapon = false; switch (m_eHumanWeapon) { case EHumanoidWeapon.EHW_BareHand: ShowWithIndex(m_pHands[Random.Range(0, m_pHands.Length)]); break; case EHumanoidWeapon.EHT_Shoot: ShowWithIndex(m_pAllPosibleShoot[Random.Range(0, m_pAllPosibleShoot.Length)]); break; case EHumanoidWeapon.EHT_SingleHand_Wizard: if (2 == ShowWithIndex(m_pAllPosibleSHandCombineWizard[Random.Range(0, m_pAllPosibleSHandCombineWizard.Length)])) { bDoubleHandSWeapon = true; } break; case EHumanoidWeapon.EHT_SingleHand_Fight: if (2 == ShowWithIndex(m_pAllPosibleSHandCombineFight[Random.Range(0, m_pAllPosibleSHandCombineFight.Length)])) { bDoubleHandSWeapon = true; } break; case EHumanoidWeapon.EHT_DoubleHand_Fight: ShowWithIndex(m_pAllPosibleDHandCombineFight[Random.Range(0, m_pAllPosibleDHandCombineFight.Length)]); break; case EHumanoidWeapon.EHT_DoubleHand_Wizard: ShowWithIndex(m_pAllPosibleDHandCombineWizard[Random.Range(0, m_pAllPosibleDHandCombineWizard.Length)]); break; } m_pCurrentBoltPos = m_pBoltPos[(int)m_eHumanWeapon]; m_pCurrentBoltPos.SetActive(true); #endregion for (int i = 0; i < m_pBloodLineFront.Length; ++i) { m_pBloodLineFront[i].SetActive(true); if (7 != i) { m_pBloodLineFront[i].GetComponent <MeshRenderer>().enabled = false; } m_pAllShowModelRenderer.Add(m_pBloodLineFront[i].GetComponent <MeshRenderer>()); } m_pShadow.SetActive(true); m_pAllShowModelRenderer.Add(m_pShadow.GetComponent <MeshRenderer>()); #endregion #region Size List <EHumanoidSize> sizes = new List <EHumanoidSize>(); sizes.Add(EHumanoidSize.EHS_Normal); sizes.Add(EHumanoidSize.EHS_Normal); sizes.Add(EHumanoidSize.EHS_Normal); sizes.Add(EHumanoidSize.EHS_Big); sizes.Add(EHumanoidSize.EHS_Small); sizes.Add(EHumanoidSize.EHS_Fat); sizes.Add(EHumanoidSize.EHS_ThinTall); SetHumanSize(sizes[Random.Range(0, sizes.Count)]); #endregion #region Animations m_pAnim.m_sAnimList = new string[(int)EAnimationType.EAT_Max]; if (ECharactorMoveType.ECMT_Sky == m_eMoveType) { m_pAnim.m_sAnimList[(int)EAnimationType.EAT_Born] = "FBorn"; m_pAnim.m_sAnimList[(int)EAnimationType.EAT_Die] = "FDie"; m_pAnim.m_sAnimList[(int)EAnimationType.EAT_KnockDown] = "FDie"; m_pAnim.m_sAnimList[(int)EAnimationType.EAT_Dash] = "FRun"; m_pAnim.m_sAnimList[(int)EAnimationType.EAT_Idle] = "FIdle"; m_pAnim.m_sAnimList[(int)EAnimationType.EAT_Run] = "FRun"; m_pAnim.m_sAnimList[(int)EAnimationType.EAT_Attack] = EHumanoidWeapon.EHT_Shoot == m_eHumanWeapon ? "FAttack_Shoot" : "FAttack"; m_pAnim.m_sAnimList[(int)EAnimationType.EAT_Skill] = EHumanoidWeapon.EHT_Shoot == m_eHumanWeapon ? "FAttack_Shoot" : "FAttack"; m_pAnim.m_sAnimList[(int)EAnimationType.EAT_SkillHold] = EHumanoidWeapon.EHT_Shoot == m_eHumanWeapon ? "FSkill_Shoot" : "FSkill_Hold"; } else { m_pAnim.m_sAnimList[(int)EAnimationType.EAT_Born] = "GBorn"; m_pAnim.m_sAnimList[(int)EAnimationType.EAT_Die] = "GDie"; m_pAnim.m_sAnimList[(int)EAnimationType.EAT_KnockDown] = "GKnock"; m_pAnim.m_sAnimList[(int)EAnimationType.EAT_Dash] = "GDash"; m_pAnim.m_sAnimList[(int)EAnimationType.EAT_Idle] = (EHumanoidWeapon.EHT_DoubleHand_Fight == m_eHumanWeapon || EHumanoidWeapon.EHT_DoubleHand_Wizard == m_eHumanWeapon) ? "GIdle_DHand": "GIdle"; m_pAnim.m_sAnimList[(int)EAnimationType.EAT_Run] = (EHumanoidWeapon.EHT_DoubleHand_Fight == m_eHumanWeapon || EHumanoidWeapon.EHT_DoubleHand_Wizard == m_eHumanWeapon) ? "GRun_DHand" : ((EHumanoidWeapon.EHT_Shoot == m_eHumanWeapon || bDoubleHandSWeapon) ? "GRun_SHand" : "GRun"); m_pAnim.m_sAnimList[(int)EAnimationType.EAT_Attack] = (EHumanoidWeapon.EHT_DoubleHand_Fight == m_eHumanWeapon || EHumanoidWeapon.EHT_DoubleHand_Wizard == m_eHumanWeapon) ? "GAttack_DHand" : (EHumanoidWeapon.EHT_Shoot == m_eHumanWeapon ? "GAttack_Shoot" : "GAttack"); if (EHumanoidWeapon.EHT_DoubleHand_Wizard == m_eHumanWeapon) { m_pAnim.m_sAnimList[(int)EAnimationType.EAT_Skill] = "GSkill_DHand1"; } else if (EHumanoidWeapon.EHT_DoubleHand_Fight == m_eHumanWeapon) { m_pAnim.m_sAnimList[(int)EAnimationType.EAT_Skill] = "GSkill_DHand2"; } else if (EHumanoidWeapon.EHT_Shoot == m_eHumanWeapon) { m_pAnim.m_sAnimList[(int)EAnimationType.EAT_Skill] = "GAttack_Shoot"; } else if (bDoubleHandSWeapon) { m_pAnim.m_sAnimList[(int)EAnimationType.EAT_Skill] = "GSkill_SHand"; } else { m_pAnim.m_sAnimList[(int)EAnimationType.EAT_Skill] = "GAttack"; } m_pAnim.m_sAnimList[(int)EAnimationType.EAT_SkillHold] = EHumanoidWeapon.EHT_Shoot == m_eHumanWeapon ? "GSkill_Shoot" : "GSkill_Hold"; } #endregion #region Load MeshFilters List <MeshFilter> filters = new List <MeshFilter>(); foreach (MeshRenderer renderers in m_pAllShowModelRenderer) { filters.Add(renderers.gameObject.GetComponent <MeshFilter>()); } m_pAllVisibleFilters = filters.ToArray(); m_pAllVisibleMeshes = new Mesh[m_pAllVisibleFilters.Length, (int)ECharactorMainColor.ECMC_Max * 2]; for (int i = 0; i < m_pAllVisibleFilters.Length; ++i) { for (int j = 0; j < (int)ECharactorMainColor.ECMC_Max * 2; ++j) { string sName = string.Format("CharMesh/M{0}S{1}/{2}", j % (int)(ECharactorMainColor.ECMC_Max), j < (int)(ECharactorMainColor.ECMC_Max) ? (int)subC : (int)ECharactorSubColor.ECSC_Max, m_pAllVisibleFilters[i].sharedMesh.name); m_pAllVisibleMeshes[i, j] = ResourcesManager.Load <Mesh>(sName); } } #endregion m_bFixed = bFix; }