예제 #1
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);
            }
            MoveTargetInfo target_info = instance.CustomDatas.GetData <MoveTargetInfo>();

            if (target_info == null)
            {
                return(false);
            }
            UnityEngine.GameObject target_obj = target_info.Target;
            if (target_obj == null)
            {
                return(false);
            }
            LogicSystem.NotifyGfxHitTarget(obj, m_ImpactId, target_obj, 0, instance.SkillId,
                                           (int)m_RemainTime, obj.transform.position,
                                           TriggerUtil.GetObjFaceDir(obj), 0);
            return(false);
        }
예제 #2
0
 private void SetTransformRelativeTarget(GameObject obj, MoveTargetInfo target_info)
 {
     if (target_info == null)
     {
         return;
     }
     AttachToObject(obj, target_info.Target);
 }
예제 #3
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>();
        }
예제 #4
0
        public override bool Execute(object sender, SkillInstance instance, long delta, long curSectionTime)
        {
            if (curSectionTime < m_StartTime)
            {
                return(true);
            }
            GameObject obj = sender as GameObject;

            if (obj == null)
            {
                return(false);
            }
            MoveTargetInfo target_info = instance.CustomDatas.GetData <MoveTargetInfo>();

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

            if (m_IsGrab)
            {
                if (!m_IsInited)
                {
                    if (!Init(target_info.Target))
                    {
                        return(false);
                    }
                }
                if (TriggerUtil.AttachNodeToNode(obj, m_SourceNode, target_info.Target, m_TargetNode))
                {
                    TriggerUtil.UpdateObjPosition(target_info.Target);
                }
                if (curSectionTime < m_StartTime + m_UpdateTime)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                target_info.Target.transform.parent = null;
                UnityEngine.Vector3 pos;
                if (TriggerUtil.NeedCalculateNpcDropPoint(obj, target_info.Target, out pos))
                {
                    target_info.Target.transform.position = pos;
                }
                return(false);
            }
        }
예제 #5
0
        public override bool IsSatisfied(GameObject obj, SkillInstance instance)
        {
            MoveTargetInfo targetinfo = instance.CustomDatas.GetData <MoveTargetInfo>();

            if (m_IsNeedTarget && targetinfo != null && targetinfo.Target != null)
            {
                return(true);
            }
            if (!m_IsNeedTarget && (targetinfo == null || targetinfo.Target == null))
            {
                return(true);
            }
            return(false);
        }
예제 #6
0
        public override bool Execute(object sender, SkillInstance instance, long delta, long curSectionTime)
        {
            if (curSectionTime < m_StartTime)
            {
                return(true);
            }
            GameObject obj = sender as GameObject;

            if (obj == null)
            {
                return(false);
            }
            UnityEngine.Vector3 center = obj.transform.TransformPoint(m_Center);
            GameObject          target;

            if (m_Relation == CharacterRelation.RELATION_FITSIGNSONS && !m_NeedCollider)
            {
                List <GameObject> area_objects   = TriggerUtil.FindTargetInProgeny(center, m_Radius, obj, m_SignForSkill, m_Degree);
                List <GameObject> filted_objects = FiltStateObjects(area_objects);
                target = TriggerUtil.GetObjectByPriority(obj, filted_objects, m_DistancePriority, m_DegreePriority, m_Radius, m_Degree);
            }
            else
            {
                List <GameObject> area_objects = TriggerUtil.FindTargetInSector(center, m_Radius,
                                                                                obj.transform.forward,
                                                                                obj.transform.position, m_Degree);
                List <GameObject> filted_objects = FiltStateObjects(TriggerUtil.FiltByRelation(obj, area_objects, m_Relation, m_SignForSkill));
                target = TriggerUtil.GetObjectByPriority(obj, filted_objects,
                                                         m_DistancePriority, m_DegreePriority,
                                                         m_Radius, m_Degree);
            }
            if (target != null)
            {
                MoveTargetInfo targetinfo = new MoveTargetInfo();
                targetinfo.Target = target;
                targetinfo.ToTargetDistanceRatio = m_ToTargetDistanceRatio;
                targetinfo.ToTargetConstDistance = m_ToTargetConstDistance;
                targetinfo.IsAdjustMove          = m_IsAdjustMove;
                instance.CustomDatas.AddData <MoveTargetInfo>(targetinfo);
            }
            return(false);
        }
예제 #7
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);
        }