public override void DoUpdate(float deltaTime)
        {
            if (bindTransforms == null || bindTransforms.Count == 0)
            {
                return;
            }

            actionTarget = SelectionTargetUtil.GetActionTarget(m_Context, aeeData.TargetSelection.Value);
            if (actionTarget == null || actionTarget.TargetType == ActionTargetType.None)
            {
                Leyoutech.Utility.DebugUtility.LogWarning("AddEmitLinkTargetDurationEffectAction", "AddEmitLinkTargetDurationEffectAction::DoEnter->target not found");
                return;
            }

            //Leyoutech.Utility.DebugUtility.LogWarning("连接特效", string.Format("目标,entity = {0},偏移 offset = {1}", actionTarget.TargetEntity, actionTarget.TargetEntityHitPositionOffet));

            foreach (var effect in effects)
            {
                if (actionTarget.TargetType == ActionTargetType.Entity)
                {
                    if (aeeData.TargetSelection.Value.TargetSecondType == Eternity.FlatBuffer.Enums.TargetSecondType.Entity)
                    {
                        EffectActionUtil.ChangeLinkEffectTarget(effect, actionTarget.TargetEntity, Vector3.zero);
                    }
                    else
                    {
                        EffectActionUtil.ChangeLinkEffectTarget(effect, actionTarget.TargetEntity, actionTarget.TargetEntityHitPositionOffet);
                    }
                }
                else
                {
                    EffectActionUtil.ChangeLinkEffectTarget(effect, actionTarget.TargetPosition);
                }
            }
        }
Exemplo n.º 2
0
        public override void Trigger()
        {
            IBaseActionProperty         property = m_Context.GetObject <IBaseActionProperty>();
            AddEntityPositionEffectData data     = GetData <AddEntityPositionEffectData>();

            EffectActionUtil.CreateEffect(data.Address, property.GetRootTransform().position, property.IsMain());
        }
        public override void Trigger()
        {
            IBaseActionProperty         property         = m_Context.GetObject <IBaseActionProperty>();
            AddBindLinkTargetEffectData data             = GetData <AddBindLinkTargetEffectData>();
            IBindNodeActionProperty     bindNodeProperty = m_Context.GetObject <IBindNodeActionProperty>();

            ActionTarget actionTarget = SelectionTargetUtil.GetActionTarget(m_Context, data.TargetSelection.Value);

            if (actionTarget == null || actionTarget.TargetType == ActionTargetType.None)
            {
                Leyoutech.Utility.DebugUtility.LogWarning("AddBindLinkTargetEffectAction", "AddBindLinkTargetEffectAction::Trigger->target not found");
                return;
            }

            List <Transform> bindTransforms = null;

            if (bindNodeProperty.GetPresentation() == null)
            {
                Leyoutech.Utility.DebugUtility.LogWarning("查找挂点", string.Format("bindNodeProperty.GetPresentation() == null ,Entity = {0} ,ItemId = {1} " +
                                                                                "模型未加载完毕,挂点脚本未被赋值!, 此时挂点作 root 处理",
                                                                                property.EntityId(),
                                                                                property.GetItemID()));

                bindTransforms = new List <Transform>();
                bindTransforms.Add(property.GetRootTransform());
            }
            else
            {
                bindTransforms = bindNodeProperty.GetPresentation().GetBindNode(data.NodeType.ToLaunchPoint(), data.NodeIndex);
            }


            foreach (var tran in bindTransforms)
            {
                if (actionTarget.TargetType == ActionTargetType.Entity)
                {
                    if (data.TargetSelection.Value.TargetSecondType == Eternity.FlatBuffer.Enums.TargetSecondType.Entity)
                    {
                        EffectActionUtil.CreateEffect(data.Address, tran, property.IsMain(), actionTarget.TargetEntity, Vector3.zero);
                    }
                    else
                    {
                        EffectActionUtil.CreateEffect(data.Address, tran, property.IsMain(), actionTarget.TargetEntity, actionTarget.TargetEntityHitPositionOffet);
                    }
                }
                else
                {
                    EffectActionUtil.CreateEffect(data.Address, tran, property.IsMain(), actionTarget.TargetPosition);
                }
            }
        }
        public override void Trigger()
        {
            AddEntityBindToTargetEffectData data = GetData <AddEntityBindToTargetEffectData>();

            ActionTarget actionTarget = SelectionTargetUtil.GetActionTarget(m_Context, data.TargetSelection.Value);

            if (actionTarget == null || actionTarget.TargetType == ActionTargetType.None)
            {
                Leyoutech.Utility.DebugUtility.LogWarning("AddBindLinkTargetEffectAction", "AddBindLinkTargetEffectAction::Trigger->target not found");
                return;
            }

            bool isMain = data.TargetSelection.Value.Target == TargetType.Self;

            if (actionTarget.TargetType == ActionTargetType.Position)
            {
                EffectActionUtil.CreateEffect(data.Address, actionTarget.TargetPosition, isMain);
            }
            else if (actionTarget.TargetType == ActionTargetType.Entity)
            {
                if (actionTarget.Entity != null && actionTarget.Entity is SpacecraftEntity shipEntity)
                {
                    List <Transform> bindTransforms = null;
                    if (shipEntity.GetPresentation() == null)
                    {
                        Leyoutech.Utility.DebugUtility.LogWarning("查找挂点", string.Format("bindNodeProperty.GetPresentation() == null ,Entity = {0} ,ItemId = {1} " +
                                                                                        "模型未加载完毕,挂点脚本未被赋值!, 此时挂点作 root 处理",
                                                                                        shipEntity.EntityId(),
                                                                                        shipEntity.GetItemID()));

                        bindTransforms = new List <Transform>();
                        bindTransforms.Add(shipEntity.GetRootTransform());
                    }
                    else
                    {
                        bindTransforms = shipEntity.GetPresentation().GetBindNode(data.NodeType.ToLaunchPoint(), data.NodeIndex);
                    }


                    foreach (var tran in bindTransforms)
                    {
                        EffectActionUtil.CreateEffect(data.Address, tran, isMain);
                    }
                }
                else
                {
                    Debug.LogError("AddEntityBindToTargetEffectAction::Trigger->Target is not a Ship");
                }
            }
        }
        public override void DoEnter()
        {
            EmitSelectionData   emitSelectionData = m_Context.GetObject <SkillRunningData>().EmitSelectoin;
            IBaseActionProperty property          = m_Context.GetObject <IBaseActionProperty>();

            AddEmitDurationEffectData data = GetData <AddEmitDurationEffectData>();

            EmitData[] emitDatas = emitSelectionData.GetEmits(data.EmitIndex);
            IBindNodeActionProperty bindNodeProperty = m_Context.GetObject <IBindNodeActionProperty>();

            for (int i = 0; emitDatas != null && i < emitDatas.Length; i++)
            {
                EmitData emitData = emitDatas[i];

                List <Transform> bindTransforms = null;
                if (bindNodeProperty.GetPresentation() == null)
                {
                    Leyoutech.Utility.DebugUtility.LogWarning("查找挂点", string.Format("bindNodeProperty.GetPresentation() == null ,Entity = {0} ,ItemId = {1} " +
                                                                                    "模型未加载完毕,挂点脚本未被赋值!, 此时挂点作 root 处理",
                                                                                    property.EntityId(),
                                                                                    property.GetItemID()));

                    bindTransforms = new List <Transform>();
                    bindTransforms.Add(property.GetRootTransform());
                }
                else
                {
                    bindTransforms = bindNodeProperty.GetPresentation().GetBindNode(emitData.NodeType.ToLaunchPoint(), emitData.NodeIndex);
                }


                foreach (var tran in bindTransforms)
                {
                    EffectController effect = EffectActionUtil.CreateEffect(data.Address, tran, property.IsMain());
                    effects.Add(effect);
                }
            }
        }
        public override void DoEnter()
        {
            EmitSelectionData emitSelectionData = m_Context.GetObject <SkillRunningData>().EmitSelectoin;

            // IBaseActionProperty property = m_Context.GetObject<IBaseActionProperty>();
            // AddEmitLinkTargetDurationEffectData data = GetData<AddEmitLinkTargetDurationEffectData>();
            EmitData[] emitDatas = emitSelectionData.GetEmits(aeeData.EmitIndex);
            if (emitDatas == null || emitDatas.Length == 0)
            {
                Leyoutech.Utility.DebugUtility.LogWarning("AddEmitLinkTargetDurationEffectAction", "AddEmitLinkTargetDurationEffectAction::DoEnter->emitData not found");
                return;
            }

            actionTarget = SelectionTargetUtil.GetActionTarget(m_Context, aeeData.TargetSelection.Value);
            if (actionTarget == null || actionTarget.TargetType == ActionTargetType.None)
            {
                Leyoutech.Utility.DebugUtility.LogWarning("AddEmitLinkTargetDurationEffectAction", "AddEmitLinkTargetDurationEffectAction::DoEnter->target not found");
                return;
            }

            IBindNodeActionProperty bindNodeProperty = m_Context.GetObject <IBindNodeActionProperty>();

            for (int i = 0; i < emitDatas.Length; ++i)
            {
                EmitData emitData = emitDatas[i];

                if (bindNodeProperty.GetPresentation() == null)
                {
                    Leyoutech.Utility.DebugUtility.LogWarning("查找挂点", string.Format("bindNodeProperty.GetPresentation() == null ,Entity = {0} ,ItemId = {1}" +
                                                                                    "模型未加载完毕,挂点脚本未被赋值!, 此时挂点作 root 处理",
                                                                                    property.EntityId(),
                                                                                    property.GetItemID()
                                                                                    ));

                    bindTransforms = new List <Transform>();
                    bindTransforms.Add(property.GetRootTransform());
                }
                else
                {
                    bindTransforms = bindNodeProperty.GetPresentation().GetBindNode(emitData.NodeType.ToLaunchPoint(), emitData.NodeIndex);
                }

                foreach (var tran in bindTransforms)
                {
                    EffectController effect = null;
                    if (actionTarget.TargetType == ActionTargetType.Entity)
                    {
                        if (aeeData.TargetSelection.Value.TargetSecondType == Eternity.FlatBuffer.Enums.TargetSecondType.Entity)
                        {
                            effect = EffectActionUtil.CreateEffect(aeeData.Address, tran, property.IsMain(), actionTarget.TargetEntity, Vector3.zero);
                        }
                        else
                        {
                            effect = EffectActionUtil.CreateEffect(aeeData.Address, tran, property.IsMain(), actionTarget.TargetEntity, actionTarget.TargetEntityHitPositionOffet);
                        }
                    }
                    else
                    {
                        effect = EffectActionUtil.CreateEffect(aeeData.Address, tran, property.IsMain(), actionTarget.TargetPosition);
                    }
                    if (effect != null)
                    {
                        effects.Add(effect);
                    }
                }
            }
        }
Exemplo n.º 7
0
        public override void Trigger()
        {
            EmitSelectionData       emitSelectionData = m_Context.GetObject <SkillRunningData>().EmitSelectoin;
            IBaseActionProperty     property          = m_Context.GetObject <IBaseActionProperty>();
            IBindNodeActionProperty bindNodeProperty  = m_Context.GetObject <IBindNodeActionProperty>();

            AddEmitEffectData data = GetData <AddEmitEffectData>();

            bool    isChangeEffectToward = false;
            Vector3 targetPosition       = Vector3.zero;

            if (data.IsTowardToTarget)
            {
                isChangeEffectToward = true;
                ActionTarget actionTarget = SelectionTargetUtil.GetActionTarget(m_Context, data.TargetSelection.Value);
                if (actionTarget == null || actionTarget.TargetType == ActionTargetType.None)
                {
                    Leyoutech.Utility.DebugUtility.LogWarning("AddBindLinkTargetEffectAction", "AddBindLinkTargetEffectAction::Trigger->target not found");
                    isChangeEffectToward = false;
                }
                else if (actionTarget.TargetType == ActionTargetType.Position)
                {
                    targetPosition = actionTarget.TargetPosition;
                }
                else if (actionTarget.TargetType == ActionTargetType.Entity)
                {
                    targetPosition = actionTarget.TargetEntity.position;
                }
            }

            EmitData[] emitDatas = emitSelectionData.GetEmits(data.EmitIndex);//获取发射口  index= -1,表示所有发射口
            if (emitDatas != null && emitDatas.Length > 0)
            {
                for (int i = 0; emitDatas != null && i < emitDatas.Length; i++)
                {
                    EmitData emitData = emitDatas[i];

                    List <Transform> bindTransforms = null;
                    if (bindNodeProperty.GetPresentation() == null)
                    {
                        Leyoutech.Utility.DebugUtility.LogWarning("查找挂点", string.Format("bindNodeProperty.GetPresentation() == null ,Entity = {0} ,ItemId = {1} " +
                                                                                        "模型未加载完毕,挂点脚本未被赋值!, 此时挂点作 root 处理",
                                                                                        property.EntityId(),
                                                                                        property.GetItemID()
                                                                                        ));

                        bindTransforms = new List <Transform>();
                        bindTransforms.Add(property.GetRootTransform());
                    }
                    else
                    {
                        bindTransforms = bindNodeProperty.GetPresentation().GetBindNode(emitData.NodeType.ToLaunchPoint(), emitData.NodeIndex);
                    }


                    foreach (var tran in bindTransforms)
                    {
                        EffectController effect = EffectActionUtil.CreateEffect(data.Address, tran, property.IsMain());
                        if (isChangeEffectToward)
                        {
                            Vector3 dir = (targetPosition - tran.position).normalized;
                            effect.CachedTransform.forward = dir;
                        }
                    }
                }
            }
            else
            {
            }
        }