Beispiel #1
0
 public SimplePatrolAI(LevelObjectView view, SimplePatrolAIModel aiModel, SpriteAnimatorConfig animator)
 {
     _view     = view != null ? view : throw new ArgumentException(nameof(view));
     _aiModel  = aiModel != null ? aiModel : throw new ArgumentException(nameof(aiModel));
     _animator = animator != null ? new SpriteAnimator(animator) : throw new ArgumentException(nameof(animator));
     _animator.StartAnimation(_view.SpriteRenderer, AnimState.Run, true, _animationSpeed);
 }
Beispiel #2
0
 public PlayerAnimation(SpriteRenderer sprite, PlayerConfig config)
 {
     _playerAnimator = new SpriteAnimator(config.KnightAnimeCnf);
     _animationSpeed = config.AnimationSpeed;
     _spriteRenderer = sprite;
     _animationState = AnimState.Idle;
     _playerAnimator.StartAnimation(_spriteRenderer, _animationState, true, _animationSpeed);
 }
Beispiel #3
0
        public override void OnAddedToEntity()
        {
            var texture = Entity.Scene.Content.LoadSpriteAtlas("Content/Assets/Player/Player.atlas");

            _boxCollider = Entity.GetComponent <BoxCollider>();
            _mover       = Entity.GetComponent <TiledMapMover>();
            _animator    = Entity.AddComponent(new SpriteAnimator());
            _animator.AddAnimationsFromAtlas(texture);
            _animator.Speed = 0.7f;
            _animator.Play("idle");
            SetupInput();
        }
Beispiel #4
0
 public CoinAnimation(Transform coin, ItemConfig config)
 {
     _coinsAnimator  = new SpriteAnimator(config.ItemAnimatorCnf);
     _spriteRenderer = coin.GetComponentInChildren <SpriteRenderer>();
     _coinsAnimator.StartAnimation(_spriteRenderer, AnimState.Idle, true, config.ItemAnimationSpeed);
 }