public void PlayerStateChanged(E_AvatarMotionState motionState) { AvatarMotion = motionState; if (!_artAnimatorManager) { return; } if (motionState == E_AvatarMotionState.AM_IDLE) { _artAnimatorManager.Move(false); } else if (motionState == E_AvatarMotionState.AM_MOVE) { _artAnimatorManager.Move(true); } else if (motionState == E_AvatarMotionState.AM_MOVEJUMP) { _artAnimatorManager.Move(true); _artAnimatorManager.Jump(); SimulateJump(); } else if (motionState == E_AvatarMotionState.AM_JUMP) { _artAnimatorManager.Jump(); SimulateJump(); } //SendEvent(); }
public void Jump(bool flag = true) { // Debug.Log("jump:::" + flag); if (flag) { if (AvatarMotion == E_AvatarMotionState.AM_MOVE || AvatarMotion == E_AvatarMotionState.AM_MOVEJUMP) { PlayerStateChanged(E_AvatarMotionState.AM_MOVEJUMP); } else { PlayerStateChanged(E_AvatarMotionState.AM_JUMP); } } else { if (AvatarMotion == E_AvatarMotionState.AM_MOVEJUMP) { AvatarMotion = E_AvatarMotionState.AM_MOVE; } else { PlayerStateChanged(E_AvatarMotionState.AM_IDLE); // AvatarMotion = E_AvatarMotionState.AM_IDLE; } } _jumpFlag = flag; }
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); // } } }