public void ChangeState(eAnimationType type)
 {
     commandList.Enqueue(type);
     if (currentCommand == currentState)
     {
         UpdateCommand();
     }
 }
 private void UpdateCommand()
 {
     if (commandList.Count > 0)
     {
         currentCommand = commandList.Dequeue();
         if (currentCommand != currentState)
         {
             animator.SetTrigger(currentCommand.ToString());
         }
     }
 }
Example #3
0
    public void UseAbility(eAnimationType animationType, GridCell target)
    {
        Turn(unit.currentLocation, target);

        switch (animationType)
        {
        case eAnimationType.SPECIAL_1:
            animator.SetTrigger("Special 1");
            break;
        }
    }
Example #4
0
    public float GetAnimTime(eAnimationType type)
    {
        SpriteAnimationInfo animInfo = null;

        if (GetAnimationInfo(type, out animInfo))
        {
            float time = (float)animInfo.spriteInfoArray.Length * (animInfo.animSpeed);

            return(time);
        }

        return(0);
    }
Example #5
0
    private bool GetAnimationInfo(eAnimationType type, out SpriteAnimationInfo animInfo)
    {
        animInfo = null;
        for (int i = 0; i < spriteAnimInfoArray.Length; i++)
        {
            if (spriteAnimInfoArray[i].animType.Equals(type))
            {
                animInfo = spriteAnimInfoArray[i];
                break;
            }
        }

        return(animInfo != null);
    }
Example #6
0
    public void PlayAnimation(eAnimationType type, MotionClearCB motionClearCB, params object[] param)
    {
        SpriteAnimationInfo animInfo = null;

        if (GetAnimationInfo(type, out animInfo))
        {
            if (selectType.Equals(type) && animInfo.isLoop)
            {
                return;
            }

            StopAllCoroutines();

            selectType = type;
            if (animSp.isActiveAndEnabled)
            {
                StartCoroutine(Play(animInfo, motionClearCB, param));
            }
        }
    }
Example #7
0
 public WalkTask(string name, TaskScope scope, Vector3 position, float timeLim, float priority, bool isinterruptible, int urgencyLevel, Func <bool> onDoneFunction, eAnimationType type, List <TaskBase> followUpTasks) :
     this(name, scope, position, timeLim, priority, isinterruptible, urgencyLevel, onDoneFunction, type)
 {
     this.followUpTasks = followUpTasks;
 }
Example #8
0
 public WalkTask(string name, TaskScope scope, Vector3 position, float timeLim, float priority, bool isinterruptible, int urgencyLevel, Func <bool> onDoneFunction, eAnimationType type) :
     this(name, scope, position, timeLim, priority, isinterruptible, urgencyLevel, onDoneFunction)
 {
     this.workAnimationType = type;
 }
Example #9
0
 public TaskBase(string name, TaskScope scope, Transform transform, float timeLim, float prio, float workTime, bool isinterruptible, int urgency, Func <bool> OnDoneFunction, eAnimationType type, InteractableObject interObject, List <TaskBase> followUpTasks) :
     this(name, scope, transform, timeLim, prio, workTime, isinterruptible, urgency, OnDoneFunction, type, interObject)
 {
     this.followUpTasks = followUpTasks;
 }
Example #10
0
 public TaskBase(string name, TaskScope scope, Transform transform, float timeLim, float prio, float workTime, bool isinterruptible, int urgency, Func <bool> OnDoneFunction, eAnimationType type) :
     this(name, scope, transform, timeLim, prio, workTime, isinterruptible, urgency, OnDoneFunction)
 {
     this.workAnimationType = type;
 }
 public void SetCurrentState(eAnimationType selectedState)
 {
     currentState = selectedState;
     UpdateCommand();
 }
        public XmlLayoutAnimation(AttributeDictionary attributes)
        {
            if (attributes.ContainsKey("type"))
            {
                type = (eAnimationType)Enum.Parse(typeof(eAnimationType), attributes["type"]);
            }

            if (attributes.ContainsKey("attribute"))
            {
                attribute = attributes["attribute"];
            }

            if (attributes.ContainsKey("duration"))
            {
                duration = attributes["duration"].ToFloat();
            }

            if (attributes.ContainsKey("animations"))
            {
                animations = attributes["animations"].ToClassList();
            }

            if (!attributes.ContainsKey("valueType"))
            {
                attributes.Add("valueType", "float");
            }

            switch (attributes["valueType"])
            {
            case "float":
                valueType = typeof(float);
                break;

            case "Vector2":
                valueType = typeof(Vector2);
                break;

            case "Vector3":
                valueType = typeof(Vector3);
                break;

            case "Color":
                valueType = typeof(Color);
                break;
            }

            if (attributes.ContainsKey("to"))
            {
                valueTo = attributes["to"].ChangeToType(valueType);
            }

            if (attributes.ContainsKey("from"))
            {
                valueFrom    = attributes["from"].ChangeToType(valueType);
                hasValueFrom = true;
            }

            if (attributes.ContainsKey("curve"))
            {
                curve = attributes["curve"];
            }
        }
Example #13
0
 public WanderTask(string name, TaskScope scope, Vector3 position, Func <bool> isTaskStillValidFunction, float timeLim, float priority, bool isinterruptible, int urgencyLevel, float waitAroundTime, eAnimationType type, Func <bool> onWorkDoneFunction) :
     this(name, scope, position, isTaskStillValidFunction, timeLim, priority, isinterruptible, urgencyLevel, waitAroundTime)
 {
     this.workAnimationType  = type;
     this.onWorkDonefunction = onWorkDoneFunction;
 }
Example #14
0
 public WanderTask(string name, TaskScope scope, Vector3 position, Func <bool> isTaskStillValidFunction, float timeLim, float priority, bool isinterruptible, int urgencyLevel, float waitAroundTime, eAnimationType type, List <TaskBase> followUpTasks) :
     this(name, scope, position, isTaskStillValidFunction, timeLim, priority, isinterruptible, urgencyLevel, waitAroundTime, type)
 {
     this.followUpTasks = followUpTasks;
 }
Example #15
0
 public void Init()
 {
     selectType = eAnimationType.Type_None;
 }