Exemple #1
0
    public static void Update()
    {
        if (!SafeZoneEffectInstance || !isHaveData)
        {
            return;
        }
        if (!Initialize.mainCam)
        {
            return;
        }

        UpdateZoneVisible();
        if (!isStarting)
        {
            return;
        }


        SafeZoneEffectInstance.SetScale(SafeZone.currRadius * RadiusCorrectionFactor);
        SafeZoneTransform.SetPosition(SafeZone.currPos);
        ModifyMaterialThickNess();


        isStarting = SafeZone.isSpreadStarted;
    }
    public void ApplyPlayData(EffectResHandlePlayData data)
    {
        if (null == data)
        {
            return;
        }

        if (!Valid)
        {
            return;
        }

        if (isCached)
        {
            data.ClearDirtyData();
            return;
        }
        if (!m_effectNode)
        {
            return;
        }
        if (data.ParentDirty)
        {
            m_effectPrefab.SetActive(false);
            data.parent.gameObject.name = m_effectPrefab.name + "-Agent";
            m_effectPrefabTransform.SetParent(data.parent);
            m_effectPrefabTransform.localPosition = Vector3.zero;
            m_effectPrefabTransform.localRotation = Quaternion.identity;
            m_effectPrefab.SetActive(true);
        }
        //暂不支持
        //if (data.SpeedDirty)
        //{
        //    m_effectNode.SetParticleSpeed(data.Speed);
        //}
        if (data.SizeScaleDirty)
        {
            m_effectNode.SetScale(data.SizeScale);
        }

        if (data.effectColliderLayerDirty)
        {
            EffectUtily.SetEffectColliderLayer(data.effectColliderLayer, m_effectNode.effectColliders);
        }
        if (data.broadcastfuncNameDirty)
        {
            m_effectPrefab.BroadcastMessage(data.broadcastfuncName, SendMessageOptions.DontRequireReceiver);
        }
        if (data.AddhitEventDirty)
        {
            m_effectNode.hitEvent += data.AddhitEvent;
        }
        if (data.ReducehitEventDirty)
        {
            m_effectNode.hitEvent -= data.ReducehitEvent;
        }

        if (data.AddAttackCollisionHandleDirty)
        {
            if (m_AttackGroup)
            {
                m_AttackGroup.collisionEvent += data.AddAttackCollisionHandle;
            }
        }

        if (data.ReduceAttackCollisionHandleDirty)
        {
            if (m_AttackGroup)
            {
                m_AttackGroup.collisionEvent -= data.ReduceAttackCollisionHandle;
            }
        }
        if (data.Attack_nFeedBackIDDirty)
        {
            if (m_AttackGroup)
            {
                m_AttackGroup.nFeedBackID = data.Attack_nFeedBackID;
            }
        }
        if (data.Attack_nAttackEntityIDDirty)
        {
            if (m_AttackGroup)
            {
                m_AttackGroup.nAttackEntityID = data.Attack_nAttackEntityID;
            }
        }
        if (data.Attack_bEnableCollisionDirty)
        {
            if (m_AttackGroup)
            {
                m_AttackGroup.bEnableCollision = data.Attack_bEnableCollision;
            }
        }

        if (data.Attack_eventHandlerCountDirty)
        {
            if (m_AttackGroup)
            {
                m_AttackGroup.eventHandlerCount = data.Attack_eventHandlerCount;
            }
        }



        if (data.bPlayDirty || data.isEnemyDirty || data.entityIDDirty || data.SrcTransformDirty || data.DstTransformDirty || data.playMaskDirty || data.bRePlayDirty)
        {
            if (data.bRePlay)
            {
                m_effectNode.StopEffect();
            }

            if (data.bPlay || data.bRePlay)
            {
                m_effectNode.PlayEffect(data.isEnemy, data.entityID, data.SrcTransform, data.DstTransform, data.playMask);
            }
            else
            {
                m_effectNode.StopEffect();
            }
        }
        data.ClearDirtyData();
    }