コード例 #1
0
    private void initTransform()
    {
        if (!BindConfig.bindTargetToSource && EntityFactory.EffectGroup != null)
        {
            behaviorTransformAgent.SetParent(EntityFactory.EffectGroup.transform);
        }

        UpdateBindBoneTransform();

        if (BindConfig.faceAganistTarget == true)
        {
            rotateAsTargetForward();
        }

        m_statemachine = null;
        if (EffectParam.srcObject && BindConfig.faceToWalkingDirection)
        {
            m_statemachine = EffectParam.srcObject.GetComponent <CreatureStateMachine>();
        }


        bindTransform();

        if (BindConfig.bProjectOnFloor)
        {
            behaviorTransformAgent.SetPosition(projectOnFloor(behaviorTransformAgent.position));
        }
    }
コード例 #2
0
        private void ApplyPersonSkinDataToMachine(CreatureStateMachine machine, SkinInstance instance)
        {
            PersonSkinConfig SkinConfig = instance.entitySkinConfig as PersonSkinConfig;

            if (null == SkinConfig)
            {
                Debug.LogError("切换皮肤重大错误-ApplyPersonSkinDataToMachine");
                return;
            }

            m_machine.animator = instance.MainAnimator;
            m_machine.animatorCtrl.weaponAnimator  = instance.weaponAnimator;
            m_machine.animatorCtrl.weaponAnimator2 = instance.weaponAnimator2;

            if (SkinConfig.AttackAnimatorLayer > 0)
            {
                m_machine.animatorCtrl.ana  = instance.MainAnimator;
                m_machine.animatorCtrl.anb  = instance.MainAnimator;
                m_machine.animatorCtrl.anc  = null;
                m_machine.moveAnimatorLayer = 0;
            }
            else
            {
                m_machine.animatorCtrl.anc = instance.bipedIKAnimator;
                m_machine.animatorCtrl.ana = instance.MainAnimator;
                m_machine.animatorCtrl.anb = instance.AnimatorB;
            }
            m_machine.attackAnimatorLayer = SkinConfig.AttackAnimatorLayer;
            instance.ReferencedSkinCtrl   = this;
        }
コード例 #3
0
 //开启狙击镜
 private void OpenSniperscope()
 {
     m_sniperscopreWeapon = null;
     if (EntityFactory.MainHeroView != null)
     {
         if (EntityFactory.MainHeroView.SkinControl != null)
         {
             if (EntityFactory.MainHeroView.SkinControl.CurrentSkinInstance != null)
             {
                 if (EntityFactory.MainHeroView.SkinControl.CurrentSkinInstance.entitySkinConfig != null)
                 {
                     if (EntityFactory.MainHeroView.SkinControl.CurrentSkinInstance.entitySkinConfig.RightWeaponRender != null)
                     {
                         EntityFactory.MainHeroView.SkinControl.CurrentSkinInstance.entitySkinConfig.RightWeaponRender.enabled = false;
                         CreatureStateMachine state = EntityFactory.MainHeroView.StateMachine as CreatureStateMachine;
                         if (state != null)
                         {
                             m_sniperscopreWeapon = state.SkinConfig.weaponObject;
                         }
                     }
                 }
             }
         }
     }
     if (soldierCam.mouseCtrl != null && soldierCam.mouseCtrl.RotateWithMouse != true)
     {
         soldierCam.mouseCtrl.RotateWithMouse = true;
         Cursor.lockState = CursorLockMode.Locked;
     }
     UISystem.Instance.SendWndMessage(
         WndMsgID.WND_MSG_SNIPERSCOPE_TOGGLEDISPLAY,
         new UIMsgCmdData((int)WndMsgID.WND_MSG_SNIPERSCOPE_TOGGLEDISPLAY,
                          Convert.ToInt32(true), string.Empty, IntPtr.Zero, 0));
 }
コード例 #4
0
 // 构造
 public CreatureState_WallWalking(CreatureStateMachine pFsm)
 {
     m_pFSM = pFsm;
     hashid_isWallWalking = Animator.StringToHash("isWallWalking");
     hashid_isUpWall      = Animator.StringToHash("isUpWall");
     hashid_isDownWall    = Animator.StringToHash("isDownWall");
 }
コード例 #5
0
ファイル: CreatureState_Jump.cs プロジェクト: zwong91/Titan
 // 构造
 public CreatureState_Jump(CreatureStateMachine pFsm)
 {
     m_pFSM             = pFsm;
     hashid_isMoving    = Animator.StringToHash("isMoving");
     hashid_moveright   = Animator.StringToHash("moveright");
     hashid_moveforward = Animator.StringToHash("moveforward");
     hashid_velocity    = Animator.StringToHash("velocity");
 }
コード例 #6
0
 // 构造
 public CreatureState_Floating(CreatureStateMachine pFsm)
 {
     m_pFSM = pFsm;
     //m_pFSM.controller = pFsm.GetComponent<CharacterController>();
     hashid_isMoving    = Animator.StringToHash("isMoving");
     hashid_moveright   = Animator.StringToHash("moveright");
     hashid_moveforward = Animator.StringToHash("moveforward");
     hashid_velocity    = Animator.StringToHash("velocity");
 }
コード例 #7
0
 public CreatureState_Glide(CreatureStateMachine pFsm)
 {
     m_pFSM           = pFsm;
     hashid_isMoving  = Animator.StringToHash("isMoving");
     hashid_isLanding = Animator.StringToHash("isLanding");
     hashid_Jumping   = Animator.StringToHash("Jumping");
     hashid_isGlide   = Animator.StringToHash("isGlide");
     hashid_FlyDown   = Animator.StringToHash("flyDown");
 }
コード例 #8
0
 public override void Init()
 {
     if (bInit)
     {
         return;
     }
     base.Init();
     m_machine = GetComponent <CreatureStateMachine>();
     bInit     = true;
 }
コード例 #9
0
        public void onWingClick()
        {
            if (!(EntityFactory.MainHeroView.StateMachine is CreatureStateMachine))
            {
                return;
            }

            CreatureStateMachine fsm = EntityFactory.MainHeroView.StateMachine as CreatureStateMachine;

            fsm.useWing();
        }
コード例 #10
0
        //public List<UWarExtraTest> TestObjects = new List<UWarExtraTest>();
        //public float FindDistance = 30f;
        //public List<UWarExtraTest> NearObjects = new List<UWarExtraTest>();
        //List<UWarExtraTest> aroundList = new List<UWarExtraTest>();

        //List<UWarExtraTest> attachList = new List<UWarExtraTest>();

        //public void TestFindNearObject()
        //{
        //    var myScreenPos = RectTransformUtility.WorldToScreenPoint(UISystem.Instance.GetCamera(), GetTransform().position);
        //    Vector2 rtScreenPos;
        //    List<UWarExtraTest> tmpList = new List<UWarExtraTest>(NearObjects);

        //    aroundList.Clear();
        //    foreach (var rt in TestObjects)
        //    {
        //        rtScreenPos = RectTransformUtility.WorldToScreenPoint(UISystem.Instance.GetCamera(), rt.GetRectTransform.position);
        //        if((myScreenPos - rtScreenPos).magnitude< FindDistance)
        //        {
        //            aroundList.Add(rt);
        //        }
        //    }
        //    if(aroundList.Count == 0)
        //    {
        //        return;
        //    }

        //    foreach(var rtt in aroundList)
        //    {
        //        if (!NearObjects.Contains(rtt))
        //            NearObjects.Add(rtt);
        //        else
        //            tmpList.Remove(rtt);
        //    }

        //    while (tmpList.Count > 0)
        //    {
        //        var tmprt = tmpList[0];
        //        NearObjects.Remove(tmprt);

        //        tmpList.RemoveAt(0);
        //    }

        //}
        //protected void AttachEntityPoint(UWarExtraTest newTest)
        //{
        //    if (attachList.Contains(newTest))
        //        return;
        //    var HeroSprite = USpriteManager.Instance.GetSprite(USpriteManager.ESpriteType.EST_HeadPortrait, WndID.WND_ID_WAR_HEROBEARING, 1, 4, newTest.headID);
        //    var entitySelectionItem = ResNode.InstantiateRes<UWarExtraPlayerSelectionItem>(m_SelectionItemPrefab.gameobjct);
        //    entitySelectionItem.SelectionEntityHead.sprite = HeroSprite;
        //    entitySelectionItem.SelectionEntityID = newTest.entityID;
        //    entitySelectionItem.transform.SetParent(m_EntityAttachPoint, false);
        //    attachList.Add(newTest);
        //    if (attachList.Count > 0)
        //        PlayLayoutAnim();
        //}

        //protected void DettachEntityPoint(UWarExtraTest newTest)
        //{
        //    if (!attachList.Contains(newTest))
        //        return;
        //    var count = m_EntityAttachPoint.childCount;
        //    for (int i = 0; i < count; i++)
        //    {
        //        var com = m_EntityAttachPoint.GetChild(i).GetComponent<UWarExtraPlayerSelectionItem>();
        //        if (com.SelectionEntityID == newTest.entityID)
        //        {
        //            attachList.Remove(newTest);
        //            ResNode.DestroyRes(ref com.gameObject);
        //            break;
        //        }
        //    }
        //    ResetLayoutAnim();
        //}

        protected void AttachEntityPoint(EntityView _ev)
        {
            if (m_dicAttachItems.ContainsKey(_ev.ID))
            {
                return;
            }

            int nEntityHeroID = _ev.Property.GetNumProp(ENTITY_PROPERTY.PROPERTY_VOCATION);
            var HeroSprite    = USpriteManager.Instance.GetSprite(USpriteManager.ESpriteType.EST_HeadPortrait, WndID.WND_ID_WAR_HEROBEARING, 1, 4, nEntityHeroID);
            int MaxHp         = _ev.Property.GetNumProp(ENTITY_PROPERTY.PROPERTY_MAX_HP);
            int CurHp         = _ev.Property.GetNumProp(ENTITY_PROPERTY.PROPERTY_HP);

            var entitySelectionItem = m_SelectionItemResNode.InstanceMainRes <UWarExtraPlayerSelectionItem>();

            entitySelectionItem.SelectionEntityHead.sprite = HeroSprite;
            entitySelectionItem.SelectionEntityID          = _ev.ID;
            entitySelectionItem.SelectionEntityView        = _ev;
            entitySelectionItem.SelectionSpellID           = m_Mediator.SelectionSpellID;
            entitySelectionItem.SetHP(CurHp, MaxHp);
            entitySelectionItem.transform.SetParent(m_EntityAttachPoint, false);

            CreatureStateMachine playerMachine = (CreatureStateMachine)_ev.StateMachine;

            if (playerMachine)
            {
                int formType = playerMachine.creaturePropety.GetNumProp(ENTITY_PROPERTY.PROPERTY_FORMTYPE);
                if (formType == (int)FORM_TYPE.FORM_HATHPACE)
                {
                    entitySelectionItem.Standpoint.sprite = USpriteManager.Instance.GetSprite(USpriteManager.ESpriteType.EST_MinimapIcon, "Icon_gaotai", GetUIWnd().GetID());
                    entitySelectionItem.Standpoint.SetNativeSize();
                    entitySelectionItem.Standpoint.gameObject.SetActive(true);
                }
                else if (formType == (int)FORM_TYPE.FORM_SKY)
                {
                    entitySelectionItem.Standpoint.sprite = USpriteManager.Instance.GetSprite(USpriteManager.ESpriteType.EST_MinimapIcon, "Icon_chibang", GetUIWnd().GetID());
                    entitySelectionItem.Standpoint.SetNativeSize();
                    entitySelectionItem.Standpoint.gameObject.SetActive(true);
                }
                else
                {
                    entitySelectionItem.Standpoint.gameObject.SetActive(false);
                }
            }
            else
            {
                entitySelectionItem.Standpoint.gameObject.SetActive(false);
            }

            m_dicAttachItems.Add(_ev.ID, entitySelectionItem);
            PlayLayoutAnim();
        }
コード例 #11
0
    private void startEffect()
    {
        if (Mathf.Abs(Time.timeScale - speedConfig.globalSpeed) > 0.001f && (speedConfig.globalSpeed > 1.001f || speedConfig.globalSpeed < 0.999f))
        {
            Time.timeScale = speedConfig.globalSpeed;
        }

        CreatureStateMachine machine = GetStateMachine(EffectParam.nSrcEntityID) as CreatureStateMachine;

        if ((speedConfig.animatorSpeed < 0.999f || speedConfig.animatorSpeed > 1.001f) && machine != null && machine.animatorCtrl != null)
        {
            machine.animatorCtrl.changeAnbSpeed(speedConfig.nID, speedConfig.animatorSpeed, true);
        }
    }
コード例 #12
0
        private void ClearPersonSkinDataFromMachine(CreatureStateMachine m_machine)
        {
            m_machine.animator = null;
            m_machine.animatorCtrl.weaponAnimator  = null;
            m_machine.animatorCtrl.weaponAnimator2 = null;

            m_machine.animatorCtrl.ana    = null;
            m_machine.animatorCtrl.anb    = null;
            m_machine.animatorCtrl.anc    = null;
            m_machine.moveAnimatorLayer   = 0;
            m_machine.animatorCtrl.anc    = null;
            m_machine.animatorCtrl.ana    = null;
            m_machine.animatorCtrl.anb    = null;
            m_machine.attackAnimatorLayer = 0;
        }
コード例 #13
0
ファイル: EntityFactory.cs プロジェクト: zwong91/Titan
    public static void RefershPlayerCollider()
    {
        ICollection <U3D_Render.EntityView> list = EntityFactory.GetPlayerList();

        foreach (U3D_Render.EntityView ev in list)
        {
            if (U3D_Render.EntityView.isNullOrEmpty(ev))
            {
                continue;
            }
            CreatureStateMachine cs = ev.StateMachine as CreatureStateMachine;
            if (cs)
            {
                cs.RefershCharacterController();
            }
        }
    }
コード例 #14
0
        private void UpdateBillboard(List <UIBillboardQueryResult> entitys)
        {
            for (int i = 0; i < entitys.Count; i++)
            {
                HeroBearingGo[i].transform.localPosition = new Vector3(entitys[i].x, entitys[i].y, 0);
                Frame[i].transform.rotation = Quaternion.Euler(0, 0, -entitys[i].angle);
                Distance[i].text            = entitys[i].distance.ToString() + "米";

                EntityView targetEntityView = EntityFactory.getEntityViewByID(entitys[i].entityID);
                int        nEntityHeroID    = targetEntityView.Property.GetNumProp(ENTITY_PROPERTY.PROPERTY_VOCATION);
                Portrait[i].sprite = USpriteManager.Instance.GetSprite(USpriteManager.ESpriteType.EST_HeadPortrait, WndID.WND_ID_WAR_HEROBEARING, 1, 4, nEntityHeroID);
                CreatureStateMachine playerMachine = (CreatureStateMachine)targetEntityView.StateMachine;
                Image standpoint = Standpoint[i];
                if (playerMachine)
                {
                    int formType = playerMachine.creaturePropety.GetNumProp(ENTITY_PROPERTY.PROPERTY_FORMTYPE);
                    if (formType == (int)FORM_TYPE.FORM_HATHPACE)
                    {
                        standpoint.sprite = USpriteManager.Instance.GetSprite(USpriteManager.ESpriteType.EST_MinimapIcon, "Icon_gaotai", GetUIWnd().GetID());
                        standpoint.SetNativeSize();
                        standpoint.gameObject.SetActive(true);
                    }
                    else if (formType == (int)FORM_TYPE.FORM_SKY)
                    {
                        standpoint.sprite = USpriteManager.Instance.GetSprite(USpriteManager.ESpriteType.EST_MinimapIcon, "Icon_chibang", GetUIWnd().GetID());
                        standpoint.SetNativeSize();
                        standpoint.gameObject.SetActive(true);
                    }
                    else
                    {
                        standpoint.gameObject.SetActive(false);
                    }
                }
                else
                {
                    standpoint.gameObject.SetActive(false);
                }

                HeroBearingGo[i].SetActive(true);
            }
            for (int i = entitys.Count; i < HeroBearingGo.Length; i++)
            {
                HeroBearingGo[i].SetActive(false);
            }
        }
コード例 #15
0
    public override void Close()
    {
        if (!Valid)
        {
            return;
        }
        base.Close();
        if (Mathf.Abs(Time.timeScale - speedConfig.globalSpeed) < 0.001f && (Time.timeScale < 0.999f || Time.timeScale > 1.001f))
        {
            Time.timeScale = 1.0f;
        }

        CreatureStateMachine machine = GetStateMachine(EffectParam.nSrcEntityID) as CreatureStateMachine;

        if ((speedConfig.animatorSpeed < 0.999f || speedConfig.animatorSpeed > 1.001f) && machine != null && machine.animatorCtrl != null)
        {
            machine.animatorCtrl.changeAnbSpeed(speedConfig.nID, speedConfig.animatorSpeed, false);
        }
    }
コード例 #16
0
    public override bool Begin()
    {
        if (!aniRepConfig || null == EffectParam)
        {
            return(false);
        }
        base.Begin();
        uint tick = GameLogicAPI.getTickCount();

        m_startTick      = (uint)aniRepConfig.nStartTick + tick;
        m_endTick        = (uint)aniRepConfig.nEndTick + tick;
        m_bStartedEffect = false;
        if (!EffectParam.srcObject)
        {
            //创建失败,要进行回收,要不然缓存无法更新
            LightingEffectBehavior temp = this;
            LightingEffectFactory.Instance.CacheEffectBehavior(ref temp);
            return(false);
        }

        CreatureStateMachine state = GetStateMachine(EffectParam.nSrcEntityID) as CreatureStateMachine;

        if (state == null)
        {
            //创建失败,要进行回收,要不然缓存无法更新
            LightingEffectBehavior temp = this;
            LightingEffectFactory.Instance.CacheEffectBehavior(ref temp);
            return(false);
        }
        animatorCtrl = state.animatorCtrl;
        if (animatorCtrl == null)
        {
            //创建失败,要进行回收,要不然缓存无法更新
            LightingEffectBehavior temp = this;
            LightingEffectFactory.Instance.CacheEffectBehavior(ref temp);
            return(false);
        }
        return(true);
    }
コード例 #17
0
    public void Start()
    {
        soldierTransform = transform;

        isMoving         = false;
        reloading        = false;
        autoForward      = false;
        skillautoForward = false;
        //controller = gameObject.GetComponent<CharacterController>();
        m_pFSM = gameObject.GetComponent <CreatureStateMachine>();
        //motor = gameObject.GetComponent<CharacterMotor>();

        stopMoveBuffList   = new List <int>();
        stopRotateBuffList = new List <int>();

        desireAngle = Vector3.zero;
        if (bindSoldierCamera != null)
        {
            desireAngle.y = bindSoldierCamera.userDesireAngle.y;
        }

        unPauseMouseRotateEndTick = 0;
    }
コード例 #18
0
 public CreatureState_Swimming(CreatureStateMachine pFsm)
 {
     m_pFSM = pFsm;
 }
コード例 #19
0
ファイル: PrefamceInfo.cs プロジェクト: zwong91/Titan
    private void DebugEntityInfo(int _nScreenWidth, int _nScreenHeight)
    {
        if (!CheckVisible(EPreframeArea.EPA_Entity))
        {
            return;
        }

        if (InputManager.GetMouseButtonUp(0))
        {
            RaycastHit hit;
            Ray        ray = Initialize.mainCam.ScreenPointToRay(InputManager.MousePosition);
            if (Physics.Raycast(ray, out hit, 100, bDebugScreenRayCastLayer))
            {
                BaseStateMachine bs = hit.transform.GetComponentInParent <BaseStateMachine>();
                if (bs)
                {
                    Debug_CurrentSelectEntity = EntityFactory.getEntityViewByID(bs.entityID);

                    // 请求指定实体的属性值
                    if (curUid == bs.entityID)
                    {
                        return;
                    }

                    curUid = bs.entityID;
                    cmd_Entity_Property_Prefamce_Req data = new cmd_Entity_Property_Prefamce_Req();
                    data.uidReq = (uint)curUid;
                    IntPtrHelper helper = new IntPtrHelper();
                    IntPtr       ptr    = helper.toPtr <cmd_Entity_Property_Prefamce_Req>(ref data);
                    int          len    = Marshal.SizeOf(data);
                    GameLogicAPI.onEntityEvent(EntityFactory.MainHeroID, (int)EntityLogicDef.ENTITY_CMD_ENTITY_PROPERTY_DRAGONBALL, len, "", ptr, len);
                }
            }
        }
        string str_id          = "-";
        string str_name        = "-";
        string str_clientpos   = "-";
        string str_serverpos   = "-";
        string str_state       = "-";
        string Gravity         = "";
        string SyncVectory     = "";
        string SyncPosition    = "";
        string SkinID          = "";
        string strSkinInstance = "";
        string VisibleState    = "";
        string MaskValue       = "";
        string LayerName       = "";

        if (null != Debug_CurrentSelectEntity)
        {
            if (Debug_CurrentSelectEntity.StateMachine)
            {
                //打开请求服务器位置开关
                Debug_CurrentSelectEntity.StateMachine.requestServerPos = true;
                str_id = Debug_CurrentSelectEntity.ID.ToString();
                if (null != Debug_CurrentSelectEntity.Property)
                {
                    str_id += "[" + Debug_CurrentSelectEntity.Property.GetNumProp(ENTITY_PROPERTY.PROPERTY_ID).ToString() + "]";
                }
                str_name      = Debug_CurrentSelectEntity.Property.CreatureName;
                str_clientpos = Debug_CurrentSelectEntity.StateMachine.creature.position.ToString();
                str_state     = Debug_CurrentSelectEntity.StateMachine.GetState().ToString();
                str_serverpos = Debug_CurrentSelectEntity.StateMachine.ServerPos.ToString();
                CreatureStateMachine csm = Debug_CurrentSelectEntity.StateMachine as CreatureStateMachine;
                if (csm)
                {
                    SyncVectory  = csm.syncVelocity.ToString();
                    SyncPosition = csm.syncPosition.ToString();
                }

                Gravity         = Debug_CurrentSelectEntity.StateMachine.currentGravity.ToString();
                VisibleState    = "OnView:\n" + Debug_CurrentSelectEntity.StateMachine.m_OnViewVisible + "\n" + "MaskVisible:" + Debug_CurrentSelectEntity.StateMachine.m_MaskVisible;
                SkinID          = SkinID = Debug_CurrentSelectEntity.StateMachine.SkinControl.currentSkinId.ToString();
                strSkinInstance = "No SkinInstance";
                if (Debug_CurrentSelectEntity.StateMachine.SkinControl.CurrentSkinInstance != null)
                {
                    strSkinInstance = Debug_CurrentSelectEntity.StateMachine.SkinControl.CurrentSkinInstance.nSkinID.ToString();
                }

                MaskValue = Debug_CurrentSelectEntity.Property.GetNumProp(ENTITY_PROPERTY.PROPERTY_MASK).ToString();
                LayerName = LayerMask.LayerToName(Debug_CurrentSelectEntity.gameObject.layer);
            }
        }
        string EntityMessageText;

        EntityMessageText = EntityFormatText("实体调试信息:", " ") + EntityFormatText("ID:", str_id) + EntityFormatText("Name:", str_name) +
                            EntityFormatText("ClientPos:", str_clientpos) + EntityFormatText("ServerPos:", str_serverpos) + EntityFormatText("CurrentState:", str_state) +
                            EntityFormatText("攻击力:", str_pa) + EntityFormatText("生命值:", str_hp) + EntityFormatText("护甲值:", str_pd) +
                            EntityFormatText("魔抗值:", str_md) + EntityFormatText("重力速度:", Gravity) + EntityFormatText("SyncVectory:", SyncVectory) + EntityFormatText("SyncPosition:", SyncPosition) +
                            EntityFormatText("SkinID:", SkinID) + EntityFormatText("SkinInstance:", strSkinInstance) + EntityFormatText("VisibleState:", VisibleState) + EntityFormatText("MaskValue:", MaskValue)
                            + EntityFormatText("LayerName:", LayerName);

        DebugMessageTemplate(EPreframeArea.EPA_Entity, EntityMessageText, new Rect(_nScreenWidth - _nScreenWidth * 0.2f - 10, 10, _nScreenWidth * 0.2f, _nScreenHeight));
    }
コード例 #20
0
ファイル: CreatureMoveCtrl.cs プロジェクト: zwong91/Titan
 // 构造
 public CreatureMoveCtrl(CreatureStateMachine pFsm)
 {
     m_pFSM = pFsm;
     m_autoMoveNavModeFollow = false;
 }
コード例 #21
0
ファイル: MouseCtrl.cs プロジェクト: zwong91/Titan
    public float pickMovePointDisThread  = 0.5f; //鼠标移动距离阈值,按下抬起的时间内累计位移不超过限制右键自动寻路有效
    //private    SceneEffectParamBase m_autoMoveEffectParam = new SceneEffectParamBase((int)ESceneEffectID.SE_Common_AutoMoveTargetPoint, null);

    private void updateFunction()
    {
        uint currentTick = GameLogicAPI.getTickCount();

        //检测鼠标的动作,更新鼠标状态
        //if (state == MouseState.HeroControl)
        //{

        if (bPickingMovePoint)
        {
            Vector2 mouseAxis = new Vector2(fMouseAxisX, fMouseAxisY);
            pickingMoveDis += mouseAxis.magnitude;

            if (skillCtrl && !skillCtrl.enable)
            {
                bPickingMovePoint = false; //屏蔽技能操作时,右键寻路功能也关闭
            }

            if ((skillCtrl && skillCtrl.isSelecting()) || pickingMoveDis > pickMovePointDisThread || currentTick > pickingMovePointEndTick)
            {
                bPickingMovePoint = false;
            }
        }

        if ((InputManager.GetMouseButtonUp(1)) && (bPickingMovePoint)) //右键寻路
        {
            bPickingMovePoint = false;
            CreatureStateMachine stateMachine = transform.GetComponent <CreatureStateMachine>();
            if (stateMachine != null)
            {
                Vector3 pickPos     = Vector3.zero;
                Vector3 selectPoint = getMousePosition();

                if (!UISystem.Instance.IsMouseOverUI())
                {
                    //执行了实体右键弹出菜单就不执行寻路
                    if (EntityRightMenu())
                    {
                        return;
                    }

                    // TODO : 去除右键按场景地点自动寻路功能
                    //RaycastHit hitInfo;
                    //Ray castRay = Initialize.mainCam.ScreenPointToRay(selectPoint);

                    //int LayerMaskOnGournd = (1 << LayerMask.NameToLayer(Config.LayerDefault) | 1 << LayerMask.NameToLayer(Config.LayerBuilding));

                    //bool isHit = Physics.Raycast(castRay, out hitInfo, 100, LayerMaskOnGournd);

                    //if (isHit)
                    //{
                    //    if (m_autoMoveEffectParam.ReturnComponent == null)
                    //        SceneEffectManager.Instance.CreateSceneEffect(ref m_autoMoveEffectParam);
                    //    {
                    //        m_autoMoveEffectParam.ReturnComponent.transform.position = hitInfo.point;
                    //        m_autoMoveEffectParam.ReturnComponent.ReplayEffect();
                    //    }

                    //    stateMachine.AutoMoveTo(hitInfo.point, false);
                    //}
                }
            }
        }
        else if (InputManager.GetMouseButtonDown(1) && GetAttachType() == (int)MouseAttachFuncType.None)
        {
            bPickingMovePoint       = true;
            pickingMoveDis          = 0.0f;
            pickingMovePointEndTick = currentTick + pickMovePointTickThread;
        }

        {
            CheckAttachFunc();

            //应策划要求,暂时关闭Alt+鼠标标记地图功能
            //if (InputManager.GetMouseButtonDown(0) && InputManager.GetKey(KeyCode.LeftAlt))
            //{
            //    if (!UISystem.Instance.IsMouseOverUI())
            //        OnTeamCommand(true);
            //}
            //if (InputManager.GetMouseButtonUp(0) || InputManager.GetKeyUp(KeyCode.LeftAlt))
            //{
            //    OnTeamCommand(false);
            //}

            if (m_currentAttachType != MouseAttachFuncType.None && InputManager.GetMouseButtonUp(0)) //左键插旗,抬键才算,不然会跟普通攻击冲突
            {
                //GFxMinimap minimap = SFGFxMovieManager.Instance.GetWindow("GFxMinimap") as GFxMinimap;
                //if (minimap != null)
                {
                    //如果点到UI上,则不插旗
                    if (!UISystem.Instance.IsMouseOverUI())
                    {
                        Vector3 hitPoint = new Vector3();
                        if (MouseRaycastToGround(ref hitPoint))
                        {
                            DoMouseAttachFunc(hitPoint.x, hitPoint.y, hitPoint.z);
                        }
                    }
                }
            }
        }

        switch (m_currentAttachType)
        {
        case MouseAttachFuncType.CtrlAttackSign:
            MouseCursorManager.Instance.MouseCursorType = EMouseCursorType.MCT_MouseAttack;
            break;

        case MouseAttachFuncType.AltAttackSign:
            MouseCursorManager.Instance.MouseCursorType = EMouseCursorType.MCT_MouseAttack;
            break;

        case MouseAttachFuncType.RetreatSign:
            MouseCursorManager.Instance.MouseCursorType = EMouseCursorType.MCT_MouseSign;
            break;

        default:
            if (MouseCursorManager.Instance.MouseCursorType == EMouseCursorType.MCT_MouseAttack ||
                MouseCursorManager.Instance.MouseCursorType == EMouseCursorType.MCT_MouseSign)
            {
                MouseCursorManager.Instance.MouseCursorType = EMouseCursorType.MCT_Normal;
            }
            break;
        }

        // AICommand模块
        if (InputManager.GetMouseButtonDown(0) && InputManager.GetKey(KeyCode.X))
        {
            if (!UISystem.Instance.IsMouseOverUI())
            {
                OnAICommand();
            }
        }

        if (!RotateWithMouse)
        {
            if (LockCursor && !InputManager.GetMouseButton(1))
            {
                LockCursor = false;
            }
            else if (!LockCursor && InputManager.GetMouseButton(1) && !UISystem.Instance.IsMouseOverUI())
            {
                LockCursor = true;
            }
        }
    }
コード例 #22
0
 public CreatureState_Dead(CreatureStateMachine pFsm)
 {
     m_pFSM = pFsm;
 }