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);
            }
            if (!m_IsInited)
            {
                Init(obj, instance);
            }
            if (m_MoveTime == 0)
            {
                TriggerUtil.MoveObjTo(obj, m_TargetPos);
                return(false);
            }
            long passed_time = curSectionTime - m_StartTime;

            UnityEngine.Vector3 motion_pos = UnityEngine.Vector3.Lerp(m_StartPos, m_TargetPos, passed_time * 1.0f / m_MoveTime);
            TriggerUtil.MoveObjTo(obj, motion_pos);
            TriggerUtil.UpdateObjPosition(obj);
            return(true);
        }
Exemple #2
0
        private void AttachToObject(GameObject obj, GameObject owner)
        {
            Transform parent = TriggerUtil.GetChildNodeByName(owner, m_BoneName);

            if (parent == null)
            {
                parent = owner.transform;
            }
            obj.transform.parent = parent;
            UnityEngine.Vector3 world_pos = parent.TransformPoint(m_Postion);
            TriggerUtil.MoveObjTo(obj, world_pos);
            obj.transform.localRotation = UnityEngine.Quaternion.Euler(m_Rotate);
            if (!m_IsAttach)
            {
                obj.transform.parent = null;
            }
        }
Exemple #3
0
 private void Init(GameObject obj)
 {
     m_IsInited            = true;
     m_SummonList          = GetSummonList(obj);
     m_CurIndex            = m_StartIndex;
     m_NextSummonBeginTime = m_StartTime;
     if (m_CurIndex < 0)
     {
         m_CurIndex = 0;
     }
     else
     {
         GameObject target = GetGameObjectByIndex(m_CurIndex);
         if (target != null)
         {
             TriggerUtil.MoveObjTo(obj, target.transform.position);
         }
         m_CurIndex++;
     }
     InitNextSummonInfo(obj);
 }
Exemple #4
0
        private void AttachToObjectForRandomRotate(GameObject obj, GameObject owner)
        {
            Transform parent = TriggerUtil.GetChildNodeByName(owner, m_BoneName);

            if (parent == null)
            {
                parent = owner.transform;
            }
            obj.transform.parent = parent;
            UnityEngine.Vector3 world_pos = parent.TransformPoint(m_Postion);
            TriggerUtil.MoveObjTo(obj, world_pos);
            UnityEngine.Vector3 resultrotate = new UnityEngine.Vector3(
                m_Rotate.x + Random.Range(m_RandomRotate.x / -2, m_RandomRotate.x / 2),
                m_Rotate.y + Random.Range(m_RandomRotate.y / -2, m_RandomRotate.y / 2),
                m_Rotate.z + Random.Range(m_RandomRotate.z / -2, m_RandomRotate.z / 2));
            obj.transform.localRotation = UnityEngine.Quaternion.Euler(resultrotate);
            if (!m_IsAttach)
            {
                obj.transform.parent = null;
            }
        }
 private UnityEngine.Vector3 Move(GameObject obj, UnityEngine.Vector3 speed_vect, UnityEngine.Vector3 accel_vect, float time)
 {
     m_StartTransform.transform.position = obj.transform.position;
     if (!m_IsLockRotate)
     {
         m_StartTransform.transform.rotation = obj.transform.rotation;
     }
     UnityEngine.Vector3 local_motion = speed_vect * time + accel_vect * time * time / 2;
     UnityEngine.Vector3 word_target_pos;
     while (local_motion.magnitude > m_MaxMoveStep)
     {
         UnityEngine.Vector3 child = UnityEngine.Vector3.ClampMagnitude(local_motion, m_MaxMoveStep);
         local_motion    = local_motion - child;
         word_target_pos = m_StartTransform.transform.TransformPoint(child);
         TriggerUtil.MoveObjTo(obj, word_target_pos);
         m_StartTransform.transform.position = obj.transform.position;
     }
     word_target_pos = m_StartTransform.transform.TransformPoint(local_motion);
     TriggerUtil.MoveObjTo(obj, word_target_pos);
     TriggerUtil.UpdateObjPosition(obj);
     return(speed_vect + accel_vect * time);
 }
Exemple #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);
            }
            if (!m_IsInited)
            {
                Init(obj);
            }
            if (m_CurTargetSummon != null)
            {
                long passed_time = curSectionTime - (m_NextSummonBeginTime - m_MoveTime);
                if (passed_time > m_MoveTime)
                {
                    passed_time = m_MoveTime;
                }
                UnityEngine.Vector3 motion_pos = UnityEngine.Vector3.Lerp(m_StartPos, m_CurTargetSummon.transform.position,
                                                                          passed_time * 1.0f / m_MoveTime);
                TriggerUtil.MoveObjTo(obj, motion_pos);
                TriggerUtil.UpdateObjPosition(obj);
            }
            if (m_CurTargetSummon == null || curSectionTime > m_NextSummonBeginTime)
            {
                m_CurIndex++;
                if (m_CurIndex >= m_SummonList.Count || (m_EndIndex >= m_StartIndex && m_CurIndex > m_EndIndex))
                {
                    return(false);
                }
                InitNextSummonInfo(obj);
            }
            return(true);
        }
Exemple #7
0
 private void SetTransformRelativeSelf(GameObject obj)
 {
     UnityEngine.Vector3 new_pos = obj.transform.TransformPoint(m_Postion);
     TriggerUtil.MoveObjTo(obj, new_pos);
     obj.transform.rotation *= UnityEngine.Quaternion.Euler(m_Rotate);
 }