public void PlayerStateChanged(E_AvatarForm formState) { AvatarForm = formState; if (_artAnimatorManager) { _artAnimatorManager.ChangeModelState(formState); } // SendEvent(); }
/// <summary> /// 玩家模型改变 /// </summary> /// <param name="form"></param> public void ChangeMeshRenderForm(E_AvatarForm form) { if (form == _beforeAvatarForm) { return; } PlayerStateChanged(form); //人型状态 //string formName = ""; string curFormName = ""; string otherFormName = ""; string other1FormName = ""; if (AvatarForm == E_AvatarForm.PERSON_STATE) { curFormName = PlayerCommonName.PersonModelName; otherFormName = PlayerCommonName.FishModelName; other1FormName = PlayerCommonName.FishDiveModelName; } else if (AvatarForm == E_AvatarForm.INKFISH_STATE) { curFormName = PlayerCommonName.FishModelName; otherFormName = PlayerCommonName.PersonModelName; other1FormName = PlayerCommonName.FishDiveModelName; } else if (AvatarForm == E_AvatarForm.INKFISHDIVE_STATE) { curFormName = PlayerCommonName.FishDiveModelName; otherFormName = PlayerCommonName.PersonModelName; other1FormName = PlayerCommonName.FishModelName; } _childObj.Find(curFormName).gameObject.SetActive(true); _childObj.Find(otherFormName).gameObject.SetActive(false); _childObj.Find(other1FormName).gameObject.SetActive(false); //if (_beforeAvatarForm == E_AvatarForm.PERSON_STATE) //{ // formName = PlayerCommonName.PersonModelName; //} //else if (_beforeAvatarForm == E_AvatarForm.INKFISH_STATE) //{ // formName = PlayerCommonName.FishModelName; //} //else if (_beforeAvatarForm == E_AvatarForm.INKFISHDIVE_STATE) //{ // formName = PlayerCommonName.FishDiveModelName; //} //_childObj.Find(formName).gameObject.SetActive(false); _beforeAvatarForm = AvatarForm; }
public void Init() { AvatarState = E_AvatarState.AS_ALIVE; AvatarMotion = E_AvatarMotionState.AM_IDLE; AvatarForm = E_AvatarForm.PERSON_STATE; _beforeAvatarForm = E_AvatarForm.PERSON_STATE; AvatarBehavior = E_AvatarBehavior.B_NONE; _motionStateCount = Enum.GetValues(typeof(E_AvatarMotionState)).Length; _childObj = gameObject.transform.Find(PlayerCommonName.ChildName); _ufpTransformObj = transform.GetComponent <U_FPTransform>(); _ufpTransformChildObj = _childObj.GetComponent <U_FPTransform>(); _characterMotionObj = transform.GetComponent <CharacterMotion>(); _hp = HpMax; AutoRenderSplatData(AvatarEntityId); Debug.Log("AvatarId::" + AvatarEntityId + " == > InitInitInitInitInitInitInitInitInitInit!!!"); }
/// <summary> /// 选择avatar的形态 /// PERSON_STATE = 1,INKFISH_STATE = 2,INKFISHDIVE_STATE = 3 /// </summary> /// <param name="form"></param> public void ChangeAvatarForm(E_AvatarForm form) { //1)如果要变化为乌贼下潜状态的话,需要看是否处于自身油漆中 PixelManager.E_InColorType colorType; bool Slope = false; if (!AcquireInkColorType(out colorType, out Slope)) { return; } //test...test ..// //colorType = PixelManager.E_InColorType.IC_SELF_COLOR; if (colorType != PixelManager.E_InColorType.IC_SELF_COLOR && form == E_AvatarForm.INKFISHDIVE_STATE) { return; } if (_sm) { _sm.SetParameter("AvatarForm", (int)form); } if (AvatarForm != form) { int DiveState = 0; E_AvatarMotionState state = AvatarMotion; if (form == E_AvatarForm.INKFISHDIVE_STATE && AvatarForm == E_AvatarForm.PERSON_STATE && AvatarMotion == E_AvatarMotionState.AM_IDLE)//变化Avatar角色变为乌贼下潜模式时,调用下潜动画 { DiveState = 1; } else if (AvatarForm == E_AvatarForm.INKFISHDIVE_STATE && form != E_AvatarForm.INKFISHDIVE_STATE) { //变化Avatar角色变为非乌贼下潜模式时,调用跃出动画 DiveState = 2; } if (DiveState == 1) { _artAnimatorManager.Dive(true); AvatarForm = form; Invoke("AvatarDiveorLeapInvoke", 0.25f); } else { PlayerStateChanged(form); ChangeMeshRenderForm(form); } //if (IsInvoking()) DiveState = 0; //if (0 == DiveState) //{ // PlayerStateChanged(form); // ChangeMeshRenderForm(form); //} //else //{ // DealAvatarDiveorLeap(form, state); // } } }