コード例 #1
0
    public void Stop()
    {
        bool b = false;

        moveDirection = Vector3.zero;
        moveToPos     = Vector3.zero;
        if (meetGoalCasllBack != null)
        {
            b = meetGoalCasllBack();
        }

        if (!b)
        {
            mAnima.PlayAnimaState(NFAnimaStateType.Idle, -1);
        }
    }
コード例 #2
0
    private void Update()
    {
        if (mxBodyIdent && mxBodyIdent.GetObjectID() != mLoginModule.mRoleID)
        {
            NFHeroSyncBuffer.Keyframe keyframe = mxSyncBuffer.NextKeyframe();
            if (keyframe != null)
            {
                NFAnimaStateType type = (NFrame.NFAnimaStateType)keyframe.status;
                switch (type)
                {
                case NFAnimaStateType.Run:
                case NFAnimaStateType.Idle:
                    if (keyframe.Position != Vector3.zero)
                    {
                        mxHeroMotor.MoveTo(keyframe.Position, MeetGoalCallBack);
                    }
                    break;

                case NFAnimaStateType.Stun:
                    mAnimatStateController.PlayAnimaState(NFAnimaStateType.Stun, 0);
                    break;

                default:
                    break;
                }
            }
        }
    }
コード例 #3
0
    public virtual void Enter(GameObject gameObject, int index)
    {
        mAnimatStateController.PlayAnimaState(meState, index);
        mHeroInput.SetInputEnable(mbInput);

        //Debug.Log(Time.time + "------- Enter PlayAnimaState " + meState);


        /*
         *      //Debug.Log("------------" + GetStateMachine().GetMachineType().ToString() + "  " + meState.ToString() + " Enter " + gameObject.transform.position.x + "," + gameObject.transform.position.y);
         *
         * mfEnterTime = Time.time;
         *
         * //xHeroAnima.SetState(meState);
         */
    }
コード例 #4
0
ファイル: NFHeroSync.cs プロジェクト: MrSevenCheng/NFUnitySDK
    private void FixedUpdate()
    {
        if (mxBodyIdent && mxBodyIdent.GetObjectID() != mLoginModule.mRoleID)
        {
            NFHeroSyncBuffer.Keyframe keyframe;
            if (mxSyncBuffer.Size() > 1)
            {
                keyframe = mxSyncBuffer.LastKeyframe();
                mxHeroMotor.walkSpeed *= mxSyncBuffer.Size();
                mxHeroMotor.runSpeed  *= mxSyncBuffer.Size();
            }
            else
            {
                keyframe = mxSyncBuffer.NextKeyframe();
                mxHeroMotor.walkSpeed = mKernelModule.QueryPropertyInt(mLoginModule.mRoleID, NFrame.Player.MOVE_SPEED) / 100;
                mxHeroMotor.runSpeed  = mKernelModule.QueryPropertyInt(mLoginModule.mRoleID, NFrame.Player.MOVE_SPEED) / 100;
            }

            if (keyframe != null)
            {
                NFAnimaStateType type = (NFrame.NFAnimaStateType)keyframe.status;
                switch (type)
                {
                case NFAnimaStateType.Run:
                case NFAnimaStateType.Idle:
                    if (keyframe.Position != Vector3.zero)
                    {
                        mxHeroMotor.MoveTo(keyframe.Position, true, MeetGoalCallBack);
                    }
                    break;

                case NFAnimaStateType.Stun:
                    mAnimatStateController.PlayAnimaState(NFAnimaStateType.Stun, 0);
                    break;

                default:
                    break;
                }
            }
        }
    }
コード例 #5
0
ファイル: NFHeroMotor.cs プロジェクト: sl-sandy/NFUnitySDK
 public void Stop()
 {
     moveDirection = Vector3.zero;
     moveToPos     = Vector3.zero;
     mAnima.PlayAnimaState(NFAnimaStateType.Idle, -1);
 }
コード例 #6
0
    private void FixedUpdate()
    {
        ReportPos();

        if (mxBodyIdent && mxBodyIdent.GetObjectID() != mLoginModule.mRoleID)
        {
            NFHeroSyncBuffer.Keyframe keyframe;
            if (mxSyncBuffer.Size() > 1)
            {
                keyframe = mxSyncBuffer.LastKeyframe();
            }
            else
            {
                keyframe = mxSyncBuffer.NextKeyframe();
            }

            if (keyframe != null)
            {
                mxHeroMotor.walkSpeed = moveSpeed;
                mxHeroMotor.runSpeed  = moveSpeed;

                float dis = Vector3.Distance(keyframe.Position, mxHeroMotor.transform.position);
                if (dis > 1f)
                {
                    mxHeroMotor.walkSpeed = dis / SYNC_TIME;
                    mxHeroMotor.runSpeed  = dis / SYNC_TIME;
                }

                lastInterpolationTime = keyframe.InterpolationTime;


                NFAnimaStateType stateType = (NFrame.NFAnimaStateType)keyframe.status;
                switch (stateType)
                {
                case NFAnimaStateType.Run:
                    if (keyframe.Position != Vector3.zero)
                    {
                        mxHeroMotor.MoveTo(keyframe.Position, true, MeetGoalCallBack);
                    }
                    break;

                case NFAnimaStateType.Idle:
                    if (UnityEngine.Vector3.Distance(keyframe.Position, mxHeroMotor.transform.position) > 0.1f)
                    {
                        mxHeroMotor.MoveTo(keyframe.Position, true, MeetGoalCallBack);
                    }
                    else
                    {
                        mxHeroMotor.Stop();
                    }
                    break;

                case NFAnimaStateType.Stun:
                    mAnimatStateController.PlayAnimaState(NFAnimaStateType.Stun, 0);
                    break;

                case NFAnimaStateType.NONE:
                    mxHeroMotor.transform.position = keyframe.Position;
                    break;

                default:
                    break;
                }
            }
        }
    }
コード例 #7
0
    void DrawAnimation()
    {
        if (mData.AnimationSkillList == null)
        {
            return;
        }

        for (int i = 0; i < mData.AnimationSkillList.Count; i++)
        {
            EditorGUILayout.Space();

            AnimationSkillStruct _ass = mData.AnimationSkillList[i];

            if (_ass.IsFoldout)
            {
                EditorGUILayout.BeginVertical(EditorStyles.helpBox);

                EditorGUILayout.LabelField(_ass.Type.ToString());
                if (GUILayout.Button("Preview"))
                {
                    mASD.PlayAnimaState(_ass.Type);
                }

                _ass.AnimationClip = (AnimationClip)EditorGUILayout.ObjectField("AnimaitonClip:", _ass.AnimationClip, typeof(AnimationClip), true);

                EditorGUILayout.BeginHorizontal();
                if (_ass.AnimationClip == null)
                {
                    _ass.fTime = 1f;
                }
                else
                {
                    _ass.fTime = _ass.AnimationClip.length;
                }
                EditorGUILayout.LabelField("NextAnima After:", _ass.fTime.ToString());
                _ass.NextType = (NFAnimaStateType)EditorGUILayout.EnumPopup(_ass.NextType);

                EditorGUILayout.EndHorizontal();

                AnimatorController ctl = (AnimatorController)mASD.GetComponent <Animator> ().runtimeAnimatorController;
                if (ctl != null)
                {
                    AnimatorStateMachine state_machine = ctl.layers[0].stateMachine;
                    for (int j = 0; j < state_machine.states.Length; ++j)
                    {
                        if (state_machine.states [j].state.name == _ass.Type.ToString())
                        {
                            String        strPath = AssetDatabase.GetAssetPath(_ass.AnimationClip);
                            AnimationClip anim    = AssetDatabase.LoadAssetAtPath(strPath, typeof(AnimationClip)) as AnimationClip;
                            state_machine.states [j].state.motion = anim;
                            break;
                        }
                    }
                }

                mData.AnimationSkillList[i] = _ass;

                //添加特效与删除片断
                EditorGUILayout.BeginHorizontal();
                if (GUILayout.Button("ADD EFFECT"))
                {
                    EffectStruct _es = new EffectStruct();
                    _es.LifeTime  = 3;
                    _es.isFoldout = true;
                    mData.AnimationSkillList[i].EffectStructList.Add(_es);
                }
                if (GUILayout.Button("ADD Audio"))
                {
                    AudioStruct _es = new AudioStruct();
                    _es.LifeTime  = 3;
                    _es.isFoldout = true;
                    mData.AnimationSkillList[i].AudioStructList.Add(_es);
                }
                if (GUILayout.Button("ADD Bullet"))
                {
                    BulletStruct _es = new BulletStruct();
                    _es.isFoldout = true;
                    mData.AnimationSkillList[i].BulletStructList.Add(_es);
                }



                EditorGUILayout.EndHorizontal();

                EditorGUILayout.BeginHorizontal();
                if (GUILayout.Button("ADD Damage"))
                {
                    DamageStruct _es = new DamageStruct();
                    _es.isFoldout = true;
                    mData.AnimationSkillList[i].DamageStructList.Add(_es);
                }

                if (GUILayout.Button("ADD Movement"))
                {
                    MovementStruct _es = new MovementStruct();
                    _es.isFoldout = true;
                    mData.AnimationSkillList[i].MovementStructList.Add(_es);
                }

                if (GUILayout.Button("ADD Camera"))
                {
                    CameraStruct _es = new CameraStruct();
                    _es.isFoldout = true;
                    mData.AnimationSkillList[i].CameraStructList.Add(_es);
                }

                EditorGUILayout.EndHorizontal();

                if (mData.AnimationSkillList.Count > 0)
                {
                    DrawEffect(i);
                    DrawAudio(i);
                    DrawMovement(i);
                    DrawDamage(i);
                    DrawBullet(i);
                    DrawCamera(i);
                }
                EditorGUILayout.EndVertical();
            }
        }
    }