Ejemplo n.º 1
0
    /// <summary>
    /// Sets up the attack sequence that will be use and retrieves the
    /// action from the sequence array and performs said action
    /// </summary>
    private void PerformActions()
    {
        if (_isNextSequenceReady)
        {
            GetSequence();
            return;
        }

        AnimationAction currentAction = GetNextAction(_actionSequence);

        _isReadyNextAtk = false;
        _isCdOn         = true;


        float animClipLength = 0f;

        if (_seqEnd)
        {
            return;
        }

        //Looks towards the player
        Vector3 lookPosition = _playerTransform.position - _go.transform.position;

        lookPosition.y = 0;
        Quaternion rotation = Quaternion.LookRotation(lookPosition);

        _go.transform.rotation = Quaternion.Slerp(_go.transform.rotation, rotation, Time.deltaTime * Enemy.EnemyRotationSpeed);


        switch (currentAction.AnimationClipName)
        {
        case "Attack 1":
            _animator.SetTrigger(Attack1);
            animClipLength      = currentAction.AnimationClipLength;
            _enemyAction.action = EnemyAction.EnemyActionType.LightAttack;
            break;

        case "Attack 2":
            _animator.SetTrigger(Attack2);
            animClipLength      = currentAction.AnimationClipLength;
            _enemyAction.action = EnemyAction.EnemyActionType.HeavyAttack;
            break;

        case "Attack 3":
            _animator.SetTrigger(Attack3);
            animClipLength      = currentAction.AnimationClipLength;
            _enemyAction.action = EnemyAction.EnemyActionType.LightAttack;
            break;

        case "Attack 4":
            _animator.SetTrigger(MassiveAttack);
            animClipLength      = currentAction.AnimationClipLength;
            _enemyAction.action = EnemyAction.EnemyActionType.LightAttack;
            break;
        }

        _attackCd = animClipLength;
        _sequenceCount++;
    }
Ejemplo n.º 2
0
    public override void Enter()
    {
        base.Enter();
        _animator     = _go.GetComponent <Animator>();
        _enemyAction  = (EnemyAction)_attributes.Find(x => x.GetType() == typeof(EnemyAction));
        _aiController = (AIController)_attributes.Find(x => x.GetType() == typeof(AIController));

        _playerAnimator = GameObject.FindGameObjectWithTag("Player").GetComponent <Animator>();


        _enemyAction.action = EnemyAction.EnemyActionType.Injured;

        foreach (AnimationClip clip in _animator.runtimeAnimatorController.animationClips)
        {
            if (!clip.name.Contains("takeDMG"))
            {
                continue;
            }

            _injuredAction = new AnimationAction(clip);
            _animTime      = _injuredAction.AnimationClipLength * 2;
        }

        _played = false;

        /*
         * if (!_playerAnimator.GetCurrentAnimatorStateInfo(0).IsTag("HT"))
         *  _animTime /= 4;*/
    }
Ejemplo n.º 3
0
    public void DestroyWithPoints()
    {
        SetSoundEffect();
        explodeObject.isActive = false;
        animationStartAction   = () => {
            foreach (ParticleSystem effect in stopEffects)
            {
                effect.Stop();
                effect.Play();
                effect.gameObject.SetActive(true);
            }
        };

        animator.Play("s" + type.ToString() + "_dead", 0, 0);
        //Debug.Log ("destr");
        animationEndAction = () => {
            foreach (ParticleSystem effect in stopEffects)
            {
                effect.Stop();
                effect.Play();
                effect.gameObject.SetActive(false);
            }
            explodeObject.DefaultDestroyWithPoints();
        };
    }
Ejemplo n.º 4
0
    public void Destroy()
    {
        SetSoundEffect();
        explodeObject.isActive = false;


        animationStartAction = () => {
            explodeObject.withOverscreenChecker = false;
            foreach (ParticleSystem effect in stopEffects)
            {
                effect.gameObject.SetActive(true);
                effect.Stop();
                effect.Play();
            }
        };

        animator.Play("s" + type.ToString() + "_dead", 0, 0);

        animationEndAction = () => {
            foreach (ParticleSystem effect in stopEffects)
            {
                effect.Stop();
                effect.Play();
                effect.gameObject.SetActive(false);
            }
            explodeObject.DefaultDestroy();
        };
    }
Ejemplo n.º 5
0
        public static AnimationActionRunner FromAnimationAction(AnimationAction aa)
        {
            AnimationActionRunner aar = new AnimationActionRunner();

            aar.animationAction = aa;
            return(aar);
        }
Ejemplo n.º 6
0
    /// <summary>
    /// Animate the Avatar
    /// </summary>
    /// <param name="animation">The Animation Name</param>
    /// <param name="action">0 - To play the animation, 1 - to stop the animation</param>
    /// <param name="wrapMode">Wrap Mode</param>
    /// <param name="animationSpeed">Animation Speed</param>
    /// <param name="layer">Animation Layer</param>
    public void Animate(string animation, AnimationAction action, WrapMode wrapMode, float animationSpeed, int layer)
    {
        if (characterObject	!= null && animation != "")
        {
            if (generator.AnimationClips.Contains(animation) && characterObject.animation != null)
            {
                if (action == AnimationAction.Play)
                {
                    characterObject.animation[animation].layer = layer;
                    characterObject.animation[animation].speed = animationSpeed;
                    characterObject.animation[animation].wrapMode = wrapMode;
                    characterObject.animation.CrossFade(animation);
                }
                else
                {
                    characterObject.animation[animation].layer = layer;
                    characterObject.animation.Stop(animation);
                }
            }
            else
            {
                string anims = "";
                foreach (AnimationState state in characterObject.animation)
                {
                    anims = anims + state.clip.name + ", ";
                }

                if (PopBloopSettings.useLogs)
                {
                    Debug.LogWarning("Animation " + animation + " not found on Character " + this.gameObject.name + " => Anims found : " + anims);
                }
            }
        }
    }
Ejemplo n.º 7
0
	// Use this for initialization
	void Start () {
		AnimationManager animManager = GameObject.Find ("animationManager").GetComponent<AnimationManager> ();
		obj = GameObject.Find ("Player");
		ActionRunner anim1 = new AnimationAction ("Take 001", true, obj);
		ActionRunner anim2 = new AnimationAction ("Take 001", false, obj);
		//	anim1.Start ();
		anim2.Start ();
	}
        /// <summary>
        /// Create a new animation action component on the given game piece with the given animation action object.
        /// This can also add special logic to the creation of a component based on the given game piece.
        /// </summary>
        /// <param name="animationAction">the animation action metadata</param>
        /// <param name="gamePiece">the game piece to apply this new animation action behaviour to</param>
        /// <returns>the newly created animation action behaviour component</returns>
        public static List <AnimationActionBehaviour> AddComponentByAnimationAction(AnimationAction animationAction, GamePieceBehaviour gamePiece)
        {
            List <AnimationActionBehaviour> behaviours = new List <AnimationActionBehaviour>();

            if (gamePiece != null && animationAction != null)
            {
                switch (animationAction.Name)
                {
                // TODO: MW these names are just placeholders, use what ever is in the actual server code
                case "MoveForward":
                    behaviours.Add(gamePiece.gameObject.AddComponent <MoveForwardAnimationBehaviour>());
                    break;

                case "MoveBackward":
                    behaviours.Add(gamePiece.gameObject.AddComponent <MoveBackwardAnimationBehaviour>());
                    break;

                case "TurnClockwise90":
                    behaviours.Add(gamePiece.gameObject.AddComponent <RotateClockwiseAnimationBehaviour>());
                    break;

                case "TurnCounterClockwise90":
                    behaviours.Add(gamePiece.gameObject.AddComponent <RotateCounterClockwiseAnimationBehaviour>());
                    break;

                case "DoBumpInto":
                    behaviours.Add(gamePiece.gameObject.AddComponent <TurnRedAnimationBehaviour>());
                    behaviours.Add(gamePiece.gameObject.AddComponent <DecrementHealthBarBehaviour>());
                    break;

                case "HitByCanon":
                    behaviours.Add(gamePiece.gameObject.AddComponent <TurnRedAnimationBehaviour>());
                    behaviours.Add(gamePiece.gameObject.AddComponent <DecrementHealthBarBehaviour>());
                    break;

                case "FireCanon":
                    behaviours.Add(gamePiece.gameObject.AddComponent <FireCannonAnimationBehavior>());
                    break;

                case "Default":
                    behaviours.Add(gamePiece.gameObject.AddComponent <DefaultAnimationBehaviour>());
                    break;

                default:
                    // TODO: MW maybe we want to throw here? but I suspect not for stability's sake
                    Debug.LogWarning("Failed to find an animation behaviour factory method for animation: " + animationAction.Name);
                    behaviours.Add(gamePiece.gameObject.AddComponent <DefaultAnimationBehaviour>());
                    break;
                }

                foreach (AnimationActionBehaviour behaviour in behaviours)
                {
                    behaviour.TotalTime = animationAction.Time;
                }
            }

            return(behaviours);
        }
    /// <summary>
    /// Sets up the attack sequence that will be use and retrieves the
    /// action from the sequence array and performs said action
    /// </summary>
    private void PerformActions()
    {
        if (_isNextSequenceReady)
        {
            GetSequence();
            return;
        }

        AnimationAction currentAction = GetNextAction(_actionSequence);

        _isReadyNextAtk     = false;
        _isCdOn             = true;
        _enemyAction.action = EnemyAction.EnemyActionType.LightAttack;

        float animClipLength = 0f;

        if (_seqEnd)
        {
            return;
        }

        switch (currentAction.AnimationClipName)
        {
        case "Attack 1":
            _animator.SetTrigger(Attack1);
            animClipLength = currentAction.AnimationClipLength;
            break;

        case "Attack 2":
            _animator.SetTrigger(Attack2);
            animClipLength = currentAction.AnimationClipLength;
            break;

        case "Attack 3":
            _animator.SetTrigger(Attack3);
            animClipLength = currentAction.AnimationClipLength;
            break;

        case "Attack 4":
            _animator.SetTrigger(MassiveAttack);
            animClipLength = currentAction.AnimationClipLength;
            break;

        case "roll":
            _go.transform.Rotate(new Vector3(0, 90, 0));
            _animator.SetTrigger(CombatRoll);
            _collider.radius = 0.51f;
            _collider.height = 0;
            animClipLength   = currentAction.AnimationClipLength;
            DoCombatRoll();
            _rolling = true;
            break;
        }

        _attackCd = animClipLength;
        _sequenceCount++;
    }
Ejemplo n.º 10
0
 private RectangleF[] GetAnimation(AnimationAction action, float directionDegree)
 {
     if (directionDegree >= 180)
     {
         directionDegree = 180 - (directionDegree % 180);
     }
     RectangleF[][] ActionAnimations = Animations[(int)action];
     return(ActionAnimations[(int)(directionDegree * ActionAnimations.Length / 181F)]);
 }
Ejemplo n.º 11
0
 protected void Start(Control control, TransitionType transitionType, int duration, AnimationAction actionHandler, AnimationFinishedEvaluator evaluatorHandler)
 {
     this.targetControl    = control;
     this.transitionType   = transitionType;
     this.actionHandler    = actionHandler;
     this.evaluatorHandler = evaluatorHandler;
     this.counter          = 0;
     this.startTime        = 0;
     this.targetTime       = duration;
     this.timer            = DelayedCall.Start(new DelayedCall.Callback(this.DoAnimation), duration);
 }
Ejemplo n.º 12
0
    // Use this for initialization
    void Start()
    {
        AnimationManager animManager = GameObject.Find("animationManager").GetComponent <AnimationManager> ();

        obj = GameObject.Find("Player");
        ActionRunner anim1 = new AnimationAction("Take 001", true, obj);
        ActionRunner anim2 = new AnimationAction("Take 001", false, obj);

        //	anim1.Start ();
        anim2.Start();
    }
Ejemplo n.º 13
0
    public override void Animate(string animation, AnimationAction action, WrapMode wrapMode, float animationSpeed, int layer)
    {
        base.Animate(animation, action, wrapMode, animationSpeed, layer);

        _mmoGame.Avatar.Animate(animation, action, (byte)wrapMode, animationSpeed, layer);

        if (_avatarController == null)
        {
            Debug.Log("PlayerActor.Animate: character not found, please check the AvatarController being attached");
        }
    }
Ejemplo n.º 14
0
        /// <summary>
        /// Start animation.
        /// </summary>
        /// <param name="control">Control to use.</param>
        /// <param name="transitionType">TransitionType instance.</param>
        /// <param name="duration">Duration time in milliseconds.</param>
        /// <param name="actionHandler">AnimationAction delegate.</param>
        /// <param name="evaluatorHandler">AnimationFinishedEvaluator delegate.</param>
        protected void Start(Control control, TransitionType transitionType, int duration, AnimationAction actionHandler, AnimationFinishedEvaluator evaluatorHandler)
        {
            this._targetControl    = control;
            this.TransitionType    = transitionType;
            this._actionHandler    = actionHandler;
            this._evaluatorHandler = evaluatorHandler;

            this.Counter    = 0;
            this.StartTime  = 0;
            this.TargetTime = duration;

            this._timer = DelayedCall.Start(this.DoAnimation, duration);
        }
Ejemplo n.º 15
0
        protected void Start(Control control, TransitionType transitionType, int duration, AnimationAction actionHandler, AnimationFinishedEvaluator evaluatorHandler)
        {
            this.targetControl = control;
            this.transitionType = transitionType;
            this.actionHandler = actionHandler;
            this.evaluatorHandler = evaluatorHandler;

            this.counter = 0;
            this.startTime = 0;
            this.targetTime = duration;

            timer = DelayedCall.Start(DoAnimation, duration);
        }
Ejemplo n.º 16
0
    public static void StopAnimation(object target, AnimationType animationType, AnimationAction action, bool complete = true)
    {
        if (target == null)
        {
            return;
        }
        string id     = GetTweenId(target, animationType, action);
        int    killed = DOTween.Kill(id);

#if UNITY_EDITOR
        Debug.Log($"Tweens killded {killed}");
#endif
    }
Ejemplo n.º 17
0
        protected void Start(Control control, TransitionType transitionTypee, int duration, AnimationAction actionHandlerr, AnimationFinishedEvaluator evaluatorHandlerr)
        {
            targetControl    = control;
            transitionType   = transitionTypee;
            actionHandler    = actionHandlerr;
            evaluatorHandler = evaluatorHandlerr;

            counter    = 0;
            startTime  = 0;
            targetTime = duration;

            timer = DelayedCall.Start(DoAnimation, duration);
        }
    public override void Enter()
    {
        base.Enter();

        _animator = _go.GetComponent <Animator>();

        _aiController = (AIController)_attributes.Find(x => x.GetType() == typeof(AIController));

        foreach (AnimationClip clip in _animator.runtimeAnimatorController.animationClips)
        {
            if (!clip.name.Contains("blockhit"))
            {
                continue;
            }

            _blockAction = new AnimationAction(clip);
            _animTime    = _blockAction.AnimationClipLength;
        }
    }
    public override void Enter()
    {
        base.Enter();
        _animator    = _go.GetComponent <Animator>();
        _enemyAction = (EnemyAction)_attributes.Find(x => x.GetType() == typeof(EnemyAction));

        _enemyAction.action = EnemyAction.EnemyActionType.Injured;

        foreach (AnimationClip clip in _animator.runtimeAnimatorController.animationClips)
        {
            if (!clip.name.Contains("takeDMG"))
            {
                continue;
            }

            _injuredAction = new AnimationAction(clip);
            _animTime      = _injuredAction.AnimationClipLength;
        }
    }
Ejemplo n.º 20
0
    /// <summary>
    /// The method provides a simple mechanism for code based animations
    /// </summary>
    /// <param name="duration">Animation's duration</param>
    /// <param name="action">An action should be executed</param>
    /// <returns>A reference to enumerator</returns>

    public static IEnumerator Animate(float duration, AnimationAction action, UnityAction postAction = null)
    {
        if (action == null)
        {
            yield break;
        }

        float dt = 0.0f;

        for (float time = 0.0f; Mathf.Abs(time - duration) > (dt = Time.deltaTime); time += dt)
        {
            action?.Invoke(time);

            yield return(null);
        }

        postAction?.Invoke();

        yield return(null);
    }
Ejemplo n.º 21
0
        private void DrawSpriteFrame(Graphics g, PointF position, SizeF size, AnimationAction action, float directionDegree, float frame)
        {
            if (DisableTextures)
            {
                g.FillEllipse(new SolidBrush(Color), new RectangleF(position, size));
            }
            else
            {
                var Texture   = directionDegree >= 180 ? MirroredTexture : this.Texture;
                var Animation = GetAnimation(action, directionDegree);
                var AniRect   = Animation[(int)(frame * Animation.Length / (Visualization.SubturnFramerate + 1))];
                var h         = AniRect.Height * size.Width / AniRect.Width;
                g.DrawImage(Texture,
                            new RectangleF(directionDegree < 180 ? position.X : position.X - size.Width * (spriteK - 1),
                                           position.Y - (spriteK * h - size.Height), spriteK * size.Width, spriteK * h),

                            directionDegree < 180 ^ Mirrored ? AniRect :
                            new RectangleF(Texture.Width - (AniRect.X + AniRect.Width), AniRect.Y, AniRect.Width, AniRect.Height)
                            , GraphicsUnit.Pixel);
            }
        }
Ejemplo n.º 22
0
        private void issueAnimation(KeyValuePair <AnimationAction, KeyValuePair <AnimationType, int> > animation)
        {
            AnimationAction animationAction = animation.Key;
            AnimationType   animationType   = animation.Value.Key;
            int             elapsed         = animation.Value.Value;

            switch (animationAction)
            {
            case AnimationAction.FadeIn:
                __makeFadeIn(animationType, elapsed);
                break;

            case AnimationAction.FadeOut:
                __makeFadeOut(animationType, elapsed);
                break;

            case AnimationAction.MoveTo:
                __makeMove(animationType, elapsed);
                break;
            }
        }
Ejemplo n.º 23
0
        public AnimationPlayback(BaseEvent ef, Character caster)
        {
            this.ef     = ef;
            this.caster = caster;

            AnimationAction aa         = (AnimationAction)ef.action;
            bool            isEligible = false;

            switch (aa.ShowRequirement())
            {
            case JumpAction.Requirement.Air:
                isEligible = !caster.IsOnGround();
                break;

            case JumpAction.Requirement.Ground:
                isEligible = caster.IsOnGround();
                break;

            default:
                isEligible = true;
                break;
            }

            if (isEligible)
            {
                Entity entity = caster.GameObject().GetComponent <EntityReference>().Entity;
                anim = entity.GetComponent <AnimationComponent>().Animation;
                anim.PlayAnimation(aa.name, aa.speed, aa.ShowPlayMethod(), aa.crossfadeLength, aa.startFrame, true);
                if (aa.speed > 0)
                {
                    if (aa.ShowPlayMethod() == PlayMethod.Play || aa.ShowPlayMethod() == PlayMethod.ForcePlay)
                    {
                        anim.JumpToFrame(aa.startFrame);
                    }
                }

                animClipLength = anim.Duration(aa.name);
            }
        }
Ejemplo n.º 24
0
    public static AnimationBase GetAnimationBase(int type, GameObject go)
    {
        ZTAnimationType animationType = ZTAnimationType.Animator;
        AnimationBase   baseAction    = null;

        if (System.Enum.IsDefined(typeof(ZTAnimationType), type))
        {
            animationType = (ZTAnimationType)type;
        }

        switch (animationType)
        {
        case ZTAnimationType.Animation:
            baseAction = new AnimationAction(go);
            break;

        case ZTAnimationType.Animator:
            baseAction = new AnimatorAction(go);
            break;
        }

        return(baseAction);
    }
Ejemplo n.º 25
0
    public static void Animate(Item item, string animation, AnimationAction action, WrapMode animationWrap, float animationSpeed, int layer)
    {
        foreach (ActorAnimator actorAnim in actorAnimations)
        {
            if (actorAnim == null)
            {
                continue;
            }

            if (actorAnim._actor == null)
            {
                continue;
            }

            if (actorAnim._actor.Item == item)
            {
                actorAnim.Animate(animation, action, animationWrap, animationSpeed, layer);

                // There's only 1 item for 1 actor, so it's unique, get out after we found it.
                break;
            }
        }
    }
Ejemplo n.º 26
0
    public virtual void Animate(string animation, AnimationAction action, WrapMode animationWrap, float animationSpeed, int layer)
    {
        if (layer > 1)
        {
            Debug.LogWarning("Animation Layer > 1 is not support for now");
            return;
        }

        if (animation == "" || animation == null)
        {
            return;
        }

        if (_avatarController != null)
        {
            if (_avatarController.AnimationClips == null)
            {
                return;
            }

            if (_avatarController.AnimationClips.Contains(animation))
            {
                if (_avatarController.IsAnimationPlaying(animation) == false)
                {
                    PlayAnimation(animation, action, animationWrap, animationSpeed, layer);
                }
                else
                {
                    if (currentAnimations[layer].Animation != animation || currentAnimations[layer].Wrap != animationWrap || currentAnimations[layer].Layer != layer ||
                        currentAnimations[layer].Speed != animationSpeed || currentAnimations[layer].Action != action)
                    {
                        PlayAnimation(animation, action, animationWrap, animationSpeed, layer);
                    }
                }
            }
        }
    }
Ejemplo n.º 27
0
        public virtual string getAnimations(AnimationAction action)
        {
            StringBuilder builder = new StringBuilder();
            switch (action)
            {
                case AnimationAction.Open:
                    builder.AppendLine("<OnLoad>");
                    builder.AppendLine("<OpacityAction AnimationTarget=\"" + this.ActionContainer + "\" Opacity=\"0\" />");
                    builder.AppendLine("</OnLoad>");
                    builder.AppendLine("<OnClick>");
                    builder.AppendLine("<Sequence>");
                    builder.AppendLine("<ScriptAction Script=\"var target = $get('" + this.TargetControl.ClientID + "');"
                        + "var body = $get('" + this.ActionContainer + "');"
                        + "var location = Sys.UI.DomElement.getLocation(target);"
                        + "body.style.position = 'absolute';"
                        + "body.style.top = location.y;"
                        + "body.style.left = location.x + target.clientWidth + 5;\" />");
                    builder.AppendLine("<StyleAction AnimationTarget=\"" + this.ActionContainer + "\" Attribute=\"display\" Value=\"block\"/>");
                    builder.AppendLine("<FadeIn AnimationTarget=\"" + this.ActionContainer + "\" Duration=\".2\"/>");
                    builder.AppendLine("<Parallel Duration=\"" + (this.Fadeinterval).ToString() + "\">");
                    builder.AppendLine("<Color AnimationTarget=\"" + this.ActionContainer + "\" StartValue=\"" +
                        GloFix.ToHtmlColor(this.FadeStartFontColor) + "\" EndValue=\"" +
                        GloFix.ToHtmlColor(this.FadeEndFontColor) + "\" Property=\"style\" PropertyKey=\"color\" />");
                    builder.AppendLine("<Color AnimationTarget=\"" + this.ActionContainer + "\" StartValue=\"" +
                        GloFix.ToHtmlColor(this.FadeStartBorderColor) + "\" EndValue=\"" +
                        GloFix.ToHtmlColor(this.FadeEndBorderColor) + "\" Property=\"style\" PropertyKey=\"borderColor\" />");
                    builder.AppendLine("<Color AnimationTarget=\"" + this.ActionContainer + "\" StartValue=\"" +
                        GloFix.ToHtmlColor(this.FadeStartBackColor) + "\" EndValue=\"" +
                        GloFix.ToHtmlColor(this.FadeEndBackColor) + "\" Property=\"style\" PropertyKey=\"backgroundColor\" />");
                    builder.AppendLine("</Parallel>");
                    builder.AppendLine("</Sequence>");
                    builder.AppendLine("</OnClick>");
                    break;
                case AnimationAction.Close:
                    builder.AppendLine("<OnClick>");
                    builder.AppendLine("<Sequence>");
                    builder.AppendLine("<Parallel AnimationTarget=\"" + this.ActionContainer + "\" Duration=\"" + this.Fadeinterval.ToString() + "\" Fps=\"15\">");
                    builder.AppendLine("<Color AnimationTarget=\"" + this.ActionContainer + "\" StartValue=\"" +
            GloFix.ToHtmlColor(this.FadeStartFontColor) + "\" EndValue=\"" +
            GloFix.ToHtmlColor(this.FadeEndFontColor) + "\" Property=\"style\" PropertyKey=\"color\" />");
                    builder.AppendLine("<Color AnimationTarget=\"" + this.ActionContainer + "\" StartValue=\"" +
                        GloFix.ToHtmlColor(this.FadeStartBorderColor) + "\" EndValue=\"" +
                        GloFix.ToHtmlColor(this.FadeEndBorderColor) + "\" Property=\"style\" PropertyKey=\"borderColor\" />");
                    builder.AppendLine("<Color AnimationTarget=\"" + this.ActionContainer + "\" StartValue=\"" +
                        GloFix.ToHtmlColor(this.FadeStartBackColor) + "\" EndValue=\"" +
                        GloFix.ToHtmlColor(this.FadeEndBackColor) + "\" Property=\"style\" PropertyKey=\"backgroundColor\" />");
                    builder.AppendLine("<Scale ScaleFactor=\"0.05\" Center=\"true\" ScaleFont=\"true\" FontUnit=\"px\" />");
                    builder.AppendLine("<FadeOut />");
                    builder.AppendLine("</Parallel>");
                    builder.AppendLine("<StyleAction AnimationTarget=\"" + this.ActionContainer + "\" Attribute=\"display\" Value=\"none\"/>");
                    builder.AppendLine("<StyleAction AnimationTarget=\"" + this.ActionContainer + "\" Attribute=\"width\" Value=\"" + this.ShowPanelWidth.Value.ToString() + "px\"/>");
                    builder.AppendLine("<StyleAction AnimationTarget=\"" + this.ActionContainer + "\" Attribute=\"height\" Value=\"" + this.ShowPanelHeight.Value.ToString() + "px\"/>");
                    builder.AppendLine("<StyleAction AnimationTarget=\"" + this.ActionContainer + "\" Attribute=\"fontSize\" Value=\"" + this.ShowFontSize.ToString() + "px\"/>");
                    builder.AppendLine("</Sequence>");
                    builder.AppendLine("</OnClick>");
                    //builder.AppendLine("<OnMouseOver>");
                    //builder.AppendLine("<Color Duration=\".2\" StartValue=\"#FFFFFF\" EndValue=\"#FF0000\" Property=\"style\" PropertyKey=\"color\" />");
                    //builder.AppendLine("</OnMouseOver>");
                    //builder.AppendLine("<OnMouseOut>");
                    //builder.AppendLine("<Color Duration=\".2\" EndValue=\"#FFFFFF\" StartValue=\"#FF0000\" Property=\"style\" PropertyKey=\"color\" /> ");
                    //builder.AppendLine("</OnMouseOut>");
                    break;
            }

            return builder.ToString();
        }
Ejemplo n.º 28
0
 public AnimationSet this[AnimationAction key]
 {
     get { return(_frames[(int)key | _direction]); }
 }
Ejemplo n.º 29
0
 public AnimationMap Add(AnimationAction action, AnimationDirection direction, AnimationSet set)
 {
     _frames[(int)action | (int)direction] = set;
     return(this);
 }
Ejemplo n.º 30
0
        /// <summary>
        /// The game item animate operation.
        /// </summary>
        /// <param name="newPosition">
        /// The new position.
        /// </param>
        /// <param name="rotation">
        /// The rotation.
        /// </param>
        /// <returns>
        /// The move absolute.
        /// </returns>
        public bool GameItemAnimate(string gameItemId, string animation, AnimationAction action, byte wrapMode, float speed)
        {
            Operations.GameItemAnimate(this.Game, this.Id, this.Type, gameItemId, animation, (byte)action, wrapMode, speed, this.Game.Settings.SendReliable);

            return true;
        }
Ejemplo n.º 31
0
        public void Animate(string animation, AnimationAction action, byte wrapMode, float speed, int layer)
        {
            if (this.Animation != animation)
            {
                base.SetAnimation(animation, action, wrapMode, speed);

                Hashtable data = new Hashtable()
                {
                    { PropertyKeyAnimation, animation },
                    { PropertyKeyAnimationWrap, wrapMode },
                    { PropertyKeyAnimationSpeed, speed },
                    { PropertyKeyAnimationLayer, layer },
                    { PropertyKeyAnimationAction, (byte)action }
                };

                Operations.SetProperties(this.Game, this.Id, this.Type, data, null, true);
                //Operations.Animate(this.Game, this.Id, this.Type, animation, (byte)action, (byte)wrapMode, speed, layer, true);
            }
        }
Ejemplo n.º 32
0
 protected void Start(Control control, TransitionType transitionType, int duration, AnimationAction actionHandler)
 {
     Start(control, transitionType, duration, actionHandler, null);
 }
Ejemplo n.º 33
0
 public void SetAnimation(string animation, AnimationAction action, byte wrapMode, float speed)
 {
     this.Animation = animation;
     this.AnimationWrap = wrapMode;
     this.AnimationSpeed = speed;
     this.AnimationAction = action;
 }
Ejemplo n.º 34
0
 public void OnItemAnimate(Game game, Item item, string animation, AnimationAction action, byte animationWrap, float animationSpeed, int layer)
 {
     if (_actors.ContainsKey(item))
     {
         ActorAnimator.Animate(item, animation, action, (WrapMode)animationWrap, animationSpeed, layer);
     }
 }
Ejemplo n.º 35
0
        private static List <List <AnimationAction> > GetAnimationsFromState(Dictionary <string, object> data, string key)
        {
            var animations = new List <List <AnimationAction> >();
            var state      = data[key] as Dictionary <string, object>;

            if (state != null)
            {
                var outerList = state["Animations"] as List <object>;
                if (outerList != null)
                {
                    animations.AddRange(outerList.ConvertAll(o => {
                        var innerList = o as List <object>;
                        if (innerList != null)
                        {
                            return(innerList.ConvertAll(a => a as Dictionary <string, object>).ConvertAll(d => AnimationAction.FromDictionary(d)));
                        }
                        return(new List <AnimationAction>());
                    }));
                }
            }
            return(animations);
        }
Ejemplo n.º 36
0
 private void Awake()
 {
     action = new AnimationAction(GetComponentInChildren <Animation>());
 }
Ejemplo n.º 37
0
 public AnimationResult(string key, AnimationAction action)
 {
     _key = key;
     _action = action;
 }
 public GenericUIAnimation(IUIView view, AnimationAction animation)
 {
     this.view      = view;
     this.animation = animation;
 }
Ejemplo n.º 39
0
        private void _addOrUpdate(Dictionary <AnimationAction, KeyValuePair <AnimationType, int> > dic, AnimationAction key, KeyValuePair <AnimationType, int> value)
        {
            KeyValuePair <AnimationType, int> val;

            if (dic.TryGetValue(key, out val))
            {
                // yay, value exists!
                dic[key] = value;
            }
            else
            {
                // darn, lets add the value
                dic.Add(key, value);
            }
        }
Ejemplo n.º 40
0
 public static string GetTweenId(object target, AnimationType animationType, AnimationAction animationAction)
 {
     return(target.GetHashCode() + "-" + animationType + "-" + animationAction);
 }
Ejemplo n.º 41
0
 protected void Start(Control control, TransitionType transitionType, int duration, AnimationAction actionHandler)
 {
     Start(control, transitionType, duration, actionHandler, null);
 }
Ejemplo n.º 42
0
 public GenericUIAnimation(T view, AnimationAction <T> animation)
 {
     this.view      = view;
     this.animation = animation;
 }
Ejemplo n.º 43
0
    private void PlayAnimation(string anim, AnimationAction action, WrapMode wrap, float speed, int layerIndex)
    {
        currentAnimations[layerIndex].Animation = anim;
        currentAnimations[layerIndex].Action = action;
        currentAnimations[layerIndex].Wrap = wrap;
        currentAnimations[layerIndex].Speed = speed;
        currentAnimations[layerIndex].Layer = layerIndex;
        currentAnimations[layerIndex].IsPlaying = true;

        _avatarController.Animate(anim, action, wrap, speed, layerIndex);
    }
Ejemplo n.º 44
0
    public void OnGameItemAnimate(Game game, string gameItemId, string animation, AnimationAction action, byte animationWrap, float animationSpeed)
    {
        GameObject go = GameObject.Find(gameItemId);
        if (go != null)
        {
            ItemBase item = go.GetComponent<ItemBase>();

            if (item != null)
            {
                item.SetAnimation(animation, action, animationWrap, animationSpeed);
            }
        }
    }
Ejemplo n.º 45
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AnimationResult"/> class.
 /// </summary>
 /// <param name="key">The key.</param>
 /// <param name="action">The action.</param>
 public AnimationResult(string key, AnimationAction action)
 {
     this.key    = key;
     this.action = action;
 }
Ejemplo n.º 46
0
 public void SetAnimation(string animationName, AnimationAction action, byte wrapMode, float speed)
 {
     if (_animations.ContainsKey(animationName))
     {
         AnimationClip clip = _animations[animationName];
         Animate(clip, (WrapMode)wrapMode, action == AnimationAction.Play, false);
     }
 }