Пример #1
0
    /// param:Id[对应到SkillSceneObjManager中的SkillEffectId]
    /// example:2
    public void Trigger_PlayEffectAtWeaponByEffectId(string param)
    {
#if SHOOTER_LOG
        Debug.Log("Trigger_PlayEffectAtWeaponByEffectId param:" + param);
#endif
        SkillSceneObjInfo sobjInfo      = new SkillSceneObjInfo(param);
        MasterWeaponType  masterType    = (MasterWeaponType)(sobjInfo.ExtractNumeric <int>(0, 0));
        GameObject        curMainWeapon = TriggerImpl.GetCurMainWeapon(this.gameObject, masterType);
        if (m_SceneObjMgr != null && curMainWeapon != null)
        {
            SkillEffectInfo effectInfo = m_SceneObjMgr.TryGetSkillEffectInfo(sobjInfo.Id);
            if (effectInfo != null)
            {
                effectInfo = effectInfo.Clone();
                Vector3 pos = curMainWeapon.transform.position;
                Vector3 rot = curMainWeapon.transform.rotation.eulerAngles;
                if (!string.IsNullOrEmpty(effectInfo.EffectParentBone))
                {
                    Transform t = LogicSystem.FindChildRecursive(curMainWeapon.transform, effectInfo.EffectParentBone);
                    if (null != t)
                    {
                        pos = t.position;
                    }
                }
                effectInfo.EffectPos += pos;
                effectInfo.EffectRot += rot;
                TriggerImpl.PlayEffect(effectInfo);
            }
        }
    }
Пример #2
0
 // Update is called once per frame
 void Update()
 {
     if (IsActive)
     {
         if (Time.time < m_LastTriggerTime + m_AnimationPlayer.AnimationLenth(m_StartAnim))
         {
         }
         else if (Time.time < m_LastTriggerTime + m_AnimationPlayer.AnimationLenth(m_StartAnim) + m_MovingTime)
         {
             if (!m_AnimationPlayer.IsPlaying(m_RotateAnim))
             {
                 m_AnimationPlayer.Play(m_RotateAnim);
             }
             if (!m_HasRotateEffect)
             {
                 m_HasRotateEffect = true;
                 if (null != m_RotateEffect)
                 {
                     GameObject rotateEffect = ResourceSystem.NewObject(m_RotateEffect, m_MovingTime) as GameObject;
                     if (null != rotateEffect)
                     {
                         Transform parent = LogicSystem.FindChildRecursive(this.transform, m_RotateEffectBone);
                         if (null != parent)
                         {
                             rotateEffect.transform.parent        = parent;
                             rotateEffect.transform.localPosition = Vector3.zero;
                             rotateEffect.transform.localRotation = Quaternion.identity;
                             m_EffectList.Add(rotateEffect);
                         }
                     }
                 }
             }
             Vector3 motion = m_Direction * Time.deltaTime * m_Speed;
             if (!m_MoveController.isGrounded)
             {
                 motion.y += -9.8f * Time.deltaTime;
             }
             m_MoveController.Move(m_Direction * Time.deltaTime * m_Speed);
             LogicSystem.NotifyGfxUpdatePosition(gameObject, this.transform.position.x, this.transform.position.y, this.transform.position.z, 0, this.transform.rotation.eulerAngles.y * Mathf.PI / 180f, 0);
             HandleDamage();
         }
         else if (Time.time < m_LastTriggerTime + m_AnimationPlayer.AnimationLenth(m_StartAnim) + m_MovingTime + m_AnimationPlayer.AnimationLenth(m_EndAnim))
         {
             if (!m_AnimationPlayer.IsPlaying(m_EndAnim))
             {
                 SetEndure(gameObject, false);
                 m_AnimationPlayer.Play(m_EndAnim);
             }
         }
         else
         {
             StopSkill();
         }
         if (IsLogicDead())
         {
             NotifyNpcDead(gameObject);
             StopSkill();
         }
     }
 }
Пример #3
0
    private void DropWeapon(WeaponHand type)
    {
        if (m_Weapons.ContainsKey(type))
        {
            GameObject weapon = m_Weapons[type];
            Script_Util.DetachGameObject(weapon);
            GameObject.DestroyObject(weapon);
            m_Weapons.Remove(type);
        }

        // Make Sure Remove All Children
        Transform t = LogicSystem.FindChildRecursive(this.gameObject.transform, GetBoneName(type));

        if (t != null)
        {
            int childCount = t.childCount;
            for (int index = 0; index < childCount; index++)
            {
                Transform child = t.GetChild(index);
                child.parent = null;
                GameObject.Destroy(child.gameObject);
            }
            t.DetachChildren();
        }
    }
Пример #4
0
    /// param:Id[对应到SkillSceneObjManager中的SkillEffectId]
    /// example:2
    public void Trigger_PlayEffectAtRoleByEffectId(string param)
    {
#if SHOOTER_LOG
        Debug.Log("Trigger_PlayEffectAtRoleByEffectId param:" + param);
#endif
        SkillSceneObjInfo sobjInfo = new SkillSceneObjInfo(param);
        if (m_SceneObjMgr != null)
        {
            SkillEffectInfo effectInfo = m_SceneObjMgr.TryGetSkillEffectInfo(sobjInfo.Id);
            if (effectInfo != null)
            {
                effectInfo = effectInfo.Clone();
                Vector3 pos = this.gameObject.transform.position;
                Vector3 rot = this.gameObject.transform.rotation.eulerAngles;
                if (!string.IsNullOrEmpty(effectInfo.EffectParentBone))
                {
                    Transform t = LogicSystem.FindChildRecursive(this.gameObject.transform, effectInfo.EffectParentBone);
                    if (null != t)
                    {
                        pos = t.position;
                    }
                }
                effectInfo.EffectPos += pos;
                effectInfo.EffectRot += rot;
                TriggerImpl.PlayEffect(effectInfo);
            }
        }
    }
Пример #5
0
    public override void StartSkill()
    {
        GeneralStartSkill();
        m_HasRotateEffect = false;
        GameObject player = LogicSystem.PlayerSelf;

        if (null != player)
        {
            m_Direction   = player.transform.position - this.transform.position;
            m_Direction.y = 0;
            m_Direction.Normalize();
            RaycastHit hit;
            Vector3    pos = this.transform.position;
            pos.y += 0.5f;
            if (Physics.Raycast(pos, m_Direction, out hit, m_MaxDis, m_LayerMask))
            {
                m_TargetPos = hit.point;
            }
            else
            {
                m_TargetPos = this.transform.position + m_Direction * m_MaxDis;
            }
            m_MovingTime     = Vector3.Distance(this.transform.position, m_TargetPos) / m_Speed;
            m_LastImpactTime = 0.0f;
            m_AnimationPlayer.Play(m_StartAnim);
            SetEndure(gameObject, true);
            if (null != m_WarningEffect)
            {
                GameObject warnEffect = ResourceSystem.NewObject(m_WarningEffect, m_AnimationPlayer.AnimationLenth(m_StartAnim)) as GameObject;
                if (null != warnEffect)
                {
                    warnEffect.transform.position = this.transform.position + new Vector3(0.0f, 0.1f, 0.0f);
                    warnEffect.transform.rotation = Quaternion.LookRotation(m_Direction);
                    m_EffectList.Add(warnEffect);
                }
            }
            if (null != m_BurnEffect)
            {
                float      duration   = m_AnimationPlayer.AnimationLenth(m_StartAnim) + m_AnimationPlayer.AnimationLenth(m_EndAnim) + m_MovingTime;
                GameObject burnEffect = ResourceSystem.NewObject(m_BurnEffect, duration) as GameObject;
                if (null != burnEffect)
                {
                    Transform parent = LogicSystem.FindChildRecursive(this.transform, "Bip001 Spine1");
                    if (null != parent)
                    {
                        burnEffect.transform.parent        = parent;
                        burnEffect.transform.localPosition = Vector3.zero;
                        burnEffect.transform.localRotation = Quaternion.identity;
                        m_EffectList.Add(burnEffect);
                    }
                }
            }
        }
        else
        {
            StopSkill();
        }
    }
Пример #6
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;
                                }
                            }
                        }
                    }
                }
            }
        }
Пример #7
0
    private GameObject GetWeaponObj(string weaponName)
    {
        Transform weaponTransform = LogicSystem.FindChildRecursive(this.transform, weaponName);

        if (null != weaponTransform)
        {
            return(weaponTransform.gameObject);
        }
        return(null);
    }
Пример #8
0
        public override bool Execute(object sender, SkillInstance instance, long delta, long curSectionTime)
        {
            GameObject obj = sender as GameObject;

            if (null != obj)
            {
                if (curSectionTime >= m_StartTime)
                {
                    GameObject effectObj = ResourceSystem.NewObject(m_EffectPath, m_DeleteTime) as GameObject;
                    if (null != effectObj)
                    {
                        TriggerUtil.SetObjVisible(effectObj, true);
                        Transform bone = LogicSystem.FindChildRecursive(obj.transform, m_AttachPath);
                        effectObj.SetActive(false);
                        if (null != bone)
                        {
                            effectObj.transform.parent        = bone;
                            effectObj.transform.localPosition = m_Pos;
                            effectObj.transform.localRotation = m_Dir;
                            effectObj.transform.localScale    = m_Scale;
                            if (!m_IsAttach)
                            {
                                effectObj.transform.parent = null;
                            }
                            EffectManager em = instance.CustomDatas.GetData <EffectManager>();
                            if (em == null)
                            {
                                em = new EffectManager();
                                instance.CustomDatas.AddData <EffectManager>(em);
                            }
                            em.AddEffect(effectObj);
                            em.SetParticleSpeed(instance.EffectScale);
                        }
                        effectObj.SetActive(true);
                    }

                    //DashFire.LogSystem.Debug("CharacterEffectTriger:{0}", m_EffectPath);
                    return(false);
                }
                else
                {
                    return(true);
                }
            }
            else
            {
                return(false);
            }
        }
Пример #9
0
 public static bool AttachGameObject(Transform parent, Transform obj, string path)
 {
     if (null != obj && null != parent)
     {
         Transform t = LogicSystem.FindChildRecursive(parent, path);
         if (null != t)
         {
             obj.transform.parent        = t;
             obj.transform.localPosition = Vector3.zero;
             obj.transform.localRotation = Quaternion.identity;
             return(true);
         }
         else
         {
             LogicSystem.LogicLog("AttachGameObject obj{1} can't attach to parent{1} at bone {2}", obj.name, parent.name, path);
         }
     }
     return(false);
 }
Пример #10
0
 public void OnMeetEnemy()
 {
     if (null != m_MeetEnemyEffect)
     {
         GameObject meetEnemyEffect = ResourceSystem.NewObject(m_MeetEnemyEffect, 2.0f) as GameObject;
         if (null != meetEnemyEffect)
         {
             Transform parent = LogicSystem.FindChildRecursive(this.transform, m_MeetEnemyEffectBone);
             if (null != parent)
             {
                 meetEnemyEffect.transform.parent        = parent;
                 meetEnemyEffect.transform.localPosition = Vector3.zero;
                 meetEnemyEffect.transform.localRotation = Quaternion.identity;
             }
         }
     }
     else
     {
         Debug.LogError(gameObject.name + " don't have a meet enemy effect");
     }
 }
Пример #11
0
 internal void LateUpdate()
 {
     if (CheckProcedureValid())
     {
         m_Elapsed += Time.deltaTime;
         if (m_Elapsed < m_Info.Duration)
         {
             Transform targetTrans = LogicSystem.FindChildRecursive(this.gameObject.transform, m_Info.BoneName);
             if (null != targetTrans)
             {
                 Vector3 targetDir = m_Info.TargetPos - targetTrans.position;
                 targetTrans.forward = targetDir;
             }
         }
     }
     else
     {
         m_Elapsed = 0;
         m_Info    = null;
     }
 }
Пример #12
0
 public void OnEventMeetEnemy()
 {
     try
     {
         if (null != m_MeetEnemyEffect && !string.IsNullOrEmpty(m_MeetEnemyEffectBone))
         {
             GameObject obj    = ResourceSystem.NewObject(m_MeetEnemyEffect, 2.0f) as GameObject;
             Transform  parent = LogicSystem.FindChildRecursive(
                 transform,
                 m_MeetEnemyEffectBone);
             if (null != parent)
             {
                 obj.transform.parent        = parent;
                 obj.transform.localPosition = UnityEngine.Vector3.zero;
                 obj.transform.localRotation = UnityEngine.Quaternion.identity;
             }
         }
     }
     catch (System.Exception ex)
     {
         ArkCrossEngine.LogicSystem.LogFromGfx("[Error]:Exception:{0}\n{1}", ex.Message, ex.StackTrace);
     }
 }
Пример #13
0
    /// param:Id[对应到SkillSceneObjManager中的AttractBullet Id]
    /// example:1
    public void Trigger_AttractShoot(string param)
    {
#if SHOOTER_LOG
        Debug.Log("Trigger_AttractShoot param:" + param);
#endif
        if (m_SceneObjMgr != null)
        {
            SkillSceneObjInfo             sobjInfo   = new SkillSceneObjInfo(param);
            SceneObject_AttractBulletInfo bulletInfo = m_SceneObjMgr.TryGetAttractBulletInfo(sobjInfo.Id);
            MasterWeaponType masterType    = (MasterWeaponType)(sobjInfo.ExtractNumeric <int>(0, 0));
            GameObject       curMainWeapon = TriggerImpl.GetCurMainWeapon(this.gameObject, masterType);
            if (bulletInfo != null && bulletInfo.SceneObjInfo != null && curMainWeapon != null)
            {
                Transform efSpark = LogicSystem.FindChildRecursive(curMainWeapon.transform,
                                                                   Script_Util.ForceNotifyEffectBone(bulletInfo.SceneObjInfo.EffectParentBone));
                if (null == efSpark)
                {
                    Debug.Log("Trigger_AttractShoot bone miss!");
                    return;
                }
                bulletInfo          = bulletInfo.Clone();
                bulletInfo.Attacker = this.gameObject;
                bulletInfo.SceneObjInfo.EffectPos += efSpark.transform.position;
                bulletInfo.MoveStartPos           += efSpark.transform.position;
                bulletInfo.MoveDir = Quaternion.Euler(efSpark.transform.rotation.eulerAngles + bulletInfo.MoveDir) * Vector3.forward;
                bulletInfo.SceneObjInfo.EffectLiftTime = float.MaxValue;
                bulletInfo.ImpactSrcPos += new Vector3(gameObject.transform.position.x,
                                                       efSpark.transform.position.y, gameObject.transform.position.z);
                GameObject tBulletObj = TriggerImpl.PlayEffect(bulletInfo.SceneObjInfo);
                tBulletObj.SendMessage("Active", bulletInfo);
            }
            else
            {
                Debug.Log("Trigger_AttractShoot null!");
            }
        }
    }
Пример #14
0
        protected void PlayEffect(string effect, string bone, UnityEngine.Vector3 position, UnityEngine.Vector3 rotation, GameObject target, float playTime)
        {
            if (string.IsNullOrEmpty(bone))
            {
                bone = "Bone_Root";
            }
            GameObject obj    = ResourceSystem.NewObject(effect, playTime) as GameObject;
            Transform  parent = LogicSystem.FindChildRecursive(target.transform, bone);

            if (null != obj && null != parent)
            {
                obj.transform.parent        = parent;
                obj.transform.localPosition = position;
                obj.transform.rotation      = UnityEngine.Quaternion.Euler(rotation);
            }
            else if (null == parent)
            {
                LogSystem.Debug("GfxImpactLogic::PlayEffect can't find bone {0} on {1}", bone, target.name);
            }
            else
            {
                LogSystem.Debug("GfxImpactLogic::PlayEffect NewObject return null");
            }
        }