예제 #1
0
    /// <summary>
    /// 界面重写
    /// </summary>
    public override void OnInspectorGUI()
    {
        base.OnInspectorGUI();

        mASD  = target as NFAnimatStateController;
        mData = mASD.mxSkillData;

        if (mData)
        {
            if (GUILayout.Button("Fix All anims"))
            {
                FixAllAnims();
            }

            mData.DefaultAnimationType = (NFAnimaStateType)EditorGUILayout.EnumPopup("DefaultAnima:", mData.DefaultAnimationType);


            DrawVirtualPoint();
            DrawAnimation();
        }
        else
        {
            EditorGUILayout.HelpBox("Please specify a \"AnimationSkillData\" data .", MessageType.Error);
        }

        EditorUtility.SetDirty(mASD);
        if (mData != null)
        {
            EditorUtility.SetDirty(mData);
        }
    }
예제 #2
0
    public override void Enter(GameObject gameObject, int index)
    {
        xBodyIdent = gameObject.GetComponent <NFBodyIdent>();
        xInput     = gameObject.GetComponent <NFHeroInput>();
        xHeroAnima = gameObject.GetComponent <NFAnimatStateController>();
        xHeroMotor = gameObject.GetComponent <NFHeroMotor>();


        base.Enter(gameObject, index);
    }
예제 #3
0
    public override void Enter(GameObject gameObject, int index)
    {
        xBodyIdent = gameObject.GetComponent <NFBodyIdent> ();
        xHeroAnima = gameObject.GetComponent <NFAnimatStateController> ();
        xHeroMotor = gameObject.GetComponent <NFHeroMotor> ();

        base.Enter(gameObject, index);

        xHeroMotor.speed = xHeroMotor.runSpeed;
        standCount       = 0;
    }
예제 #4
0
    void Start()
    {
        mAnimatStateController = GetComponent <NFAnimatStateController>();
        xHeroMotor             = GetComponent <NFHeroMotor>();

        mAnimatStateController.GetAnimationEvent().AddOnDamageDelegation(OnDamageDelegation);
        mAnimatStateController.GetAnimationEvent().AddOnEndAnimaDelegation(OnEndAnimaDelegation);
        mAnimatStateController.GetAnimationEvent().AddOnStartAnimaDelegation(OnStartAnimaDelegation);
        mAnimatStateController.GetAnimationEvent().AddBulletTouchPosDelegation(OnBulletTouchPositionDelegation);
        mAnimatStateController.GetAnimationEvent().AddBulletTouchTargetDelegation(OnBulletTouchTargetDelegation);
    }
예제 #5
0
    private void Start()
    {
        mxHeroMotor            = GetComponent <NFHeroMotor>();
        mxSyncBuffer           = GetComponent <NFHeroSyncBuffer>();
        mxBodyIdent            = GetComponent <NFBodyIdent>();
        mAnimaStateMachine     = GetComponent <NFAnimaStateMachine>();
        mAnimatStateController = GetComponent <NFAnimatStateController>();

        mxNetModule  = NFRoot.Instance().GetPluginManager().FindModule <NFNetModule>();
        mLoginModule = NFRoot.Instance().GetPluginManager().FindModule <NFLoginModule>();
        mHelpModule  = NFRoot.Instance().GetPluginManager().FindModule <NFHelpModule>();
    }
예제 #6
0
    void Start()
    {
        mAnima             = GetComponent <NFAnimatStateController>();
        mBodyIdent         = GetComponent <NFBodyIdent>();
        mAnimaStateMachine = GetComponent <NFAnimaStateMachine>();
        mHeroInput         = GetComponent <NFHeroInput>();
        mHeroSync          = GetComponent <NFHeroSync>();

        mxGUID        = mBodyIdent.GetObjectID();
        moveDirection = new Vector3();

        mKernelModule.RegisterPropertyCallback(mxGUID, NFrame.Player.MOVE_SPEED, PropertyEventHandler);
    }
예제 #7
0
    public override void Enter(GameObject gameObject, int index)
    {
        xBodyIdent = gameObject.GetComponent <NFBodyIdent>();
        xInput     = gameObject.GetComponent <NFHeroInput>();
        xHeroAnima = gameObject.GetComponent <NFAnimatStateController>();
        xHeroMotor = gameObject.GetComponent <NFHeroMotor>();

        mCharacterMovement = gameObject.GetComponent <CharacterMovement>();

        base.Enter(gameObject, index);

        Vector3 v = new Vector3(gameObject.transform.position.x, mCharacterMovement.groundHit.groundPoint.y, gameObject.transform.position.z);

        gameObject.transform.position = v;
    }
예제 #8
0
    //=================================================================================================================o
    public override void Awake()
    {
        base.Awake();
        _walkSpeed   = 1.5f;
        angularSpeed = 0f;

        mKernelModule = NFPluginManager.Instance().FindModule <NFIKernelModule>();

        mSceneModule = NFPluginManager.Instance().FindModule <NFSceneModule>();
        mLoginModule = NFPluginManager.Instance().FindModule <NFLoginModule>();
        mNetModule   = NFPluginManager.Instance().FindModule <NFNetModule>();

        mUIModule = NFPluginManager.Instance().FindModule <NFUIModule>();

        mAnima = GetComponent <NFAnimatStateController>();
    }
예제 #9
0
    void Start()
    {
        mStateMachineMng       = GetComponent <NFAnimaStateMachine>();
        mAnimatStateController = GetComponent <NFAnimatStateController>();
        mBodyIdent             = GetComponent <NFBodyIdent>();
        mHeroMotor             = GetComponent <NFHeroMotor>();

        mUIModule    = NFRoot.Instance().GetPluginManager().FindModule <NFUIModule>();
        mLoginModule = NFRoot.Instance().GetPluginManager().FindModule <NFLoginModule>();

        mKernelModule = NFRoot.Instance().GetPluginManager().FindModule <NFIKernelModule>();

        mKernelModule.RegisterPropertyCallback(mBodyIdent.GetObjectID(), NFrame.Player.MOVE_SPEED, PropertyMoveSpeedHandler);
        mKernelModule.RegisterPropertyCallback(mBodyIdent.GetObjectID(), NFrame.Player.ATK_SPEED, PropertyAttackSpeedHandler);

        mHeroMotor.angularSpeed = 0f;
    }
예제 #10
0
    public NFIState(GameObject gameObject, NFAnimaStateType eState, NFAnimaStateMachine xStateMachine, float fHeartBeatTime, float fExitTime, bool input)
    {
        mGameObject     = gameObject;
        meState         = eState;
        mfExitTime      = fExitTime;
        mfHeartBeatTime = fHeartBeatTime;
        mStateMachine   = xStateMachine;

        mfEnterTime = Time.time;
        mbInput     = input;

        mAnimatStateController = gameObject.GetComponent <NFAnimatStateController>();
        mRenderObject          = gameObject.GetComponent <NFBodyIdent>().xRenderObject.gameObject;

        mHeroMotor = gameObject.GetComponent <NFHeroMotor>();
        mHeroInput = gameObject.GetComponent <NFHeroInput>();
    }
예제 #11
0
        public void InitPlayerComponent(NFGUID xID, GameObject self, bool bMainRole)
        {
            if (null == self)
            {
                return;
            }

            if (!self.GetComponent <Rigidbody>())
            {
                self.AddComponent <Rigidbody>();
            }

            if (!self.GetComponent <NFHeroSyncBuffer>())
            {
                self.AddComponent <NFHeroSyncBuffer>();
            }

            if (!self.GetComponent <NFHeroSync>())
            {
                self.AddComponent <NFHeroSync>();
            }


            NFHeroInput xInput = self.GetComponent <NFHeroInput>();

            if (!xInput)
            {
                xInput = self.AddComponent <NFHeroInput>();
            }

            if (bMainRole)
            {
                xInput.enabled = true;
                xInput.SetInputEnable(true);
            }
            else
            {
                xInput.enabled = false;
                xInput.SetInputEnable(false);
            }

            if (!self.GetComponent <GroundDetection>())
            {
                GroundDetection groundDetection = self.AddComponent <GroundDetection>();
                groundDetection.enabled    = true;
                groundDetection.groundMask = -1;
            }

            if (!self.GetComponent <CharacterMovement>())
            {
                CharacterMovement characterMovement = self.AddComponent <CharacterMovement>();
                characterMovement.enabled = true;
            }

            if (!self.GetComponent <NFHeroMotor>())
            {
                NFHeroMotor xHeroMotor = self.AddComponent <NFHeroMotor>();
                xHeroMotor.enabled = true;
            }

            if (!self.GetComponent <NFAnimatStateController>())
            {
                NFAnimatStateController xHeroAnima = self.AddComponent <NFAnimatStateController>();
                xHeroAnima.enabled = true;
            }


            if (!self.GetComponent <NFAnimaStateMachine>())
            {
                NFAnimaStateMachine xHeroAnima = self.AddComponent <NFAnimaStateMachine>();
                xHeroAnima.enabled = true;
            }

            if (bMainRole)
            {
                CapsuleCollider xHeroCapsuleCollider = self.GetComponent <CapsuleCollider>();
                xHeroCapsuleCollider.isTrigger = false;
            }
            else
            {
                CapsuleCollider xHeroCapsuleCollider = self.GetComponent <CapsuleCollider>();
                Rigidbody       rigidbody            = self.GetComponent <Rigidbody>();

                string         configID = mKernelModule.QueryPropertyString(xID, NFrame.IObject.ConfigID);
                NFMsg.ENPCType npcType  = (NFMsg.ENPCType)mElementModule.QueryPropertyInt(configID, NFrame.NPC.NPCType);
                //NFMsg.esub npcSubType = (NFMsg.ENPCType)mElementModule.QueryPropertyInt(configID, NFrame.NPC.NPCSubType);
                if (npcType == NFMsg.ENPCType.TurretNpc)
                {
                    //is trigger must false if it is a building
                    // and the kinematic must true
                    xHeroCapsuleCollider.isTrigger = false;
                    //rigidbody.isKinematic = true;
                    //rigidbody.useGravity = true;
                    rigidbody.mass = 10000;
                }
                else
                {
                    xHeroCapsuleCollider.isTrigger = true;
                }

                /*
                 * if (mKernelModule.QueryPropertyObject(xID, NFrame.NPC.MasterID) == mLoginModule.mRoleID)
                 * {
                 *  //your building or your clan member building
                 *  if (!self.GetComponent<FogCharacter>())
                 *  {
                 *      FogCharacter fogCharacter = self.AddComponent<FogCharacter>();
                 *      fogCharacter.enabled = true;
                 *      fogCharacter.radius = 8;
                 *  }
                 * }
                 * else
                 * {
                 *  if (!self.GetComponent<FogAgent>())
                 *  {
                 *      FogAgent fogAgent = self.AddComponent<FogAgent>();
                 *      fogAgent.enabled = true;
                 *  }
                 * }
                 */
            }
        }
예제 #12
0
        public void InitPlayerComponent(NFGUID xID, GameObject self, bool bMainRole)
        {
            if (null == self)
            {
                return;
            }

            if (!self.GetComponent <Rigidbody>())
            {
                self.AddComponent <Rigidbody>();
            }

            if (!self.GetComponent <NFHeroSyncBuffer>())
            {
                self.AddComponent <NFHeroSyncBuffer>();
            }

            if (!self.GetComponent <NFHeroSync>())
            {
                self.AddComponent <NFHeroSync>();
            }

            NFHeroInput xInput = self.GetComponent <NFHeroInput>();

            if (!xInput)
            {
                xInput = self.AddComponent <NFHeroInput>();
            }

            if (bMainRole)
            {
                xInput.enabled = true;
                xInput.SetInputEnable(true);
            }
            else
            {
                xInput.enabled = false;
                xInput.SetInputEnable(false);
            }

            if (!self.GetComponent <GroundDetection>())
            {
                GroundDetection groundDetection = self.AddComponent <GroundDetection>();
                groundDetection.enabled    = true;
                groundDetection.groundMask = -1;
            }

            if (!self.GetComponent <CharacterMovement>())
            {
                CharacterMovement characterMovement = self.AddComponent <CharacterMovement>();
                characterMovement.enabled = true;
            }

            if (!self.GetComponent <NFHeroMotor>())
            {
                NFHeroMotor xHeroMotor = self.AddComponent <NFHeroMotor>();
                xHeroMotor.enabled = true;
            }

            if (!self.GetComponent <NFAnimatStateController>())
            {
                NFAnimatStateController xHeroAnima = self.AddComponent <NFAnimatStateController>();
                xHeroAnima.enabled = true;
            }

            if (!self.GetComponent <NFAnimaStateMachine>())
            {
                NFAnimaStateMachine xHeroAnima = self.AddComponent <NFAnimaStateMachine>();
                xHeroAnima.enabled = true;
            }

            if (bMainRole)
            {
                if (Camera.main)
                {
                    NFHeroCameraFollow xHeroCameraFollow = Camera.main.GetComponent <NFHeroCameraFollow>();
                    if (!xHeroCameraFollow)
                    {
                        xHeroCameraFollow = Camera.main.GetComponentInParent <NFHeroCameraFollow>();
                    }

                    xHeroCameraFollow.target = self.transform;
                }


                CapsuleCollider xHeroCapsuleCollider = self.GetComponent <CapsuleCollider>();
                xHeroCapsuleCollider.isTrigger = false;
            }
            else
            {
                CapsuleCollider xHeroCapsuleCollider = self.GetComponent <CapsuleCollider>();
                Rigidbody       rigidbody            = self.GetComponent <Rigidbody>();

                string         configID = mKernelModule.QueryPropertyString(xID, NFrame.IObject.ConfigID);
                NFMsg.ENPCType npcType  = (NFMsg.ENPCType)mElementModule.QueryPropertyInt(configID, NFrame.NPC.NPCType);
                //NFMsg.esub npcSubType = (NFMsg.ENPCType)mElementModule.QueryPropertyInt(configID, NFrame.NPC.NPCSubType);
                if (npcType == NFMsg.ENPCType.TurretNpc)
                {
                    //is trigger must false if it is a building
                    // and the kinematic must true
                    xHeroCapsuleCollider.isTrigger = false;
                    //rigidbody.isKinematic = true;
                    //rigidbody.useGravity = true;
                    rigidbody.mass = 10000;
                }
                else
                {
                    xHeroCapsuleCollider.isTrigger = true;
                }
            }
        }