public void OnLoadSuccess <T>(T source, UnityObject unityObj)
        {
            if (null == unityObj || null == unityObj.AsGameObject)
            {
                _assetInfo = AssetInfo.EmptyInstance;
                return;
            }

            if (!unityObj.AsGameObject.activeSelf)
            {
                Logger.ErrorFormat("unityObj:  {0}  is unActive", unityObj.Address);
                _assetInfo = AssetInfo.EmptyInstance;
                return;
            }

            Logger.InfoFormat("Load Weapon: {0}", unityObj.Address);

            SetObjParam(unityObj, UnityLayerManager.GetLayerIndex(EUnityLayerName.Player));

            if (!unityObj.Address.Equals(_assetInfo))
            {
                AddRecycleObject(unityObj);
                _assetInfo = AssetInfo.EmptyInstance;
                return;
            }

            _action(unityObj, _assetId);

            EffectUtility.ReflushGodModeEffect(_rootGo, unityObj.AsGameObject);
            _assetInfo = AssetInfo.EmptyInstance;
        }
        public void OnLoadSucc(PlayerEntity player, UnityObject unityObj)
        {
            GameObject go          = unityObj.AsGameObject;
            var        parentTrans = GetParentTransform(player);

            go.transform.SetParent(parentTrans);
            go.transform.localPosition = new Vector3(0, 0, 0);
            go.transform.localRotation = Quaternion.identity;
            go.transform.localScale    = Vector3.one;

            var addEffectCurFrame = !player.hasEffects;

            if (addEffectCurFrame)
            {
                player.AddEffects();
            }
            player.effects.AddLocalEffect(unityObj);
            EffectUtility.RegistEffect(player.RootGo().gameObject, unityObj.AsGameObject);

            if (addEffectCurFrame)
            {
                RegistAllGodModeEffects(player);
                RegistAllAbstractMono(player);
            }

            Logger.InfoFormat("{0} addEffect {1}", player.RootGo().name, unityObj.AsGameObject.name);
        }
Beispiel #3
0
    void SetGesture()
    {
        var color = EffectUtility.Vector2ToColor(GestureManager.Piano.Value);

        foreach (var tile in _tiles)
        {
            tile.material.color = color;
        }
    }
        public void AddWardrobe(WardrobeParam param)
        {
            if (null != param.DefaultGameObject && null != param.DefaultGameObject.AsGameObject)
            {
                Logger.InfoFormat("CharacterLog-- CharacterAvatar Add Wardrobe:  {0}", param.DefaultGameObject.AsGameObject.name);
            }

            // 先移除对应位置
            RemoveWardrobe(param.Type, false);

            _wardrobes[(int)param.Type] = param;

            // 蒙皮or硬挂
            PutOn(param.DefaultGameObject, (int)param.Type, param.IsSkinned, param.NeedMappingBones);
            EffectUtility.ReflushGodModeEffect(_rootGo, param.DefaultGameObject);
            EffectUtility.RegistEffect(_rootGo, param.DefaultGameObject.AsGameObject);

            if (param.HasAlterAppearance)
            {
                PutOn(param.AlternativeGameObject, (int)param.Type + AlternativeStartNum, param.IsSkinned, param.NeedMappingBones);
                EffectUtility.ReflushGodModeEffect(_rootGo, param.AlternativeGameObject);
            }

            // 设置显示状态,由其他位置决定
            RefreshSingleWardrobeDefault(param,
                                         _wardrobesStatus.GetDefaultEnabled(param.Type));
            RefreshSingleWardrobeAlter(param,
                                       _wardrobesStatus.GetAlterEnabled(param.Type));
            RefreshSingleWardrobeMask(param,
                                      _wardrobesStatus.GetFirstMaskProvider(param.Type),
                                      _wardrobesStatus.GetMaskEnabled(param.Type));

            // 影响其他位置的显示状态
            RegisterAlternativeAppearance(param);
            // 影响其他位置的显示
            ShowAccordingToStatus();

            // 背包挂点
            AddBag(param);

            //通知TA
            TaaHelper();

            //force set lod by addWardrobe
            ForceCurrentLod();

            // avatar effect
            SetBindingPointBones(param);
        }
 public FirstViewMotor(Motors m) : base(m)
 {
     _motors.ActionManager.AddAction(CameraActionType.Enter, SubCameraMotorType.View, (int)ModeId, (player, state) =>
     {
         if (player.hasAppearanceInterface && !player.appearanceInterface.Appearance.IsFirstPerson)
         {
             player.appearanceInterface.Appearance.SetFirstPerson();
             player.characterBoneInterface.CharacterBone.SetFirstPerson();
             player.UpdateCameraArchorPostion();
             var playerUtils = EffectUtility.GetEffect(player.RootGo(), "PlayerUtils");
             if (playerUtils != null)
             {
                 playerUtils.SetParam("FirstViewBegin", (object)player.RootGo().gameObject);
             }
         }
     });
 }
        public virtual void OnLoadAsset(XmlReader reader)
        {
            switch (reader.Name)
            {
            case "Skill":
            {
                Name          = reader.GetAttrString("Name", string.Empty);
                Cooldown      = reader.GetAttrFloat("Cooldown", 0.0f);
                CastTime      = reader.GetAttrFloat("Casttime", 0.0f);
                Range         = reader.GetAttrFloat("Range", 0.0f);
                Delay         = reader.GetAttrFloat("Delay", 0.0f);
                Interruptable = reader.GetBoolAttribute("Interruptable", false);
                RequiredLevel = reader.GetAttrInt("Level", 0);
            }
            break;

            case "Effect":
            {
                string skillEffectAssetType = reader.GetAttrString("AssetType", "");
                var    asset = EffectUtility.CreateAssetOfType(skillEffectAssetType);
                if (asset != null)
                {
                    Effects.Add(asset);
                    Effects[Effects.Count - 1].OnLoadAsset(reader);
                }
            }
            break;

            case "Prerequisite":
            {
                var asset = new SkillPrerequisiteAsset();
                Prerequisites.Add(asset);
                Prerequisites [Prerequisites.Count - 1].OnLoadAsset(reader);
            }
            break;

            default:
            {
                if (Effects.Count > 0)
                {
                    Effects [Effects.Count - 1].OnLoadAsset(reader);
                }
            }
            break;
            }
        }
 public override void OnLoadAsset(System.Xml.XmlReader reader)
 {
     base.OnLoadAsset(reader);
     switch (reader.Name)
     {
     case "Effect":
     {
         string skillEffectAssetType = reader.GetAttrString("AssetType", "");
         var    asset = EffectUtility.CreateAssetOfType(skillEffectAssetType);
         if (asset != null)
         {
             Effects.Add(asset);
             Effects[Effects.Count - 1].OnLoadAsset(reader);
         }
     }
     break;
     }
 }
        private void CloseEye()
        {
            try
            {
                _subCloseEyeInfo.BeginProfileOnlyEnableProfile();

                var script = EffectUtility.GetEffect(_characterRoot, BlinkEyeScriptName);
                if (script == null)
                {
                    return;
                }
                script.SetParam("Enable", false);
            }
            finally
            {
                _subCloseEyeInfo.EndProfileOnlyEnableProfile();
            }
        }
Beispiel #9
0
 private void OnGUI()
 {
     if (!CheckView())
     {
         return;
     }
     if (EffectUtility.CheckRepaint(ref IsDone))
     {
         try
         {
             DrawViews();
         }
         catch (ArgumentException e)
         {
             Repaint();
         }
         Repaint();
     }
 }
Beispiel #10
0
 public void Convert(Entity entity, EntityManager dstManager, int abilityIndex)
 {
     EffectUtility.AddCost <ManaCostBuffer, ManaCost>(entity, dstManager, abilityIndex, this);
 }
Beispiel #11
0
        public GunSightMotor(Motors m) : base(m)
        {
            _motors.ActionManager.AddAction(CameraActionType.Enter, SubCameraMotorType.View, (int)ModeId,
                                            (player, state) =>
            {
                if (!player.hasAppearanceInterface)
                {
                    return;
                }
                if (!player.appearanceInterface.Appearance.IsFirstPerson)
                {
                    player.appearanceInterface.Appearance.SetFirstPerson();
                    player.characterBoneInterface.CharacterBone.SetFirstPerson();
                    player.UpdateCameraArchorPostion();
                }
            });

            _motors.ActionManager.AddAction(CameraActionType.Enter, SubCameraMotorType.View, (int)ModeId,
                                            (player, state) =>
            {
                if (!player.hasAppearanceInterface)
                {
                    return;
                }
                var playerUtils = EffectUtility.GetEffect(player.RootGo(), "PlayerUtils");
                if (playerUtils != null)
                {
                    playerUtils.SetParam("GunViewBegin", (object)player.RootGo().gameObject);
                }
            });

            _motors.ActionManager.AddAction(CameraActionType.Enter, SubCameraMotorType.View, (int)ModeId,
                                            (player, state) =>
            {
                if (!player.hasAppearanceInterface)
                {
                    return;
                }
                var speed = player.WeaponController().HeldWeaponAgent.CmrFocusSpeed;
                player.stateInterface.State.SetSight(speed);
                Logger.InfoFormat("Enter sight!");
            });

            _motors.ActionManager.AddAction(CameraActionType.Enter, SubCameraMotorType.View, (int)ModeId,
                                            (player, state) =>
            {
                if (!player.hasAppearanceInterface)
                {
                    return;
                }
                player.AudioController().PlaySimpleAudio(EAudioUniqueId.SightOpen, true);
            });

            _motors.ActionManager.AddAction(CameraActionType.Enter, SubCameraMotorType.View, (int)ModeId,
                                            (player, state) =>
            {
                if (!player.hasAppearanceInterface)
                {
                    return;
                }
                OpenDepthOfField(player);
            });

            _motors.ActionManager.AddAction(CameraActionType.Leave, SubCameraMotorType.View, (int)ModeId,
                                            (player, state) =>
            {
                var speed = player.WeaponController().HeldWeaponAgent.CmrFocusSpeed;
                player.stateInterface.State.CancelSight(speed);
                Logger.InfoFormat("Leave sight!");
            });

            _motors.ActionManager.AddAction(CameraActionType.Leave, SubCameraMotorType.View, (int)ModeId,
                                            (player, state) =>
            {
                var playerUtils = EffectUtility.GetEffect(player.RootGo(), "PlayerUtils");
                if (playerUtils != null)
                {
                    playerUtils.SetParam("GunViewEnd", (object)player.RootGo().gameObject);
                }
            });

            _motors.ActionManager.AddAction(CameraActionType.Leave, SubCameraMotorType.View, (int)ModeId,
                                            (player, state) =>
            {
                player.AudioController().PlaySimpleAudio(EAudioUniqueId.SightClose, true);
            });

            _motors.ActionManager.AddAction(CameraActionType.Leave, SubCameraMotorType.View, (int)ModeId,
                                            (player, state) =>
            {
                CloseDepthOfField(player);
            });
        }
        public void RemoveWardrobe(Wardrobe position, bool updateAppearance = true)
        {
            if (_wardrobes[(int)position] == null)
            {
                return;
            }

            if (null != _wardrobes[(int)position] &&
                null != _wardrobes[(int)position].DefaultGameObject &&
                null != _wardrobes[(int)position].DefaultGameObject.AsGameObject)
            {
                Logger.InfoFormat("CharacterLog-- CharacterAvatar Remove Wardrobe:  {0}", _wardrobes[(int)position].DefaultGameObject.AsGameObject.name);
            }

            var param = _wardrobes[(int)position];

            _wardrobes[(int)position] = null;

            // 移除显示
            TakeOff(param.DefaultGameObject);
            AddRecycleObject(param.DefaultGameObject);
            EffectUtility.DeleteGodModeEffect(_rootGo, param.DefaultGameObject);

            if (param.AlternativeGameObject != null)
            {
                TakeOff(param.AlternativeGameObject);
                AddRecycleObject(param.AlternativeGameObject);
                EffectUtility.DeleteGodModeEffect(_rootGo, param.AlternativeGameObject);
            }

            // 移除对其他位置的影响
            UnregisterAlternativeAppearance(param);

            // 更新其他位置的显示
            if (updateAppearance)
            {
                ShowAccordingToStatus();
            }

            // 移除RootBone映射
            if (_mappingBones.ContainsKey((int)position))
            {
                _mappingBones.Remove((int)position);
            }
            if (_mappingBones.ContainsKey((int)position + AlternativeStartNum))
            {
                _mappingBones.Remove((int)position + AlternativeStartNum);
            }

            if (_allAvatarBones.ContainsKey(position))
            {
                ResetAvatarRenderBones(_allAvatarBones[position], param.DefaultGameObject);
                if (param.AlternativeGameObject != null)
                {
                    ResetAvatarRenderBones(_allAvatarBones[position], param.AlternativeGameObject);
                }
            }

            // 背包挂点
            RemoveBag(position);

            //通知TA
            TaaHelper();
        }
Beispiel #13
0
 // Mandatory for Authoring, do not edit
 public void Convert(Entity entity, EntityManager dstManager, int abilityIndex)
 {
     EffectUtility.AddEffect <Effect2Buffer, Effect2>(entity, dstManager, abilityIndex, this);
 }
Beispiel #14
0
        // YOUR CODE : delcare all necesasry data inherant to the effect consumption, could be a the effect power, damage type,...



        // Mandatory for Authoring, do not edit
        public void Convert(Entity entity, EntityManager dstManager, int abilityIndex)
        {
            EffectUtility.AddEffect <TestEmptyEffectBuffer, TestEmptyEffect>(entity, dstManager, abilityIndex, this);
        }
Beispiel #15
0
 public void WeaponOrAttachmentDel(GameObject obj)
 {
     EffectUtility.DeleteGodModeEffect(_characterRoot, obj);
 }
Beispiel #16
0
 public void Convert(Entity entity, EntityManager dstManager, int skillIndex)
 {
     EffectUtility.AddEffect <Effect1Buffer, Effect1>(entity, dstManager, skillIndex, this);
 }
Beispiel #17
0
    void OnSkillFxPlayCallBack(EffectUtility.FxPlayParam param)
    {
        if(null == param) return;

        SkillEffect skillEffect = (SkillEffect)param.userParam;
        if(skillEffect.SkillEffectType == ESkillEffectType.TrackTarget || null != SelectTarget)
        {
            if(null != param.objFx && param.state == EffectUtility.FxPlayState.Begin)
            {
                param.objFx.transform.parent = null;
                FxTracker fxTracker = UnityTools.EnsureComponent<FxTracker>(param.objFx);
                fxTracker.speed = skillEffect.EffectSpeed;
                fxTracker.threshold = 0.01f;
                fxTracker.msgParam = param;
                fxTracker.onFxCallBack = OnFxTrackerCallBack;
                Transform target = SelectTarget.transform;
                if(null != target)
                {
                    Transform hp = GetHardPoint(target, GetHardPointName(skillEffect.TargetHardPoint));
                    if(null != hp) target = hp;
                }
                fxTracker.Target = target;
            }
        }
    }
        public void OnLoadSucc(PlayerEntity player, UnityObject unityObj)
        {
            GameObject go = unityObj;

            HandleLoadedModel(player, go);

            if (player.hasFirstPersonModel)
            {
                _assetManager.Recycle(player.firstPersonModel.UnityObjectValue);
                player.RemoveAsset(player.firstPersonModel.UnityObjectValue);
            }

            player.ReplaceFirstPersonModel(go, unityObj);

            player.AddAsset(unityObj);

            player.appearanceInterface.FirstPersonAppearance =
                new FirstPersonAppearanceManager(player.firstPersonAppearance);

            go.name = "P1_" + player.entityKey;
            go.transform.SetParent(player.RootGo().transform);
            go.transform.localPosition = new Vector3(0, player.firstPersonAppearance.FirstPersonHeight,
                                                     player.firstPersonAppearance.FirstPersonForwardOffset);
            go.transform.localRotation = Quaternion.identity;
            go.transform.localScale    = Vector3.one;
            Logger.InfoFormat("P1 loaded: {0}", player.entityKey);

            player.ReplaceFirstPersonAnimator(go.GetComponent <Animator>());

            var ik = go.AddComponent <PlayerIK>();

            ik.SetAnimator(AvatarIKGoal.LeftHand, player.firstPersonAnimator.UnityAnimator);
            ik.SetIKLayer(AvatarIKGoal.LeftHand, NetworkAnimatorLayer.FirstPersonIKPassLayer);
            ik.SetAnimator(AvatarIKGoal.RightHand, player.firstPersonAnimator.UnityAnimator);
            ik.SetIKLayer(AvatarIKGoal.RightHand, NetworkAnimatorLayer.FirstPersonIKPassLayer);

            BoneTool.CacheTransform(go);

            if (player.isFlagSelf)
            {
                var animationEvent = go.AddComponent <AnimationClipEvent>();
                animationEvent.Player = player;
                player.animatorClip.ClipManager.SetAnimationCleanEventCallback(animationEvent
                                                                               .InterruptAnimationEventFunc);
            }
            else
            {
                go.AddComponent <ThirdPersonAnimationClipEvent>();
            }

            player.firstPersonAnimator.UnityAnimator.Update(0);

            player.appearanceInterface.Appearance.SetRootGo(player.RootGo());
            player.appearanceInterface.Appearance.SetFirstPersonCharacter(go);
            player.appearanceInterface.FirstPersonAppearance.SetFirstPersonCharacter(go);

            player.appearanceInterface.Appearance.SetAnimatorP1(player.firstPersonAnimator.UnityAnimator);

            player.stateInterface.State.SetName(player.RootGo().name);

            player.characterBoneInterface.CharacterBone.SetFirstPersonCharacter(go);

            player.ReplaceFpAnimStatus(
                NetworkAnimatorUtil.CreateAnimatorLayers(player.firstPersonAnimator.UnityAnimator),
                NetworkAnimatorUtil.GetAnimatorParams(player.firstPersonAnimator.UnityAnimator));

            // 禁用非可见状态下的动画更新
            if (!player.isFlagSelf)
            {
                player.firstPersonAnimator.UnityAnimator.cullingMode = AnimatorCullingMode.CullUpdateTransforms;
            }
            else
            {
                player.firstPersonAnimator.UnityAnimator.cullingMode = AnimatorCullingMode.AlwaysAnimate;
            }

            var playerUtils = GameObject.Instantiate(Resources.Load <GameObject>("PlayerUtils"));

            EffectUtility.RegistEffect(player.RootGo().gameObject, playerUtils);
            playerUtils.transform.parent = EffectUtility.GetEffectNode(player.RootGo());

            // 处理显隐
            if (player.hasGamePlay)
            {
                PlayerEntityUtility.SetVisibility(go, player.gamePlay.Visibility);
            }
        }
Beispiel #19
0
 public void WeaponOrAttachmentAdd(GameObject obj)
 {
     EffectUtility.ReflushGodModeEffect(_characterRoot, obj);
 }