public void Init()
 {
     _actionCache.Clear();
     _currentAction     = CharacterAction.UNDEFINED;
     _currentMoveAction = CharacterAction.UNDEFINED;
     _currentTime       = 0f;
     _actionConfig      = null;
 }
Пример #2
0
        public override bool Init()
        {
            var characterConfig = new CharacterConfig();

            characterConfig.characterID        = 1;
            characterConfig.characterName      = "虞姬";
            characterConfig.resName            = "yuji";
            characterConfig.runSpeed           = 10f;
            characterConfig.attackContinueTime = 0.5f;

            var actionConfig = new CharacterActionConfig();

            actionConfig.actionType = CharacterAction.IDLE;
            actionConfig.canRotate  = false;
            actionConfig.frameCount = 32;
            actionConfig.nextActions.Clear();
            characterConfig.actionConfig[actionConfig.actionType] = actionConfig;

            actionConfig            = new CharacterActionConfig();
            actionConfig.actionType = CharacterAction.RUN;
            actionConfig.canRotate  = true;
            actionConfig.frameCount = 18;
            actionConfig.nextActions.Clear();
            characterConfig.actionConfig[actionConfig.actionType] = actionConfig;

            actionConfig            = new CharacterActionConfig();
            actionConfig.actionType = CharacterAction.ATTACK1;
            actionConfig.canRotate  = false;
            actionConfig.frameCount = 24;
            actionConfig.nextActions.Clear();
            actionConfig.nextActions.Add(CharacterAction.ATTACK2);
            characterConfig.actionConfig[actionConfig.actionType] = actionConfig;

            actionConfig            = new CharacterActionConfig();
            actionConfig.actionType = CharacterAction.ATTACK2;
            actionConfig.canRotate  = false;
            actionConfig.frameCount = 26;
            actionConfig.nextActions.Clear();
            actionConfig.nextActions.Add(CharacterAction.ATTACK3);
            characterConfig.actionConfig[actionConfig.actionType] = actionConfig;

            actionConfig            = new CharacterActionConfig();
            actionConfig.actionType = CharacterAction.ATTACK3;
            actionConfig.canRotate  = false;
            actionConfig.frameCount = 30;
            actionConfig.nextActions.Clear();
            characterConfig.actionConfig[actionConfig.actionType] = actionConfig;

            _characterConfigs[characterConfig.characterID] = characterConfig;
            return(true);
        }
 private void DoChangeAnimationSet(CharacterAction action)
 {
     if (action == CharacterAction.UNDEFINED)
     {
         return;
     }
     _currentAction = action;
     _actionConfig  = _host.ThisConfig.actionConfig[action];
     _totalFrame    = _actionConfig.frameCount;
     _totalTime     = _totalFrame * CommonFunction.ANIMATION_TIME_PRE_FRAME;
     _currentTime   = 0;
     _currentFrame  = 0;
     _driveTime     = 0;
     _isLoop        = CheckIsLoop;
     _host.OnActionChanged();
     _host.ThisView.SetCondition(CommonFunction.ACTION_ID_HASH, (int)_currentAction);
 }
 public void Release()
 {
     _actionConfig = null;
 }