Exemplo n.º 1
0
 public void SetValues(
     SizingConfig sizingConfig,
     NoiseConfig noiseConfig,
     FalloffConfig falloffConfig,
     ColorConfig colorConfig,
     BackgroundColorConfig backgroundColorConfig,
     OutlineConfig outlineConfig,
     SymmetryConfig symmetryConfig,
     SymmetryConfig3D symmetryConfig3D,
     ScalingConfig scalingConfig,
     AnimationConfig animationConfig,
     ShadingConfig shadingConfig,
     CleanupConfig cleanupConfig,
     NormalsConfig normalsConfig
     )
 {
     this.sizingConfig          = sizingConfig;
     this.noiseConfig           = noiseConfig;
     this.falloffConfig         = falloffConfig;
     this.colorConfig           = colorConfig;
     this.backgroundColorConfig = backgroundColorConfig;
     this.outlineConfig         = outlineConfig;
     this.symmetryConfig        = symmetryConfig;
     this.symmetryConfig3D      = symmetryConfig3D;
     this.scalingConfig         = scalingConfig;
     this.animationConfig       = animationConfig;
     this.shadingConfig         = shadingConfig;
     this.cleanupConfig         = cleanupConfig;
     this.normalsConfig         = normalsConfig;
 }
Exemplo n.º 2
0
 public Animation(AnimationConfig config) : base()
 {
     foreach (AnimationConfigDetail detail in config.Details)
     {
         this.Add(detail.Name, new AnimationDetail(detail));
     }
 }
Exemplo n.º 3
0
    public void Init(BodyShell ownerShell)
    {
        animationCfg = Root.ConfigManager.Animation;

        ownerShell.OnStanceChanged    += OnStanceChanged;
        ownerShell.OnBodyStateChanged += OnBodyStateChanged;
        ownerShell.OnBlockFinished    += OnBlockFinished;
    }
Exemplo n.º 4
0
 protected override void Enter()
 {
     //base.Enter();
     //通过animator controller 控制动画转换
     //_animator.SetTrigger(_paramName);
     _animator.SetInteger("State", _stateCode);
     AnimationConfig.SetAnimNameState(_animName, _stateCode);
 }
Exemplo n.º 5
0
 public AnimationSystem(SystemConfig inConfig) : base(inConfig)
 {
     if (inConfig != null)
     {
         _config = inConfig as AnimationConfig;
     }
     _index          = 0;
     _frameRateTimer = new Timer(_config.duration, NextFrame);
 }
Exemplo n.º 6
0
    public void Init()
    {
        animationCfg = Root.ConfigManager.Animation;

        blockComboLabel.text = "0";

        //Hide fence command label
        fenceCommandLabel.enabled = false;

        Root.FightController.OnUserBlock      += FightController_OnUserBlock;
        Root.PlayerInput.OnFirstButtonPressed += OnUserFirstButtonPressed;
    }
Exemplo n.º 7
0
 public EndGameController(
     EndGamePopUpHandler endGamePopUpHandler,
     IGrid grid,
     TetrominoSpawner tetrominoSpawner,
     MovementController movementController,
     AnimationConfig animationConfig)
 {
     _endGamePopUpHandler = endGamePopUpHandler;
     _grid               = grid;
     _tetrominoSpawner   = tetrominoSpawner;
     _movementController = movementController;
     _animationConfig    = animationConfig;
 }
Exemplo n.º 8
0
 public void Copy(ConfigurationAsset source)
 {
     sizingConfig          = source.sizingConfig;
     noiseConfig           = source.noiseConfig;
     falloffConfig         = source.falloffConfig;
     colorConfig           = source.colorConfig;
     backgroundColorConfig = source.backgroundColorConfig;
     outlineConfig         = source.outlineConfig;
     symmetryConfig        = source.symmetryConfig;
     symmetryConfig3D      = source.symmetryConfig3D;
     scalingConfig         = source.scalingConfig;
     animationConfig       = source.animationConfig;
     shadingConfig         = source.shadingConfig;
     cleanupConfig         = source.cleanupConfig;
     normalsConfig         = source.normalsConfig;
 }
Exemplo n.º 9
0
        public void UpdateAnimationConfig(AnimationConfig config)
        {
            residenceTimeSpan  = AnimationConfig.ResidenceTime;
            residenceTimeCount = 0;

            if (AnimationConfig.IsUseGif)
            {
                TIME_INTERVAL        = 10;
                gifResidenceTimeSpan = residenceTimeSpan / 10;
            }
            else
            {
                TIME_INTERVAL = (int)(100 / AnimationConfig.AnimationSpeedFactor);
                //if (TIME_INTERVAL > 500) TIME_INTERVAL = 500;
                //if (TIME_INTERVAL < 20) TIME_INTERVAL = 20;
            }
            //endTimeCount = 0;
        }
Exemplo n.º 10
0
    public override void OnExit()
    {
        AnimationConfig animConfig = CurrentActor.MainAnim.GetComponent <AnimationConfig>();

        if (null != animConfig && null != animConfig.Trail)
        {
            animConfig.Trail.ClearTrail();
        }
        {
            AttackActionCallback callback = CurrentActor.GetBodyParentObject().GetComponent <AttackActionCallback>();
            callback.enabled = false;
        }
        if (m_skillTarget != null && m_skillTarget != CurrentActor)
        {//面向目标
            Vector3 direction = m_skillTarget.RealPos - CurrentActor.RealPos;
            direction.y = 0;
            // 由于这里修改旋转,会导致Actor的RealPos不正确,所以这里不能乱转 [8/19/2014 tgame]
            //CurrentActor.MoveRotation(Quaternion.LookRotation(direction.normalized) * Quaternion.LookRotation(Vector3.forward));
        }
        m_effectObjList.Clear();
        if (m_skillInfo.IsSlashExist)
        {//显示BoxCollider
            if (CurrentActor.CenterCollider != null)
            {
                CurrentActor.CenterCollider.gameObject.layer = LayerMask.NameToLayer("Actor");
            }
        }
        if (null != CurrentActor.Combo)
        {//设置连接技的信息
            CurrentActor.Combo.SetConnetionInfo(m_skillInfo.SkillConnectionType);
        }

        StopPlaySkillEventAnimation();
        //隐藏body下的所有istrigger状态的collider
        CurrentActor.HideTriggerCollider();

        //停止播放所有武器动作
        CurrentActor.StopPlayWeaponsAnimation();
        //隐藏武器
        CurrentActor.ShowWeaponModelWithTable(false);
        //回馈位移动画
        CurrentActor.ApplyAnimationOffset();
    }
 public void Init()
 {
     animationCfg = Root.ConfigManager.Animation;
 }
Exemplo n.º 12
0
 public StringAnimator(AnimationConfig config, bool isParallelAnimation = false)
 {
     UpdateAnimationConfig(config);
     this.isParallelAnimation = isParallelAnimation;
 }
Exemplo n.º 13
0
        // private const string ERR_PROC_NOT_YET_SUPPORTED = "This Procedural animation [{0}] cannot be loaded yet! Only certain instances of this type work right now.";

        /// <summary>
        /// Handles the given <see cref="AnimationConfig"/> and applies it to the already loaded <see cref="Model3D"/>s.
        /// </summary>
        /// <param name="srcConfig"></param>
        /// <param name="name"></param>
        /// <param name="original"></param>
        /// <param name="animationImplementation"></param>
        /// <param name="attachToModels"></param>
        public static void HandleAnimationImplementation(ConfigReference srcConfig, string name, AnimationConfig original, AnimationConfig.Implementation animationImplementation, List <Model3D> attachToModels)
        {
            // FileInfo srcFile = new FileInfo(ResourceDirectoryGrabber.ResourceDirectoryPath + srcConfig.getName());
            SKAnimatorToolsProxy.IncrementEnd();
            // Clear out any derived references all the way until we dig down to an original implementation.
            if (animationImplementation is AnimationConfig.Derived derived)
            {
                animationImplementation = Dereference(derived);
            }

            if (animationImplementation is AnimationConfig.Imported imported)
            {
                // As OOO says:
                // The transforms for each target, each frame.
                Transform3D[][] transforms = imported.transforms;

                // So presumably this means that...
                // ...It's backwards! First dimension is the frame number, second dimension is the transform for each target.
                // big brain time

                // ... I swear they must've been waiting for someone like me to come along. Purposely being confusing.
                float fps = imported.rate;

                Animation animation     = new Animation(name);
                int       numIterations = transforms.Length;
                if (imported.skipLastFrame)
                {
                    numIterations--;
                }

                SKAnimatorToolsProxy.IncrementEnd(numIterations);
                for (int frameIndex = 0; frameIndex < numIterations; frameIndex++)
                {
                    Transform3D[]      targetFrames = transforms[frameIndex];
                    Animation.Keyframe keyframe     = new Animation.Keyframe();
                    for (int targetIndex = 0; targetIndex < imported.targets.Length; targetIndex++)
                    {
                        string      target    = imported.targets[targetIndex];
                        Transform3D transform = targetFrames[targetIndex];

                        // Catch case: Might be null.
                        // Since I'm hellbent on doing things oddly for this part of the program, I'll manually interpolate lol
                        if (transform == null)
                        {
                            Transform3D nextTransform     = null;
                            Transform3D previousTransform = null;
                            int         prevIndex         = 0;
                            int         nextIndex         = 0;
                            // Start at 1 because if there's a single frame gap, then the result of ^ will be 2
                            // And then this will count as frame 1 instead of 0, causing 1/2 or 0.5.
                            for (int aheadIndex = 0; aheadIndex < numIterations; aheadIndex++)
                            {
                                if (aheadIndex > frameIndex)
                                {
                                    nextTransform = transforms[aheadIndex][targetIndex];
                                    if (nextTransform != null)
                                    {
                                        nextIndex = aheadIndex;
                                    }
                                }
                                else
                                {
                                    Transform3D prev = transforms[aheadIndex][targetIndex];
                                    if (prev != null)
                                    {
                                        previousTransform = prev;
                                        prevIndex         = aheadIndex;
                                    }
                                }
                            }

                            int max = nextIndex - prevIndex;
                            for (float progress = 0; progress < max; progress++)
                            {
                                int trsIndex = prevIndex + (int)progress + 1;
                                transforms[trsIndex][targetIndex] = previousTransform.lerp(nextTransform, progress / max);
                            }
                        }

                        keyframe.Keys.Add(new Animation.Key {
                            Node      = target,
                            Transform = transform
                        });
                        keyframe.Time = frameIndex / fps;
                    }
                    animation.Keyframes.Add(keyframe);
                    SKAnimatorToolsProxy.IncrementProgress();
                }

                foreach (Model3D model in attachToModels)
                {
                    model.Animations.Add(animation);
                }
            }
            else if (animationImplementation is AnimationConfig.Sequential sequential)
            {
                //AnimationConfig.Implementation[] subs = new AnimationConfig.Implementation[sequential.animations.Length];

                SKAnimatorToolsProxy.IncrementEnd(sequential.animations.Length);
                for (int index = 0; index < sequential.animations.Length; index++)
                {
                    AnimationConfig.ComponentAnimation component = sequential.animations[index];
                    HandleAnimationImplementation(srcConfig, name, original, Dereference(component), attachToModels);
                    SKAnimatorToolsProxy.IncrementProgress();
                }

                /*
                 * } else if (animationImplementation is AnimationConfig.Procedural proc) {
                 *
                 *      if (srcFile.Name.StartsWith("rotate_")) {
                 *              // Rotation animation
                 *              // The first transform's first target is the node it attaches to.
                 *
                 *              string axis = srcFile.Name.Substring(7, 1);
                 *              if (axis == "x") {
                 *                      object speed = srcConfig.getArguments().get("Speed");
                 *                      string onNode = (string)srcConfig.getArguments().get("Node");
                 *                      // Big thing: Speed is probably a JAVA float, not a C# float
                 *                      if (speed is java.lang.Float jfloat) speed = jfloat.floatValue();
                 *
                 *                      Animation anim = HardcodedAnimations.CreateRotateX(onNode, (float)(speed ?? 1f));
                 *
                 *                      IEnumerable<Model3D> targetModels = attachToModels.Where(model => model.RawName == onNode);
                 *                      foreach (Model3D model in targetModels) {
                 *                              model.Animations.Add(anim);
                 *                      }
                 *
                 *              } else if (axis == "y") {
                 *                      object speed = srcConfig.getArguments().get("Speed");
                 *                      string onNode = (string)srcConfig.getArguments().get("Node");
                 *                      if (speed is java.lang.Float jfloat) speed = jfloat.floatValue();
                 *
                 *                      Animation anim = HardcodedAnimations.CreateRotateY(onNode,(float)(speed ?? 1f));
                 *                      IEnumerable<Model3D> targetModels = attachToModels.Where(model => model.RawName == onNode);
                 *                      foreach (Model3D model in targetModels) {
                 *                              model.Animations.Add(anim);
                 *                      }
                 *
                 *              } else if (axis == "z") {
                 *                      object speed = srcConfig.getArguments().get("Speed");
                 *                      string onNode = (string)srcConfig.getArguments().get("Node");
                 *                      if (speed is java.lang.Float jfloat) speed = jfloat.floatValue();
                 *
                 *                      Animation anim = HardcodedAnimations.CreateRotateZ(onNode, (float)(speed ?? 1f));
                 *                      IEnumerable<Model3D> targetModels = attachToModels.Where(model => model.RawName == onNode);
                 *                      foreach (Model3D model in targetModels) {
                 *                              model.Animations.Add(anim);
                 *                      }
                 *
                 *              } else {
                 *                      XanLogger.WriteLine(string.Format(ERR_PROC_NOT_YET_SUPPORTED, srcFile.Name), color: Color.DarkGoldenrod);
                 *              }
                 *      } else if (srcFile.Name == "gear_rotation.dat") {
                 *              // same as rotate y but it has an extra value
                 *              object speed = srcConfig.getArguments().get("Speed");
                 *              object sizeRatio = srcConfig.getArguments().get("Size Ratio");
                 *              string onNode = (string)srcConfig.getArguments().get("Node");
                 *              if (speed is java.lang.Float jfloat) speed = jfloat.floatValue();
                 *              if (sizeRatio is java.lang.Float jfloat2) sizeRatio = jfloat2.floatValue();
                 *
                 *              float overallSpeed = (float)(speed ?? 1f) * (float)(sizeRatio ?? 1f);
                 *
                 *              Animation anim = HardcodedAnimations.CreateRotateY(onNode, overallSpeed);
                 *              IEnumerable<Model3D> targetModels = attachToModels.Where(model => model.RawName == onNode);
                 *              foreach (Model3D model in targetModels) {
                 *                      model.Animations.Add(anim);
                 *              }
                 *
                 *      } else {
                 *              XanLogger.WriteLine(string.Format(ERR_PROC_NOT_YET_SUPPORTED, srcFile.Name), color: Color.DarkGoldenrod);
                 *      }
                 */

                /*
                 *      // Something's wrong with directs that I gotta fix.
                 *
                 * } else if (animationImplementation is AnimationConfig.Procedural proc) {
                 *      AnimationConfig.TargetTransform[] targets = proc.transforms;
                 *
                 *
                 *      Animation animation = new Animation(name);
                 *      float timeIncrement = proc.duration / targets.Length;
                 *      int currentFrame = 0;
                 *      foreach (AnimationConfig.TargetTransform targetTrs in targets) {
                 *              Transform3DExpression expr = targetTrs.expression;
                 *              Transform3D transform = (Transform3D)expr.createEvaluator(null).evaluate();
                 *
                 *              Animation.Keyframe keyframe = new Animation.Keyframe();
                 *              for (int targetIndex = 0; targetIndex < targetTrs.targets.Length; targetIndex++) {
                 *
                 *                      string target = targetTrs.targets[targetIndex];
                 *                      XanLogger.WriteLine(target, color: Color.Blue);
                 *                      keyframe.Keys.Add(new Animation.Key {
                 *                              Node = target,
                 *                              Transform = transform
                 *                      });
                 *                      keyframe.Time = currentFrame * timeIncrement;
                 *              }
                 *              animation.Keyframes.Add(keyframe);
                 *              currentFrame++;
                 *      }
                 *
                 *      foreach (Model3D model in attachToModels) {
                 *              model.Animations.Add(animation);
                 *      }
                 */
            }
            else
            {
                XanLogger.WriteLine(string.Format(ERR_IMPL_NOT_SUPPORTED, animationImplementation.GetType().Name), color: Color.DarkGoldenrod);
            }

            SKAnimatorToolsProxy.IncrementProgress();
        }
Exemplo n.º 14
0
 public void Init()
 {
     animationCfg = Root.ConfigManager.Animation;
     Root.GameController.OnScoreUpdated += OnScoreUpdated;
 }
Exemplo n.º 15
0
 private void Awake()
 {
     Length          = GetComponentInChildren <MeshFilter>().mesh.bounds.size.z;
     animationConfig = Root.ConfigManager.Animation;
 }
Exemplo n.º 16
0
    public void Init()
    {
        animationCfg = Root.ConfigManager.Animation;

        ObjectPool.Preload(hudPrefab, 10);
    }
Exemplo n.º 17
0
    public override void OnEnter()
    {
        SyncPositionIfNeed();
        m_skillResultIDIndex = 0;
        if (null == m_skillInfo)
        {
            IsEnable = false;
            Debug.LogWarning("data error,skillID:" + m_skillID);
            return;
        }
        if (CurrentActor.Type == ActorType.enMain)
        {
            BattleArena.Singleton.SkillCombo.SetConnectionInfo((ENSkillConnectionType)m_skillInfo.SkillConnectionType);
            //if (m_skillInfo.SkillConnectionType != (int)ENSkillConnectionType.enNone &&
            //    m_skillInfo.SkillConnectionType != (int)ENSkillConnectionType.enNormal)
            //{
            //    BattleArena.Singleton.QTE.Succ(m_skillInfo.ID, (ENSkillConnectionType)m_skillInfo.SkillConnectionType);
            //}
        }
        if (m_skillInfo.TargetType == (int)ENTargetType.enNullTarget)
        {//无目标技能
            CurrentActor.StartCaution();
        }
        {     //动作播放列表
            if (m_skillInfo.IsPrepareExist)
            { //有起手动作
                m_animationNameList.Add(m_animationNameList.Count, new AttackStepInfo(Actor.ENSkillStepType.enPrepare, m_skillInfo.PrepareMotion, 0));
            }
            if (m_skillInfo.IsSpellExist)
            {//有吟唱动作
                m_animationNameList.Add(m_animationNameList.Count, new AttackStepInfo(Actor.ENSkillStepType.enSpell, m_skillInfo.SpellMotion, m_skillInfo.SpellTime));
            }
            if (m_skillInfo.IsSlashExist)
            {//有冲刺动作
                m_animationNameList.Add(m_animationNameList.Count, new AttackStepInfo(Actor.ENSkillStepType.enSlash, m_skillInfo.SlashMotion, 0));
            }
            if (m_skillInfo.IsReleaseExist)
            {//有释放动作
                m_animationNameList.Add(m_animationNameList.Count, new AttackStepInfo(Actor.ENSkillStepType.enRelease, m_skillInfo.ReleaseMotion, 0));
            }
            if (m_skillInfo.IsConductExist)
            {//有引导动作
                m_animationNameList.Add(m_animationNameList.Count, new AttackStepInfo(Actor.ENSkillStepType.enConduct, m_skillInfo.ConductMotion, m_skillInfo.ConductTime));
            }
            if (m_skillInfo.IsEndConductExist)
            {//有引导结束动作
                m_animationNameList.Add(m_animationNameList.Count, new AttackStepInfo(Actor.ENSkillStepType.enEndConduct, m_skillInfo.EndConductMotion, 0));
            }
            m_curAttackStep = 0;
            RefreshActionRef();
            if (m_skillTarget != null && m_skillTarget != CurrentActor)
            {
                m_isSwitchRotation = true;
                if (CurrentActor.Type == ActorType.enMain)
                {
                    m_isSwitchRotation = true;
                }
                else
                {
                    m_isSwitchRotation = false;
                }
            }
        }
        {
            AttackActionCallback callback = CurrentActor.GetBodyParentObject().GetComponent <AttackActionCallback>();
            callback.enabled = true;
        }

        AnimationConfig animConfig = CurrentActor.MainAnim.GetComponent <AnimationConfig>();

        if (null != animConfig && null != animConfig.Trail)
        {
            animConfig.Trail.StartTrail(0.15f, 0.05f);
        }
        if (m_isSwitchRotation)
        {
            //m_startTime = Time.time;
            m_isPlay          = false;
            m_targetForward   = m_skillTarget.RealPos - CurrentActor.RealPos;
            m_targetForward.y = 0;
            m_targetForward.Normalize();
            float currotateSpeed = Vector3.Angle(CurrentActor.MainObj.transform.forward, m_targetForward);
            if (CurrentActor.Type == ActorType.enNPC)
            {
                NPC npc = CurrentActor as NPC;
                m_fRotateSpeed = npc.CurrentTableInfo.SwitchRotateSpeed;
            }
            else
            {
                m_fRotateSpeed = CurrentActor.PropConfig.SwitchRotateSpeed;
            }
            float fDuration = currotateSpeed / m_fRotateSpeed;
            if (fDuration > GameSettings.Singleton.m_attackRotateTime)
            {
                m_fRotateSpeed = GameSettings.Singleton.m_attackRotateSpeed;
            }
        }
        else
        {
            m_isPlay = true;
            if (m_skillTarget != null && m_skillTarget != CurrentActor)
            {//面向目标
                Vector3 direction = m_skillTarget.RealPos - CurrentActor.RealPos;
                direction.y = 0;
                direction.Normalize();
                CurrentActor.MoveRotation(Quaternion.LookRotation(direction.normalized) * Quaternion.LookRotation(Vector3.forward));
            }
        }
    }
Exemplo n.º 18
0
 public WordArtApi()
 {
     config              = new AnimationConfig();
     animStr             = new AnimationString(config);
     animStr.DrawBitmap += DrawBitmap;
 }
Exemplo n.º 19
0
 /// <summary>
 /// 根据动画配置创建文本动画。
 /// </summary>
 /// <param name="config"></param>
 public AnimationString(AnimationConfig config)
 {
     this.config = config;
 }