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);
        }
예제 #2
0
        private void CalNewSpeedWithTarget(GameObject obj, SkillInstance instance)
        {
            MoveTargetInfo ss = instance.CustomDatas.GetData <MoveTargetInfo>();

            if (ss == null)
            {
                return;
            }
            GameObject target = ss.Target;

            if (target == null)
            {
                return;
            }
            if (!ss.IsAdjustMove)
            {
                return;
            }
            GfxSkillSystem.ChangeDir(obj, (target.transform.position - obj.transform.position));
            float cur_distance_z = 0;

            for (int i = 0; i < m_SectionListCopy.Count; i++)
            {
                cur_distance_z += (m_SectionListCopy[i].speedVect.z * m_SectionListCopy[i].moveTime +
                                   m_SectionListCopy[i].accelVect.z * m_SectionListCopy[i].moveTime * m_SectionListCopy[i].moveTime / 2.0f);
            }

            /*
             * foreach (MoveSectionInfo section in m_SectionListCopy) {
             * cur_distance_z += (section.speedVect.z * section.moveTime +
             *                   section.accelVect.z * section.moveTime * section.moveTime / 2.0f);
             * }*/
            UnityEngine.Vector3 target_motion = (target.transform.position - obj.transform.position);
            target_motion.y = 0;
            float target_distance_z = target_motion.magnitude;

            target_distance_z = target_distance_z * (1 + ss.ToTargetDistanceRatio) + ss.ToTargetConstDistance;
            float speed_ratio = 1;

            if (cur_distance_z != 0)
            {
                speed_ratio = target_distance_z / cur_distance_z;
            }
            for (int i = 0; i < m_SectionListCopy.Count; i++)
            {
                m_SectionListCopy[i].speedVect.z *= speed_ratio;
                m_SectionListCopy[i].accelVect.z *= speed_ratio;
            }

            /*
             * foreach (MoveSectionInfo section in m_SectionListCopy) {
             * section.speedVect.z *= speed_ratio;
             * section.accelVect.z *= speed_ratio;
             * }*/
            instance.CustomDatas.RemoveData <MoveTargetInfo>();
        }
예제 #3
0
 private void InitNextSummonInfo(GameObject obj)
 {
     m_CurTargetSummon      = GetGameObjectByIndex(m_CurIndex);
     m_StartPos             = obj.transform.position;
     m_NextSummonBeginTime += m_MoveTime;
     if (m_CurTargetSummon != null)
     {
         UnityEngine.Vector3 dir = m_CurTargetSummon.transform.position - m_StartPos;
         GfxSkillSystem.ChangeDir(obj, dir);
     }
 }
        private void Init(GameObject obj, SkillInstance instance)
        {
            m_IsInited = true;
            m_StartPos = obj.transform.position;
            switch (m_TargetPosType)
            {
            case TargetPosType.kOwnerLastTouchPos:
                m_TargetPos = GetOwnerLastTouchPos(obj);
                break;

            case TargetPosType.kOwnerRandomPos:
                m_TargetPos = GetOwnerRandomPos(obj, m_RelativeCenter, m_Radius);
                break;

            default:
                m_TargetPos = obj.transform.position;
                break;
            }
            UnityEngine.Vector3 direction = m_TargetPos - m_StartPos;
            if (direction != UnityEngine.Vector3.zero)
            {
                GfxSkillSystem.ChangeDir(obj, direction);
            }
        }
예제 #5
0
        public override bool Execute(object sender, SkillInstance instance, long delta, long curSectionTime)
        {
            if (curSectionTime < m_StartTime)
            {
                return(true);
            }
            if (m_IsExecuted && curSectionTime > (m_StartTime + m_RemainTime))
            {
                return(false);
            }
            UnityEngine.GameObject obj = sender as UnityEngine.GameObject;
            if (obj == null)
            {
                return(false);
            }
            m_IsExecuted = true;
            MoveTargetInfo target_info = instance.CustomDatas.GetData <MoveTargetInfo>();

            if (target_info == null || target_info.Target == null)
            {
                return(true);
            }

            UnityEngine.Vector3 dir = target_info.Target.transform.position - obj.transform.position;
            if (!m_IsHaveRotateSpeed || m_RotateSpeed.y == 0)
            {
                GfxSkillSystem.ChangeDir(obj, (float)Math.Atan2(dir.x, dir.z));
            }
            else
            {
                float maxRotateDelta        = m_RotateSpeed.y * TriggerUtil.ConvertToSecond(delta);
                UnityEngine.Vector3 now_dir = UnityEngine.Vector3.RotateTowards(obj.transform.forward, dir, maxRotateDelta, 0);
                GfxSkillSystem.ChangeDir(obj, (float)Math.Atan2(now_dir.x, now_dir.z));
            }
            return(true);
        }