public Animation(Sprite insprite, int numFrames, AnimSpeed speed, AnimName inName)
 {
     Name          = inName;
     FrameNum      = numFrames;
     _frames       = new Frame[numFrames];
     _sprite       = insprite;
     Speed         = speed;
     FrameInterval = new TimeSpan(2750000);
     LastInterval  = TimeEventManager.getInstance().GetCurrentTime();
 }
        public Animation Find(AnimName inName)
        {
            int index = 0;

            Animation Obj = (Animation)List.getDatabyIndex(index);

            while (Obj != null)
            {
                if (Obj.getName() == inName)
                {
                    return(Obj);
                }

                index++;
                Obj = (Animation)List.getDatabyIndex(index);
            }

            return(null);
        }
        public bool Equals(DestinyAnimationReference input)
        {
            if (input == null)
            {
                return(false);
            }

            return
                ((
                     AnimName == input.AnimName ||
                     (AnimName != null && AnimName.Equals(input.AnimName))
                     ) &&
                 (
                     AnimIdentifier == input.AnimIdentifier ||
                     (AnimIdentifier != null && AnimIdentifier.Equals(input.AnimIdentifier))
                 ) &&
                 (
                     Path == input.Path ||
                     (Path != null && Path.Equals(input.Path))
                 ));
        }
    public void SetAnimationSpeed(AnimName name, float value)
    {
        switch (name)
        {
        case AnimName.Idle:
            SetAnimationSpeed("Idle", value);
            break;

        case AnimName.WalkForward:
            // value / 2.5f because player moveSpeed / 2.5f is what feels better for this animation
            SetAnimationSpeed("WalkForward", value / 2.5f);
            break;

        case AnimName.WalkBackwards:
            // value / 2.5f because player moveSpeed / 2.5f is what feels better for this animation
            SetAnimationSpeed("WalkBackwards", value / 2.5f);
            break;

        default:
            break;
        }
    }
예제 #5
0
파일: Case.cs 프로젝트: ClemGG/Snake
    //private void OnValidate()
    //{
    //    if (!GetComponent<Animator>())
    //    {
    //        gameObject.AddComponent<Animator>();
    //    }

    //    ChangerCaseConfiguration();
    //}


    public void ChangerCaseConfiguration()
    {
        if (!sr)
        {
            sr = GetComponent <SpriteRenderer>();
        }

        if (!a)
        {
            a = GetComponent <Animator>();
        }

        switch (caseType)
        {
        case CaseType.Rien:
            a.enabled  = false;
            sr.enabled = false;
            break;

        case CaseType.Obstacle:
            a.enabled  = false;
            sr.enabled = true;

            break;

        case CaseType.LimiteTerrain:
            a.enabled  = false;
            sr.enabled = true;

            break;

        case CaseType.TerrainNavigable:
            a.enabled  = false;
            sr.enabled = true;
            break;

        case CaseType.Gélule:
            a.enabled  = true;
            sr.enabled = true;

            sr.sprite = géluleSprite;

            break;

        case CaseType.Snake:
            a.enabled  = true;
            sr.enabled = true;
            caseAnim   = SnakeManager.instance.GetSnakeConfiguration(this);
            break;

        case CaseType.SnakeHead:
            a.enabled  = true;
            sr.enabled = true;
            caseAnim   = SnakeManager.instance.GetSnakeHeadConfiguration(this);
            break;


        default:
            Debug.Log($"La fonction {caseType} n'a pas encore été implémentée");
            break;
        }

        if (a)
        {
            if (a.enabled)
            {
                a.Play(caseAnim.animName);
            }
        }
    }
예제 #6
0
 public void CrossFade(AnimName animName)
 {
     // if (!anim.GetCurrentAnimatorStateInfo(0).IsName(animName))
     anim.CrossFade(animName.ToString(), fadeTime);
 }
예제 #7
0
 public void Play(AnimName animName)
 {
     // if (!anim.GetCurrentAnimatorStateInfo(0).IsName(animName))
     // anim.CrossFade(animName,fadeTime);
     anim.Play(animName.ToString());
 }
예제 #8
0
 public bool Is_Current_State(AnimName animName)
 {
     return(anim.GetCurrentAnimatorStateInfo(0).IsName(animName.ToString()));
 }
예제 #9
0
 public Emote(UserAction action, AnimName anim)
 {
     this.mAction = action; this.mAnim = anim;
 }
예제 #10
0
 public Emote(UserAction action, AnimName anim)
 {
     this.mAction = action; this.mAnim = anim;
 }