Пример #1
0
    public int GetTouchObjID()
    {
        int        object_id          = -1;
        float      skill_blear_radius = 0.5f;
        Vector3    touch_pos          = new Vector3(position.x, position.y, 0);
        Ray        ray = Camera.main.ScreenPointToRay(touch_pos);
        RaycastHit hitInfo;
        GameObject hitGameObj = null;
        int        layermask  = (1 << LayerMask.NameToLayer("Terrains"))
                                | (1 << LayerMask.NameToLayer("Character"));
        SkillControllerInterface player_skill_ctrl = GetControl();

        if (null != player_skill_ctrl)
        {
            SkillInputData skill_input_data = player_skill_ctrl.GetSkillInputData(SkillTags);
            if (null != skill_input_data)
            {
                skill_blear_radius = skill_input_data.targetChooseRange;
            }
        }
        if (Physics.Raycast(ray, out hitInfo, 200f, layermask))
        {
            Collider[] hitObjs = Physics.OverlapSphere(hitInfo.point, skill_blear_radius, (1 << LayerMask.NameToLayer("Character")));
            if (hitObjs.Length > 0)
            {
                hitGameObj = hitObjs[0].gameObject;
                if (null != hitGameObj)
                {
                    SharedGameObjectInfo targetInfo = LogicSystem.GetSharedGameObjectInfo(hitGameObj);
                    if (null != targetInfo && IsEnemy())
                    {
                        // camp
                        int        camp_self = -1;
                        GameObject goSelf    = DashFire.LogicSystem.PlayerSelf;
                        if (null != goSelf)
                        {
                            CharacterCamp camp_s = goSelf.GetComponent <CharacterCamp>();
                            if (null != camp_s)
                            {
                                camp_self = camp_s.m_CampId;
                            }
                        }
                        CharacterCamp camp_t = hitGameObj.GetComponent <CharacterCamp>();
                        if (camp_t != null && camp_self != camp_t.m_CampId &&
                            targetInfo.Blood > 0)
                        {
                            object_id = targetInfo.m_LogicObjectId;
                        }
                    }
                }
            }
        }

        if (-1 != object_id && null != hitGameObj)
        {
            GfxSystem.PublishGfxEvent("Op_InputEffect", "Input", GestureEvent.OnSingleTap, hitGameObj.transform.position.x, hitGameObj.transform.position.y, hitGameObj.transform.position.z, true, false);
        }

        return(object_id);
    }
Пример #2
0
        public static List <GameObject> FindTargetInProgeny(UnityEngine.Vector3 center,
                                                            float radius,
                                                            GameObject ancestor,
                                                            int signforskill,
                                                            float degree)
        {
            List <GameObject> golist = new List <GameObject>();
            List <GameObject> result = new List <GameObject>();

            GetProgenyGameObject(ancestor, golist);
            UnityEngine.Vector3 direction = ancestor.transform.forward;
            direction.y = 0;
            for (int i = 0; i < golist.Count; ++i)
            {
                GameObject obj = golist[i];
                if (obj != null && UnityEngine.Vector3.Distance(obj.transform.position, center) <= radius)
                {
                    UnityEngine.Vector3 targetDir = obj.transform.position - ancestor.transform.position;
                    targetDir.y = 0;
                    if (UnityEngine.Mathf.Abs(UnityEngine.Vector3.Angle(targetDir, direction)) <= degree)
                    {
                        SharedGameObjectInfo sgoi = LogicSystem.GetSharedGameObjectInfo(obj);
                        if (sgoi != null && sgoi.SignForSkill == signforskill)
                        {
                            result.Add(obj);
                        }
                    }
                }
            }
            return(result);
        }
Пример #3
0
        protected string GetAnimationNameByType(GameObject obj, Animation_Type type)
        {
            if (null == obj)
            {
                return(null);
            }
            SharedGameObjectInfo info = LogicSystem.GetSharedGameObjectInfo(obj);

            if (null != info)
            {
                Data_ActionConfig curActionConfig = ActionConfigProvider.Instance.ActionConfigMgr.GetDataById(info.AnimConfigId);

                return(curActionConfig.m_ActionAnimNameContainer[type]);

                //Data_ActionConfig.Data_ActionInfo action = null;
                //if (null != curActionConfig && curActionConfig.m_ActionContainer.ContainsKey(type)) {
                //  if (curActionConfig.m_ActionContainer[type].Count > 0) {
                //    action = curActionConfig.m_ActionContainer[type][0];
                //  }
                //}
                //if (null != action) {
                //  return action.m_AnimName;
                //}
            }
            return(null);
        }
        public override bool Execute(object sender, SkillInstance instance, long delta, long curSectionTime)
        {
            if (curSectionTime < m_StartTime)
            {
                return(true);
            }
            if (curSectionTime > (m_StartTime + m_RemainTime))
            {
                LogicSystem.EventChannelForGfx.Publish("set_gesture_enable", "ui", true);
                return(false);
            }
            UnityEngine.GameObject obj = sender as UnityEngine.GameObject;
            if (obj == null)
            {
                return(false);
            }

            if (!m_IsInited)
            {
                m_IsInited      = true;
                m_SharedObjInfo = LogicSystem.GetSharedGameObjectInfo(obj);
                if (m_SharedObjInfo == null)
                {
                    return(false);
                }
                LogicSystem.EventChannelForGfx.Publish("set_gesture_enable", "ui", false);
                m_SharedObjInfo.IsSkillGfxRotateControl = false;
            }
            GfxSkillSystem.ChangeDir(obj, m_SharedObjInfo.WantFaceDir);
            return(true);
        }
Пример #5
0
        public override bool Execute(object sender, SkillInstance instance, long delta, long curSectionTime)
        {
            if (curSectionTime < m_StartTime)
            {
                return(true);
            }
            if (curSectionTime > (m_StartTime + m_RemainTime))
            {
                return(false);
            }
            GameObject obj = sender as GameObject;

            if (obj == null)
            {
                return(false);
            }
            if (!m_IsInited)
            {
                m_IsInited      = true;
                m_SkillInstance = instance;
                SharedGameObjectInfo sgoi = LogicSystem.GetSharedGameObjectInfo(obj);
                if (sgoi != null)
                {
                    sgoi.HandleEventCheckHitCanRelease = CheckHitCanRelease;
                }
            }
            return(true);
        }
Пример #6
0
        public override bool Execute(object sender, SkillInstance instance, long delta, long curSectionTime)
        {
            if (curSectionTime < m_StartTime)
            {
                return(true);
            }
            UnityEngine.GameObject obj = sender as UnityEngine.GameObject;
            if (obj == null)
            {
                return(false);
            }
            SharedGameObjectInfo owner_info = LogicSystem.GetSharedGameObjectInfo(obj);

            if (owner_info.Summons.Count <= 0)
            {
                return(false);
            }
            UnityEngine.GameObject first_summon = LogicSystem.GetGameObject(owner_info.Summons[0]);
            if (first_summon == null)
            {
                return(false);
            }
            UnityEngine.Vector3 summon_pos = first_summon.transform.position;
            first_summon.transform.position = obj.transform.position;
            obj.transform.position          = summon_pos;
            LogicSystem.NotifyGfxUpdatePosition(obj, obj.transform.position.x, obj.transform.position.y, obj.transform.position.z);
            LogicSystem.NotifyGfxUpdatePosition(first_summon, first_summon.transform.position.x,
                                                first_summon.transform.position.y, first_summon.transform.position.z);
            return(false);
        }
Пример #7
0
    public void SendImpact(GameObject sender, GameObject target, ImpactInfo impactInfo, int hitCount = 1)
    {
        SendImpactWithOutDamage(target, impactInfo);
        SharedGameObjectInfo targetInfo = LogicSystem.GetSharedGameObjectInfo(target);

        LogicSystem.NotifyGfxHitTarget(sender, impactInfo.m_ImpactId, target, hitCount);
    }
Пример #8
0
        private List <int> GetSummonList(GameObject obj)
        {
            List <int>           result     = new List <int>();
            SharedGameObjectInfo share_info = LogicSystem.GetSharedGameObjectInfo(obj);

            if (share_info == null)
            {
                return(result);
            }
            if (!m_IsSummon)
            {
                result.AddRange(share_info.Summons);
            }
            else if (share_info.SummonOwnerActorId >= 0)
            {
                SharedGameObjectInfo owner_info = LogicSystem.GetSharedGameObjectInfo(share_info.SummonOwnerActorId);
                if (owner_info != null)
                {
                    for (int i = 0; i < owner_info.Summons.Count; ++i)
                    {
                        int actorid = owner_info.Summons[i];
                        if (actorid != share_info.m_ActorId)
                        {
                            result.Add(actorid);
                        }
                    }
                }
            }
            return(result);
        }
Пример #9
0
        public static int GetFinalSkill(GameObject source, int skillid)
        {
            int result = skillid;
            SharedGameObjectInfo si = LogicSystem.GetSharedGameObjectInfo(source);
            int break_protector     = 10000;

            if (si != null && (si.IsSimulate || si.IsSummonWithAI))
            {
                return(skillid);
            }
            while (si != null)
            {
                if (si.SummonOwnerActorId >= 0)
                {
                    result = si.SummonOwnerSkillId;
                    si     = LogicSystem.GetSharedGameObjectInfo(si.SummonOwnerActorId);
                    if (si != null && (si.IsSimulate || si.IsSummonWithAI))
                    {
                        break;
                    }
                }
                else
                {
                    break;
                }
                if (break_protector-- <= 0)
                {
                    break;
                }
            }
            return(result);
        }
Пример #10
0
    private IEnumerator EndGame()
    {
        // 关掉输入和移动
        TouchManager.TouchEnable = false;
        GameObject player = GetPlayer();

        if (null != player)
        {
            SharedGameObjectInfo info = LogicSystem.GetSharedGameObjectInfo(gameObject);
            if (null != info)
            {
                LogicSystem.PublishLogicEvent("ge_set_ai_enable", "ai", info.m_LogicObjectId, false);
            }
        }
        // 慢放 3s
        Time.timeScale = 0.1f;
        yield return(new WaitForSeconds(0.3f));

        Time.timeScale = 1.0f;
        // stage clear
        OnStageClear();
        player = GetPlayer();
        if (null != player)
        {
            BaseSkillManager bsm = player.GetComponent <BaseSkillManager>();
            if (null != bsm)
            {
                if (!bsm.IsUsingSkill())
                {
                }
                else
                {
                    SkillControllerInterface sc = bsm.GetSkillController();
                    if (null != sc)
                    {
                        sc.ForceStopCurSkill();
                    }
                }
            }
        }
        yield return(new WaitForSeconds(0.9f));

        // 耍帅动作
        GameObject gfxGameRoot   = GameObject.Find("GfxGameRoot");
        MainCamera cameraControl = gfxGameRoot.GetComponent <MainCamera>();

        cameraControl.m_Distance = 10.0f;
        cameraControl.m_Height   = 7.0f;
        player = GetPlayer();
        if (null != player)
        {
            player.GetComponent <Animation>().PlayQueued("jianshi_shenguizhan_01", QueueMode.PlayNow);
        }
        yield return(new WaitForSeconds(1.2f));

        cameraControl.m_Distance = 12.5f;
        cameraControl.m_Height   = 7.9f;
        TouchManager.TouchEnable = true;
        OnShieldSword();
    }
Пример #11
0
        public virtual void UpdateEffect(ImpactLogicInfo logicInfo)
        {
            if (null == logicInfo.Target)
            {
                return;
            }
            SharedGameObjectInfo shareInfo = LogicSystem.GetSharedGameObjectInfo(logicInfo.Target);

            if (null != shareInfo && !shareInfo.AcceptStiffEffect)
            {
                return;
            }
            for (int i = 0; i < logicInfo.EffectList.Count; ++i)
            {
                EffectInfo effectInfo = logicInfo.EffectList[i];
                if (null != effectInfo)
                {
                    if (effectInfo.StartTime < 0 && Time.time > logicInfo.StartTime + effectInfo.DelayTime / 1000)
                    {
                        effectInfo.IsActive  = true;
                        effectInfo.StartTime = Time.time;
                        GameObject obj = ResourceSystem.NewObject(effectInfo.Path, effectInfo.PlayTime / 1000) as GameObject;
                        if (null != obj)
                        {
                            if (effectInfo.DelWithImpact)
                            {
                                logicInfo.EffectsDelWithImpact.Add(obj);
                            }
                            if (String.IsNullOrEmpty(effectInfo.MountPoint))
                            {
                                obj.transform.position = logicInfo.Target.transform.position + effectInfo.RelativePoint;
                                UnityEngine.Quaternion q = UnityEngine.Quaternion.Euler(effectInfo.RelativeRotation.x, effectInfo.RelativeRotation.y, effectInfo.RelativeRotation.z);
                                if (effectInfo.RotateWithTarget && null != logicInfo.Sender)
                                {
                                    obj.transform.rotation = UnityEngine.Quaternion.LookRotation(logicInfo.Target.transform.position - logicInfo.Sender.transform.position, UnityEngine.Vector3.up);
                                    obj.transform.rotation = UnityEngine.Quaternion.Euler(obj.transform.rotation.eulerAngles + effectInfo.RelativeRotation);
                                }
                                else
                                {
                                    obj.transform.rotation = q;
                                }
                            }
                            else
                            {
                                Transform parent = LogicSystem.FindChildRecursive(logicInfo.Target.transform, effectInfo.MountPoint);
                                if (null != parent)
                                {
                                    obj.transform.parent        = parent;
                                    obj.transform.localPosition = UnityEngine.Vector3.zero;
                                    UnityEngine.Quaternion q = UnityEngine.Quaternion.Euler(ImpactUtility.RadianToDegree(effectInfo.RelativeRotation.x), ImpactUtility.RadianToDegree(effectInfo.RelativeRotation.y), ImpactUtility.RadianToDegree(effectInfo.RelativeRotation.z));
                                    obj.transform.localRotation = q;
                                }
                            }
                        }
                    }
                }
            }
        }
Пример #12
0
        protected void ClearGfxStateFlag(GameObject obj)
        {
            SharedGameObjectInfo shareInfo = LogicSystem.GetSharedGameObjectInfo(obj);

            if (null != shareInfo)
            {
                shareInfo.GfxStateFlag = 0;
            }
        }
Пример #13
0
        public override void StartImpact(ImpactLogicInfo logicInfo)
        {
            LogicSystem.NotifyGfxAnimationStart(logicInfo.Target, false);
            SharedGameObjectInfo shareInfo = LogicSystem.GetSharedGameObjectInfo(logicInfo.Target);

            PlayAnimation(logicInfo.Target, Animation_Type.AT_Grab);
            LogicSystem.NotifyGfxMoveControlStart(logicInfo.Target, logicInfo.ImpactId, false);
            SetGfxStateFlag(logicInfo.Target, Operate_Type.OT_AddBit, GfxCharacterState_Type.Grab);
        }
Пример #14
0
    protected int GetLogicId(GameObject obj)
    {
        SharedGameObjectInfo info = LogicSystem.GetSharedGameObjectInfo(gameObject);

        if (null != info)
        {
            return(info.m_LogicObjectId);
        }
        return(-1);
    }
Пример #15
0
        public static bool IsTouching(GameObject obj)
        {
            SharedGameObjectInfo share_info = LogicSystem.GetSharedGameObjectInfo(obj);

            if (share_info == null || !share_info.IsTouchDown)
            {
                return(false);
            }
            return(true);
        }
Пример #16
0
    protected bool IsAlive()
    {
        SharedGameObjectInfo info = LogicSystem.GetSharedGameObjectInfo(gameObject);

        if (null != info && info.Blood > 0.0f)
        {
            return(true);
        }
        return(false);
    }
Пример #17
0
    protected bool IsLogicDead()
    {
        SharedGameObjectInfo info = LogicSystem.GetSharedGameObjectInfo(gameObject);

        if (null != info)
        {
            return(info.Blood <= 0);
        }
        return(true);
    }
Пример #18
0
        public static bool IsGameObjectSupperArmer(GameObject target)
        {
            SharedGameObjectInfo info = LogicSystem.GetSharedGameObjectInfo(target);

            if (info == null)
            {
                return(false);
            }
            return(info.IsSuperArmor);
        }
Пример #19
0
        public override void StartImpact(ImpactLogicInfo logicInfo)
        {
            GeneralStartImpact(logicInfo);
            logicInfo.ActionType = GetStiffnessAction(logicInfo);
            SharedGameObjectInfo shareInfo = LogicSystem.GetSharedGameObjectInfo(logicInfo.Target);

            if (null != shareInfo)
            {
                shareInfo.GfxStateFlag = shareInfo.GfxStateFlag | (int)GfxCharacterState_Type.Stiffness;
            }
            PlayAnimation(logicInfo.Target, (Animation_Type)logicInfo.ActionType);
        }
Пример #20
0
        public override void OnInterrupted(ImpactLogicInfo logicInfo)
        {
            StopAnimation(logicInfo.Target, (Animation_Type)logicInfo.ActionType);
            SharedGameObjectInfo shareInfo = LogicSystem.GetSharedGameObjectInfo(logicInfo.Target);

            if (null != shareInfo)
            {
                shareInfo.GfxStateFlag = shareInfo.GfxStateFlag & ~((int)GfxCharacterState_Type.Stiffness);
            }
            logicInfo.IsActive = false;
            GeneralStopImpact(logicInfo);
        }
Пример #21
0
 protected void SetGfxDead(GameObject obj, bool isDead)
 {
     if (null != obj)
     {
         SharedGameObjectInfo shareInfo = LogicSystem.GetSharedGameObjectInfo(obj);
         {
             if (null != shareInfo)
             {
                 shareInfo.IsDead = isDead;
             }
         }
     }
 }
Пример #22
0
        private void StoreTouchPos(GameObject obj, SkillInstance instance)
        {
            UnityEngine.Vector3  touchpos  = TriggerUtil.GetTouchPos(obj);
            UnityEngine.Vector3  scene_pos = CalcScenePos(obj, touchpos);
            SharedGameObjectInfo obj_info  = LogicSystem.GetSharedGameObjectInfo(obj);

            if (obj_info != null)
            {
                obj_info.LastTouchX = scene_pos.x;
                obj_info.LastTouchY = scene_pos.y;
                obj_info.LastTouchZ = scene_pos.z;
            }
        }
Пример #23
0
        public static bool IsObjectDead(GameObject obj)
        {
            SharedGameObjectInfo si = LogicSystem.GetSharedGameObjectInfo(obj);

            if (si.Blood <= 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Пример #24
0
    protected void StartSpellBar(Vector3 pos, float duration, GameObject obj)
    {
        SharedGameObjectInfo info   = LogicSystem.GetSharedGameObjectInfo(obj);
        GameObject           uiRoot = GameObject.FindGameObjectWithTag("UI");

        if (null != uiRoot && null != info)
        {
            DFMUiRoot uiMgr = uiRoot.GetComponent <DFMUiRoot>();
            if (null != uiMgr)
            {
                uiMgr.ShowMonsterPrePower(pos.x, pos.y, pos.z, duration, info.m_LogicObjectId);
            }
        }
    }
Пример #25
0
    protected void StopSpell(GameObject obj)
    {
        SharedGameObjectInfo info   = LogicSystem.GetSharedGameObjectInfo(obj);
        GameObject           uiRoot = GameObject.FindGameObjectWithTag("UI");

        if (null != uiRoot && null != info)
        {
            DFMUiRoot uiMgr = uiRoot.GetComponent <DFMUiRoot>();
            if (null != uiMgr)
            {
                uiMgr.BreakPrePower(info.m_LogicObjectId);
            }
        }
    }
Пример #26
0
    protected void GeneralStartSkill()
    {
        m_IsActive        = true;
        m_LastTriggerTime = Time.time;
        m_EffectList.Clear();
        SharedGameObjectInfo info = LogicSystem.GetSharedGameObjectInfo(gameObject);

        if (null != info)
        {
            LogicSystem.PublishLogicEvent("ge_set_ai_enable", "ai", info.m_LogicObjectId, false);
        }
        LogicSystem.NotifyGfxAnimationStart(gameObject);
        LogicSystem.NotifyGfxMoveControlStart(gameObject);
    }
Пример #27
0
        public static bool IsUserStandUp(GameObject obj)
        {
            SharedGameObjectInfo objinfo = LogicSystem.GetSharedGameObjectInfo(obj);

            if (objinfo == null)
            {
                return(false);
            }
            if (objinfo.IsPlayer && objinfo.GfxStateFlag == (int)GfxCharacterState_Type.GetUp)
            {
                return(true);
            }
            return(false);
        }
Пример #28
0
 protected bool IsGfxDead(GameObject obj)
 {
     if (null != obj)
     {
         SharedGameObjectInfo shareInfo = LogicSystem.GetSharedGameObjectInfo(obj);
         {
             if (null != shareInfo)
             {
                 return(shareInfo.IsDead);
             }
         }
     }
     return(true);
 }
Пример #29
0
 protected bool IsLogicDead(GameObject obj)
 {
     if (null != obj)
     {
         SharedGameObjectInfo shareInfo = LogicSystem.GetSharedGameObjectInfo(obj);
         {
             if (null != shareInfo && shareInfo.Blood > 0)
             {
                 return(false);
             }
         }
     }
     return(true);
 }
Пример #30
0
        public override void StopImpact(ImpactLogicInfo logicInfo)
        {
            if (IsLogicDead(logicInfo.Target))
            {
                //SetGfxDead(logicInfo.Target, true);
            }
            SharedGameObjectInfo shareInfo = LogicSystem.GetSharedGameObjectInfo(logicInfo.Target);

            if (null != shareInfo)
            {
                shareInfo.GfxStateFlag = shareInfo.GfxStateFlag & ~((int)GfxCharacterState_Type.Stiffness);
            }
            logicInfo.IsActive = false;
            GeneralStopImpact(logicInfo);
        }