Ejemplo n.º 1
0
        private bool Init(SkillInstance instance)
        {
            if (m_IsNeedCollide)
            {
                SkillDamageManager damage_manager = instance.CustomDatas.GetData <SkillDamageManager>();
                if (damage_manager == null || !damage_manager.IsDamagedEnemy)
                {
                    return(false);
                }
            }
            if (m_XShakeInfo == null || m_YShakeInfo == null || m_ZShakeInfo == null)
            {
                return(false);
            }
            m_IsInited            = true;
            m_CameraOriginPos     = Camera.main.transform.position;
            m_LastCameraFollowPos = m_CameraOriginPos;
            m_CameraControlId     = TriggerUtil.ControlCamera(true);
            if (m_CameraControlId == TriggerUtil.CAMERA_CONTROL_FAILED)
            {
                return(false);
            }
            float now = instance.CurTime / 1000.0f;

            m_XShakeInfo.Init(m_CameraOriginPos.x, now);
            m_YShakeInfo.Init(m_CameraOriginPos.y, now);
            m_ZShakeInfo.Init(m_CameraOriginPos.z, now);
            m_CameraObject = TriggerUtil.GetCameraObj();
            return(true);
        }
Ejemplo n.º 2
0
        private List <GameObject> FiltStateObjects(List <GameObject> objects)
        {
            List <GameObject> result = new List <GameObject>();

            if (objects == null)
            {
                return(result);
            }
            foreach (GameObject obj in objects)
            {
                if (m_IsFiltSupperArmer)
                {
                    if (GrabTargetTrigger.IsGameObjectSupperArmer(obj))
                    {
                        continue;
                    }
                }
                BeHitState state = SkillDamageManager.GetBeHitState(obj);
                if (!IsFiltState(state))
                {
                    result.Add(obj);
                }
            }
            return(result);
        }
Ejemplo n.º 3
0
        private bool DamageCrossObjects(GameObject obj, SkillInstance instance, UnityEngine.Vector3 pos)
        {
            bool is_damaged_somebody          = false;
            SkillDamageManager damage_manager = instance.CustomDatas.GetData <SkillDamageManager>();

            if (damage_manager == null)
            {
                damage_manager = new SkillDamageManager(obj);
                instance.CustomDatas.AddData <SkillDamageManager>(damage_manager);
            }
            List <GameObject> hit_objes = TriggerUtil.GetRayHitObjects(TriggerUtil.CHARACTER_LAYER, pos);
            List <GameObject> enimies   = TriggerUtil.FiltEnimy(obj, hit_objes);
            int        final_skill_id   = -1;
            GameObject source_obj       = TriggerUtil.GetFinalOwner(obj, final_skill_id, out final_skill_id);
            long       hit_count_id     = TriggerUtil.NextHitCountId();

            for (int i = 0; i < enimies.Count; i++)
            {
                if (!SkillDamageManager.IsEnemy(obj, enimies[i].gameObject))
                {
                    continue;
                }
                if (IsObjectCanDamage(enimies[i]))
                {
                    damage_manager.SendImpactToObject(source_obj, enimies[i], m_StateImpacts, final_skill_id, hit_count_id);
                    DamageObjectInfo a = new DamageObjectInfo();
                    a.obj            = enimies[i];
                    a.remainDamageCD = m_DamageInterval / 1000.0f;
                    m_DamageCDObjects.Add(a);
                    is_damaged_somebody = true;
                }
            }

            /*
             * foreach (GameObject hit_obj in enimies) {
             * if (!SkillDamageManager.IsEnemy(obj, hit_obj.gameObject)) {
             *  continue;
             * }
             * if (IsObjectCanDamage(hit_obj)) {
             *  damage_manager.SendImpactToObject(source_obj, hit_obj, m_StateImpacts, final_skill_id, hit_count_id);
             *  DamageObjectInfo a = new DamageObjectInfo();
             *  a.obj = hit_obj;
             *  a.remainDamageCD = m_DamageInterval / 1000.0f;
             *  m_DamageCDObjects.Add(a);
             *  is_damaged_somebody = true;
             * }
             * }*/
            if (is_damaged_somebody)
            {
                damage_manager.IsDamagedEnemy = true;
                instance.SendMessage("oncollide");
            }
            return(is_damaged_somebody);
        }
Ejemplo n.º 4
0
        public void OnTriggerEnter(Collider collider)
        {
            if (m_DamageManager == null)
            {
                return;
            }
            string message = m_ColliderInfo.GetCollideLayerMessage(collider.gameObject.layer);

            if (!string.IsNullOrEmpty(message))
            {
                m_OwnSkill.SendMessage(message);
            }
            if (!m_OwnSkill.IsDamageEnable)
            {
                return;
            }

            if (SkillDamageManager.IsUserStandUp(collider.gameObject))
            {
                return;
            }

            if (m_DamageManager.AddDamagedObject(collider.gameObject))
            {
                UpdateHitCount();
                if (m_ColliderInfo.GetAttachConfig().IsAttachEnemy)
                {
                    AddAttachObject(collider);
                }
                else
                {
                    m_DamageManager.SendImpactToObject(m_DamageManager.GetOwner(), collider.gameObject,
                                                       m_ColliderInfo.GetStateImpacts(),
                                                       m_OwnSkill.SkillId, m_CurHitCountId);
                    if (m_DamageInterval > 0)
                    {
                        //Debug.Log("----------add more times obj " + collider.gameObject.name + " time=" + m_OwnSkill.CurTime);
                        AddMoreTimeEffectObject(collider.gameObject);
                    }
                    if (m_IsAlwaysEnterDamage)
                    {
                        m_LeaveDelObjects.Add(collider.gameObject);
                    }
                    m_DamagedObjects.Add(collider.gameObject);
                }
            }
            if (m_DamageManager.IsDamagedEnemy)
            {
                m_OwnSkill.SendMessage("oncollide");
            }
        }
Ejemplo n.º 5
0
        public override bool IsSatisfied(GameObject obj, SkillInstance instance)
        {
            BeHitState obj_state = SkillDamageManager.GetBeHitState(obj);

            if (m_IsEquals && m_TargetState == obj_state)
            {
                return(true);
            }
            if (!m_IsEquals && m_TargetState != obj_state)
            {
                return(true);
            }
            return(false);
        }
Ejemplo n.º 6
0
        public override bool Execute(object sender, SkillInstance instance, long delta, long curSectionTime)
        {
            GameObject obj = sender as GameObject;

            if (null == obj)
            {
                return(false);
            }
            if (!m_IsResourcePreloaded)
            {
                PreloadResource(obj, instance);
            }
            if (curSectionTime < m_StartTime)
            {
                return(true);
            }
            if (m_IsNeedCollide)
            {
                SkillDamageManager damage_manager = instance.CustomDatas.GetData <SkillDamageManager>();
                if (damage_manager == null || !damage_manager.IsDamagedEnemy)
                {
                    return(false);
                }
            }
            string    random_audio = GetRandomAudio();
            AudioClip clip         = ResourceSystem.GetSharedResource(random_audio) as AudioClip;

            if (null == clip)
            {
                return(false);
            }
            if (m_AudioSource != null)
            {
                if (m_AudioSource.loop)
                {
                    m_AudioSource.clip = clip;
                    m_AudioSource.Play();
                }
                else
                {
                    m_AudioSource.PlayOneShot(clip);
                }
                m_AudioSource.volume       = m_volume;
                m_AudioSource.dopplerLevel = 0f;
            }
            return(false);
        }
Ejemplo n.º 7
0
 private void Init(GameObject obj, SkillInstance instance)
 {
     m_IsInited         = true;
     m_Owner            = obj;
     m_OwnSkill         = instance;
     m_CurHitCountId    = TriggerUtil.NextHitCountId();
     m_LastHitCountTime = instance.CurTime;
     m_DamageManager    = instance.CustomDatas.GetData <SkillDamageManager>();
     if (m_DamageManager == null)
     {
         m_DamageManager = new SkillDamageManager(obj);
         instance.CustomDatas.AddData <SkillDamageManager>(m_DamageManager);
     }
     m_ColliderInfo.CreateTriger(obj, m_RemainTime / 1000.0f,
                                 (object)(MyAction <Collider>) this.OnTriggerEnter,
                                 (object)(MyAction <Collider>) this.OnTriggerExit,
                                 (object)(MyAction)this.OnDestroy);
 }
        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);
            }
            SkillDamageManager damage_mgr = instance.CustomDatas.GetData <SkillDamageManager>();

            if (damage_mgr == null)
            {
                return(false);
            }
            damage_mgr.ClearDamagePoool();
            return(false);
        }
Ejemplo n.º 9
0
        public static List <GameObject> FiltEnimy(GameObject source, List <GameObject> list)
        {
            List <GameObject> result = new List <GameObject>();

            for (int i = 0; i < list.Count; i++)
            {
                if (SkillDamageManager.IsEnemy(source, list[i]) && !IsObjectDead(list[i]))
                {
                    result.Add(list[i]);
                }
            }

            /*
             * foreach (GameObject obj in list) {
             * if (SkillDamageManager.IsEnemy(source, obj) && !IsObjectDead(obj)) {
             *  result.Add(obj);
             * }
             * }*/
            return(result);
        }
Ejemplo n.º 10
0
        public override bool IsSatisfied(GameObject obj, SkillInstance instance)
        {
            if (!m_IsIncludeBehitState)
            {
                BeHitState state = SkillDamageManager.GetBeHitState(obj);
                if (state != BeHitState.kStand)
                {
                    return(false);
                }
            }
            float height = TriggerUtil.GetHeightWithGround(obj);

            if (m_IsJudgeFly && height >= m_Height)
            {
                return(true);
            }
            if (!m_IsJudgeFly && height <= m_Height)
            {
                return(true);
            }
            return(false);
        }
Ejemplo n.º 11
0
        public override bool Execute(object sender, SkillInstance instance, long delta, long curSectionTime)
        {
            if (curSectionTime >= m_StartTime)
            {
                GameObject obj = sender as GameObject;
                if (null == obj)
                {
                    return(false);
                }
                if (!instance.IsDamageEnable)
                {
                    return(false);
                }

                UnityEngine.Vector3 center         = obj.transform.TransformPoint(m_RelativeCenter);
                Collider[]          hits           = Physics.OverlapSphere(center, m_Range, TriggerUtil.CHARACTER_LAYER);
                SkillDamageManager  damage_manager = instance.CustomDatas.GetData <SkillDamageManager>();
                if (damage_manager == null)
                {
                    damage_manager = new SkillDamageManager(obj);
                    instance.CustomDatas.AddData <SkillDamageManager>(damage_manager);
                }
                if (m_IsShowTip)
                {
                    GameObject circle = TriggerUtil.DrawCircle(center, m_Range, m_Color);
                    GameObject.Destroy(circle, m_ShowTime / 1000.0f);
                }
                long hit_count_id = TriggerUtil.NextHitCountId();
                for (int i = 0; i < hits.Length; i++)
                {
                    if (!SkillDamageManager.IsEnemy(obj, hits[i].gameObject))
                    {
                        continue;
                    }
                    if (SkillDamageManager.IsUserStandUp(hits[i].gameObject))
                    {
                        continue;
                    }
                    if (!damage_manager.IsContainObject(hits[i].gameObject))
                    {
                        damage_manager.IsDamagedEnemy = true;
                        damage_manager.SendImpactToObject(obj, hits[i].gameObject, m_StateImpacts, instance.SkillId, hit_count_id);
                        if (!m_IsClearWhenFinish)
                        {
                            damage_manager.AddDamagedObject(hits[i].gameObject);
                        }
                    }
                }

                /*
                 * foreach (Collider hit in hits) {
                 * if (!SkillDamageManager.IsEnemy(obj, hit.gameObject)) {
                 *  continue;
                 * }
                 * if (SkillDamageManager.IsUserStandUp(hit.gameObject)) {
                 *  continue;
                 * }
                 * if (!damage_manager.IsContainObject(hit.gameObject)) {
                 *  damage_manager.IsDamagedEnemy = true;
                 *  damage_manager.SendImpactToObject(obj, hit.gameObject, m_StateImpacts, instance.SkillId, hit_count_id);
                 *  if (!m_IsClearWhenFinish) {
                 *    damage_manager.AddDamagedObject(hit.gameObject);
                 *  }
                 * }
                 * }*/
                if (damage_manager.IsDamagedEnemy)
                {
                    instance.SendMessage("oncollide");
                }
                return(false);
            }
            else
            {
                return(true);
            }
        }
Ejemplo n.º 12
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 (null == obj || null == obj.GetComponent <UnityEngine.Animation>())
            {
                return(false);
            }
            Animation      animation = obj.GetComponent <UnityEngine.Animation>();
            AnimationState state     = animation[m_AnimName];

            if (state == null)
            {
                return(false);
            }

            if (!m_IsInited)
            {
                Init();
            }

            if (m_IsNeedCollide)
            {
                SkillDamageManager damage_manager = instance.CustomDatas.GetData <SkillDamageManager>();
                if (damage_manager == null || !damage_manager.IsDamagedEnemy)
                {
                    return(false);
                }
            }
            if (Time.time <= m_WorldStartTime + m_LockTime / 1000.0f)
            {
                if (state.speed != m_LockSpeed)
                {
                    state.speed = m_LockSpeed;
                    SetSkillTimeScale(instance, state.speed, state.speed, state.speed);
                }
            }
            else
            {
                if (m_RestoreTime > 0 && Time.time < m_WorldStartTime + (m_LockTime + m_RestoreTime) / 1000.0f)
                {
                    float time_percent = (Time.time - m_WorldStartTime - m_LockTime / 1000.0f) / (m_RestoreTime / 1000.0f);
                    if (m_Curve != null && m_Curve.keys.Length > 0)
                    {
                        float scale        = m_Curve.Evaluate(time_percent);
                        float anim_speed   = scale * m_AfterLockAnimSpeed;
                        float effect_speed = scale * m_AfterLockEffectSpeed;
                        float move_speed   = scale * m_AfterLockMoveSpeed;
                        float skill_speed  = scale * m_AfterLockSkillSpeed;
                        state.speed = anim_speed;
                        SetSkillTimeScale(instance, effect_speed, move_speed, skill_speed);
                    }
                    else
                    {
                        float anim_speed   = m_LockSpeed + time_percent * (m_AfterLockAnimSpeed - m_LockSpeed);
                        float effect_speed = m_LockSpeed + time_percent * (m_AfterLockEffectSpeed - m_LockSpeed);
                        float move_speed   = m_LockSpeed + time_percent * (m_AfterLockMoveSpeed - m_LockSpeed);
                        float skill_speed  = m_LockSpeed + time_percent * (m_AfterLockSkillSpeed - m_LockSpeed);
                        SetSkillTimeScale(instance, effect_speed, move_speed, skill_speed);
                    }
                }
                else
                {
                    state.speed = m_AfterLockAnimSpeed;
                    SetSkillTimeScale(instance, m_AfterLockEffectSpeed, m_AfterLockMoveSpeed, m_AfterLockSkillSpeed);
                    return(false);
                }
            }
            return(true);
        }