Exemple #1
0
        protected override void OnAwake()
        {
            animationData    = Components.Get <IAnimationData>();
            gameObjectGetter = Components.Get <IGameObjectGetter>();
            messageSender    = Components.Get <IMessageSender>();

            SubscribeToAnimationStateChanged();
        }
        protected override void OnInitialize(IActor owner)
        {
            _aiNavigationData = owner.GetData <AiNavigationData>();
            _transformData    = owner.GetData <TransformData>();
            _animationData    = owner.GetData <AnimationData>();

            _navMeshAgent = _aiNavigationData.NavMeshAgent;
            _aiNavigationData.Player.PropertyChanged += HandleFollowingActorChanged;

            _navMeshAgent.updatePosition = false;
            _navMeshAgent.updateRotation = true;
        }
        protected override void OnInitialize(IActor owner)
        {
            base.OnInitialize(owner);

            _animationData = Owner.GetData <AnimationData>();
            _animator      = _animationData.GetAnimator();
            _movementData  = Owner.GetData <MovementData>();
            _bindingData   = Owner.GetData <KeyBindingsData>();

            _horizontalKeyAxis = _bindingData.HorizontalKeyAxis();
            _verticalKeyAxis   = _bindingData.VerticalKeyAxis();
        }
Exemple #4
0
        /// <summary>
        /// Add a new animation
        /// </summary>
        public void AddAnimation(string name, IAnimationData animation)
        {
            if (animations.ContainsKey(name))
            {
                throw new Exception("The animation with this name already exists");
            }
            FrameAnimation frameAnimation = animation as FrameAnimation;

            animations.Add(name, frameAnimation);
            if (animations.Count == 1)
            {
                currentAnimation = frameAnimation;
            }
        }
 /// <summary>
 /// Add a new animation
 /// </summary>
 public void AddAnimation(string name, IAnimationData animation)
 {
     if (name == null)
     {
         return;
     }
     if (!animations.ContainsKey(name))
     {
         FrameAnimation frameAnimation = animation as FrameAnimation;
         animations.Add(name, frameAnimation);
         if (animations.Count == 1)
         {
             currentAnimation = frameAnimation;
         }
     }
     else
     {
         throw new Exception("There is already an animation with the same name");
     }
 }
 public AnimatedParticleEmitter(int particleCount, AnimatedSprite sprite, IAnimationData animation, ParticleProperties props, IParticleEmitMode emitMode, bool useGravity = false, Entity parent = null)
     : base(particleCount, sprite, props, emitMode, useGravity, parent)
 {
     this.sprite    = sprite;
     this.animation = animation;
 }
Exemple #7
0
 public ChangeAnimationStateHandler(IGameObject player)
 {
     animationData = player.Components.Get <IAnimationData>();
 }