コード例 #1
0
ファイル: ClimbEnter.cs プロジェクト: yqxflong/DashFire
    // Update is called once per frame
    void Update()
    {
        if (Time.time > m_LastBornTime + m_BornInterval)
        {
            m_LastBornTime = Time.time;
            if (null != m_MonsterPrefab)
            {
                GameObject monster = ResourceSystem.NewObject(m_MonsterPrefab) as GameObject;
                if (null != monster)
                {
                    monster.transform.position = this.transform.position;
                    monster.transform.rotation = m_MatchTransform.rotation;
                    m_Monsters.Add(monster);
                    monster.SendMessage("SetMatchTransform", m_MatchTransform);
                }
            }
        }

        /*
         * foreach (GameObject monster in m_Monsters) {
         * Animator animator = monster.GetComponent<Animator>();
         * if (null != animator) {
         *  if (Vector3.Distance(this.transform.position, monster.transform.position) > m_ClimbStopDistance) {
         *    animator.SetBool("StartClimp", true);
         *    monster.transform.position += m_ClimbSpeed * this.transform.up * Time.deltaTime;
         *  } else {
         *    animator.SetBool("StartClimp", false);
         *    animator.SetBool("ClimpEnd", true);
         *  }
         * }
         * }
         */
    }
コード例 #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
        public void AddDamageText(GameEntity entity, string text, long remainTime)
        {
            UnityView view = entity.view.Value as UnityView;

            if (null != view)
            {
                var hudObject = ResourceSystem.NewObject("HudText") as GameObject;
                hudObject.transform.SetParent(UIRoot, false);
                hudObject.transform.localPosition = Vector3.zero;

                DamageInfo hudInfo = new DamageInfo();
                hudInfo.Obj = hudObject;
                UnityEngine.UI.Text uiText = hudObject.GetComponentInChildren <UnityEngine.UI.Text>();
                if (null != uiText)
                {
                    uiText.text = text;
                }

                hudInfo.SelfTransform = hudObject.GetComponentInChildren <RectTransform>();
                hudInfo.Position      = view.gameObject.transform.position + Vector3.up * 2;
                hudInfo.DeleteTime    = Time.time + remainTime / 1000.0f;

                hudInfo.FloatSpeed = m_FloatSpeed;
                hudInfo.Delay      = m_DelayStay + Time.time;
                hudInfo.Movement   = Guidance.LeftUp;

                m_Damages.Add(hudInfo);
            }
        }
コード例 #4
0
ファイル: TouchManager.cs プロジェクト: Klanly/UnityClient
    public void InstallInputProvider(InputProvider inputPrefab)
    {
        if (!inputPrefab)
        {
            //Debug.LogError("Invalid InputProvider (null)");
            return;
        }

        //Debug.Log("TouchManager: using " + inputPrefab.name);

        if (inputProvider)
        {
            Destroy(inputProvider.gameObject);
        }

        inputProvider                  = ResourceSystem.NewObject(inputPrefab) as InputProvider;
        inputProvider.name             = inputPrefab.name;
        inputProvider.transform.parent = this.transform;

        InitFingers(MaxFingers);

        if (OnInputProviderChanged != null)
        {
            OnInputProviderChanged();
        }
    }
コード例 #5
0
        public void LoadAsset(GameEntity entity, uint resId, string asset, float scale, Vector3 position)
        {
            var viewObject = ResourceSystem.NewObject(asset) as GameObject;

            if (null != viewObject)
            {
                viewObject.transform.localScale    = Vector3.one * scale;
                viewObject.transform.localPosition = position;

                var view = viewObject.GetComponent <IView>();
                if (null != view)
                {
                    // add view;
                    view.Init(entity);
                    entity.AddView(view);
                }
                var rigidbody = viewObject.GetComponent <IRigidbody>();
                if (null != rigidbody)
                {
                    entity.AddPhysics(rigidbody, Vector3.zero);
                }

                viewObject.Link(entity, Contexts.sharedInstance.game);
            }
            else
            {
                LogUtil.Error("GfxMoudle.Instantiate new object failed. Resource path is {0}.", asset);
            }
        }
コード例 #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
    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();
        }
    }
コード例 #8
0
    protected void PlayImpactEffect(GameObject effectPrefab, Vector3 position, float playTime)
    {
        GameObject obj = ResourceSystem.NewObject(effectPrefab, playTime) as GameObject;

        if (null != obj)
        {
            obj.transform.position = this.transform.TransformPoint(position);
            obj.transform.rotation = Quaternion.identity;
        }
    }
コード例 #9
0
ファイル: ItemProperty.cs プロジェクト: Klanly/UnityClient
 private void PlayParticle(UnityEngine.Vector3 nguiPos)
 {
     if (effect != null)
     {
         UnityEngine.GameObject ef = ResourceSystem.NewObject(effect) as GameObject;
         if (ef != null)
         {
             nguiPos.Set(-0.17f, nguiPos.y, nguiPos.z);
             ef.transform.position = nguiPos;
             Destroy(ef, duration);
         }
     }
 }
コード例 #10
0
 public void AnimEvent_ThrowSpear()
 {
     if (null != m_SpearPrefab && null != m_SpearInHand)
     {
         GameObject spear = ResourceSystem.NewObject(m_SpearPrefab) as GameObject;
         if (null != spear)
         {
             spear.transform.position = m_SpearInHand.transform.position;
             spear.transform.rotation = Quaternion.LookRotation(m_TargetPos - spear.transform.position);
             spear.SendMessage("SetSender", gameObject);
         }
         m_SpearInHand.SetActive(false);
     }
 }
コード例 #11
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);
            }
        }
コード例 #12
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);
                        effectObj.SetActive(false);
                        UnityEngine.Vector3 pos = obj.transform.position + obj.transform.localRotation * m_Pos;
                        effectObj.transform.position   = pos;
                        effectObj.transform.localScale = m_Scale;
                        if (m_IsRotateRelativeUser)
                        {
                            effectObj.transform.parent        = obj.transform;
                            effectObj.transform.localRotation = m_Dir;
                            effectObj.transform.parent        = null;
                        }
                        else
                        {
                            effectObj.transform.localRotation = m_Dir;
                        }
                        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);
                    }
                    return(false);
                }
                else
                {
                    return(true);
                }
            }
            else
            {
                return(false);
            }
        }
コード例 #13
0
 public void OnDead()
 {
     if (null != m_DeadEffect)
     {
         GameObject deadEffect = ResourceSystem.NewObject(m_DeadEffect, m_DeadEffectDuration) as GameObject;
         if (null != deadEffect)
         {
             deadEffect.transform.position = this.transform.position + this.transform.up * 0.5f;
             deadEffect.transform.rotation = Quaternion.identity;
         }
     }
     else
     {
         Debug.LogError(gameObject.name + " don't have a dead effect");
     }
 }
コード例 #14
0
        private AudioSource CreateNewAudioSource(GameObject obj)
        {
            if (string.IsNullOrEmpty(m_AudioSourceName))
            {
                return(null);
            }
            GameObject audiosource_obj = ResourceSystem.NewObject(
                m_AudioSourceName,
                (m_StartTime + m_AudioSourceLifeTime) / 1000.0f) as GameObject;

            if (audiosource_obj == null)
            {
                return(null);
            }
            if (m_IsBoneSound)
            {
                Transform attach_node = TriggerUtil.GetChildNodeByName(obj, m_BoneName);
                if (attach_node != null)
                {
                    audiosource_obj.transform.parent   = attach_node;
                    audiosource_obj.transform.rotation = UnityEngine.Quaternion.identity;
                    audiosource_obj.transform.position = UnityEngine.Vector3.zero;
                    if (!m_IsAttach)
                    {
                        audiosource_obj.transform.parent = null;
                    }
                }
                else
                {
                    audiosource_obj.transform.position = obj.transform.TransformPoint(m_Position);
                    if (m_IsAttach)
                    {
                        audiosource_obj.transform.parent = obj.transform;
                    }
                }
            }
            else
            {
                audiosource_obj.transform.position = obj.transform.TransformPoint(m_Position);
                if (m_IsAttach)
                {
                    audiosource_obj.transform.parent = obj.transform;
                }
            }
            return(audiosource_obj.GetComponent <AudioSource>());
        }
コード例 #15
0
        private void CreateSceneOrBoneCollider(GameObject obj, float liveTime,
                                               object onTriggerEnter,
                                               object onTriggerExit)
        {
            GameObject collider_obj = ResourceSystem.NewObject(m_Prefab, liveTime) as GameObject;

            if (null == collider_obj)
            {
                LogSystem.Error("------create collider failed! " + m_Prefab);
                return;
            }
            m_Collider = collider_obj;
            Component[] transes = collider_obj.GetComponentsInChildren <Transform>();
            for (int i = 0; i < transes.Length; i++)
            {
                transes[i].gameObject.SendMessage("SetOnTriggerEnter", onTriggerEnter, UnityEngine.SendMessageOptions.DontRequireReceiver);
                transes[i].gameObject.SendMessage("SetOnTriggerExit", onTriggerExit, UnityEngine.SendMessageOptions.DontRequireReceiver);
            }

            /*
             * foreach(Transform child in transes) {
             * child.gameObject.SendMessage("SetOnTriggerEnter", onTriggerEnter, SendMessageOptions.DontRequireReceiver);
             * child.gameObject.SendMessage("SetOnTriggerExit", onTriggerExit, SendMessageOptions.DontRequireReceiver);
             * }*/

            if (m_ColliderType == ColliderType.kSceneCollider)
            {
                UnityEngine.Vector3 pos = obj.transform.position + obj.transform.rotation * m_Position;
                collider_obj.transform.position = pos;
            }
            else
            {
                Transform node = TriggerUtil.GetChildNodeByName(obj, m_Bone);
                if (node != null)
                {
                    collider_obj.transform.parent        = node;
                    collider_obj.transform.localPosition = UnityEngine.Vector3.zero;
                    collider_obj.transform.localRotation = UnityEngine.Quaternion.identity;
                    if (!m_IsAttach)
                    {
                        collider_obj.transform.parent = null;
                    }
                }
            }
        }
コード例 #16
0
 public void OnHitGround()
 {
     try
     {
         if (null != m_OnHitGroundEffect)
         {
             GameObject obj = ResourceSystem.NewObject(m_OnHitGroundEffect, 2.0f) as GameObject;
             if (null != obj)
             {
                 obj.transform.position = new UnityEngine.Vector3(transform.position.x, transform.position.y, transform.position.z);
             }
         }
     }
     catch (System.Exception ex)
     {
         ArkCrossEngine.LogicSystem.LogFromGfx("[Error]:Exception:{0}\n{1}", ex.Message, ex.StackTrace);
     }
 }
コード例 #17
0
        public void AddHudHead(GameEntity entity)
        {
            UnityView view = entity.view.Value as UnityView;

            if (null != view)
            {
                var hudHeadObject = ResourceSystem.NewObject("HudHead") as GameObject;
                hudHeadObject.transform.SetParent(UIRoot, false);

                HudInfo hudInfo = new HudInfo();
                hudInfo.Obj = hudHeadObject;

                hudInfo.SelfTransform = hudHeadObject.GetComponentInChildren <RectTransform>();
                hudInfo.Owner         = view.gameObject.transform;
                hudInfo.DeleteTime    = -1;

                m_HudHeadInfos.Add(view.gameObject.GetInstanceID(), hudInfo);
            }
        }
コード例 #18
0
 public override void StartSkill()
 {
     GeneralStartSkill();
     m_HasDamageSend = false;
     m_HasMove       = false;
     if (null != m_MoveAnim)
     {
         m_AnimationPlayer.Play(m_MoveAnim.name);
     }
     if (null != m_AttackEffect)
     {
         GameObject obj = ResourceSystem.NewObject(m_AttackEffect, 2.0f) as GameObject;
         if (null != obj)
         {
             obj.transform.position = this.transform.position;
             obj.transform.rotation = this.transform.rotation;
         }
     }
 }
コード例 #19
0
    protected void PlayImpactEffect(GameObject effectPrefab, string bone, float playTime)
    {
        GameObject obj    = ResourceSystem.NewObject(effectPrefab, playTime) as GameObject;
        Transform  parent = FindChildRecursive(this.transform, bone);

        if (null != obj && null != parent)
        {
            obj.transform.parent        = parent;
            obj.transform.localPosition = Vector3.zero;
        }
        else if (null != obj)
        {
            Debug.LogWarning("BaseImpact::PlayEffect -- Can't find bone {0} " + bone);
            GameObject.Destroy(obj);
        }
        else
        {
            Debug.LogWarning("BaseImpact::PlayEffect -- Create GameObject Failed.");
        }
    }
コード例 #20
0
 private void ShowDebugObject(UnityEngine.Vector3 pos, int type)
 {
     if (true == m_ShowDebug)
     {
         string res = "";
         if (type == 0)
         {
             res = "BlueCylinder";
         }
         else
         {
             res = "RedCylinder";
         }
         GameObject obj = ResourceSystem.NewObject(res, 1.0f) as GameObject;
         if (null != obj)
         {
             obj.transform.position = pos;
         }
     }
 }
コード例 #21
0
    protected void PlayImpactEffect(GameObject effectPrefab, float playTime, Vector3 postion, Vector3 rotation, string bone = "Bone_Root")
    {
        GameObject obj    = ResourceSystem.NewObject(effectPrefab, playTime) as GameObject;
        Transform  parent = FindChildRecursive(this.transform, bone);

        if (null != obj && null != parent)
        {
            obj.transform.parent        = parent;
            obj.transform.localPosition = postion;
            obj.transform.localRotation = Quaternion.Euler(rotation);
        }
        else if (null != obj)
        {
            Debug.LogWarning("BaseImpact::PlayEffect -- Can't find bone " + bone);
            GameObject.Destroy(obj);
        }
        else
        {
            Debug.LogWarning("BaseImpact::PlayEffect -- Create GameObject Failed");
        }
    }
コード例 #22
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");
     }
 }
コード例 #23
0
 private bool Init()
 {
     m_IsInited       = true;
     m_FadeInEndTime  = m_StartTime + m_FadeInTime;
     m_RemainEndTime  = m_FadeInEndTime + m_RemainTime;
     m_FadeOutEndTime = m_RemainEndTime + m_FadeOutTime;
     m_BlackCameraObj = ResourceSystem.NewObject(m_CameraPerfab) as GameObject;
     if (m_BlackCameraObj == null)
     {
         return(false);
     }
     m_BlackCamera = m_BlackCameraObj.GetComponent <Camera>();
     if (m_BlackCamera == null)
     {
         return(false);
     }
     m_BlackCamera.CopyFrom(Camera.main);
     m_BlackCamera.clearFlags = UnityEngine.CameraClearFlags.Skybox;
     m_BlackCamera.depth      = Camera.main.depth - 1;
     //m_BlackCamera.cullingMask = 0;
     m_OldMask = Camera.main.cullingMask;
     Camera.main.cullingMask = 0;
     Camera.main.clearFlags  = UnityEngine.CameraClearFlags.Nothing;
     foreach (string layer_str in m_IgnoreLayers)
     {
         int layer      = LayerMask.NameToLayer(layer_str);
         int layer_mask = 1 << layer;
         m_BlackCamera.cullingMask = m_BlackCamera.cullingMask & (~layer_mask);
         Camera.main.cullingMask  |= layer_mask;
     }
     if (m_FadeInTime == 0)
     {
         SetBlackPercent(1);
     }
     else
     {
         SetBlackPercent(0);
     }
     return(true);
 }
コード例 #24
0
ファイル: EffectUtil.cs プロジェクト: yqxflong/DashFire
 /// <summary>
 /// 播放特效,指定时间后删除
 /// </summary>
 /// <param name="args"></param>
 public void AddTemporaryEffect(TemporaryEffectArgs args)
 {
     if (null != args)
     {
         UnityEngine.Object original = Resources.Load(args.Resource);
         if (null != original)
         {
             Vector3    pos = new Vector3(args.X, args.Y, args.Z);
             GameObject obj = ResourceSystem.NewObject(original) as GameObject;
             if (null != obj)
             {
                 obj.transform.position = pos;
                 obj.transform.rotation = Quaternion.identity;
                 GameObject.Destroy(obj, args.Duration);
             }
         }
         else
         {
             LogicSystem.LogicLog("Can't load resource {0} !", args.Resource);
         }
     }
 }
コード例 #25
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);
     }
 }
コード例 #26
0
 public override void StartSkill()
 {
     GeneralStartSkill();
     m_HasDamageSend = false;
     m_HasMove       = false;
     if (null != m_BladeEffect)
     {
         GameObject bladeEffect = ResourceSystem.NewObject(m_BladeEffect, 2.0f) as GameObject;
         if (null != bladeEffect)
         {
             bladeEffect.transform.position = this.transform.position;
             bladeEffect.transform.rotation = this.transform.rotation;
         }
     }
     if (null != m_NormalAttackAnim)
     {
         m_AnimationPlayer.Play(m_NormalAttackAnim.name);
     }
     else
     {
         Debug.LogError("Can't find NormalAttackAnim, stop the skill");
     }
 }
コード例 #27
0
 protected void PlayImpactEffect(GameObject effectPrefab, float playTime, Vector3 position, Vector3 rotation, GameObject attacker)
 {
     if (null != attacker)
     {
         Vector3 direction = (attacker.transform.position - this.transform.position).normalized;
         direction = Quaternion.LookRotation(direction).eulerAngles;
         if (Vector3.zero != rotation)
         {
             direction = direction + rotation;
         }
         Vector3.RotateTowards(position, direction, Mathf.PI * 2, 20);
         GameObject obj = ResourceSystem.NewObject(effectPrefab, playTime) as GameObject;
         if (null != obj)
         {
             obj.transform.position = this.transform.TransformPoint(position);
             obj.transform.rotation = Quaternion.Euler(direction);
         }
     }
     else
     {
         Debug.LogWarning("Attacker is null");
     }
 }
コード例 #28
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");
            }
        }
コード例 #29
0
 public void OnEventDead(int npcType)
 {
     try
     {
         GameObject deadEffect = m_DeadEffect;
         if (npcType == (int)NpcTypeEnum.Partner)
         {
             if (null != m_DeadEffectAsPartner)
             {
                 deadEffect = m_DeadEffectAsPartner;
             }
         }
         GameObject obj = ResourceSystem.NewObject(deadEffect, 2.0f) as GameObject;
         if (null != obj)
         {
             UnityEngine.Vector3 upos = this.transform.position + new UnityEngine.Vector3(0f, 0.5f, 0.0f);
             obj.transform.position = new UnityEngine.Vector3(upos.x, upos.y, upos.z);
         }
     }
     catch (System.Exception ex)
     {
         ArkCrossEngine.LogicSystem.LogFromGfx("[Error]:Exception:{0}\n{1}", ex.Message, ex.StackTrace);
     }
 }
コード例 #30
0
    // 防御关卡播放特效 type = 0,1,2,3(被击,防御,挑战,突袭)

    void PlayDefenseEffect(int type)
    {
        UnityEngine.Object     ob                  = CrossObjectHelper.TryCastObject <UnityEngine.GameObject>(ResourceSystem.NewObject(defensEffect));
        UnityEngine.GameObject go                  = UIManager.Instance.GetWindowGoByName("FightUI");
        UnityEngine.Transform  defensPanel         = go.transform.Find("UIPanel_3/UIAnchor-Center");
        UnityEngine.GameObject effect              = NGUITools.AddChild(defensPanel.gameObject, ob);
        DefenseEffect          defenseEffectScript = effect.GetComponent <DefenseEffect>();

        defenseEffectScript.InitType(type);
    }