Exemple #1
0
        public override void Start()
        {
            // Get animation components.
            var anims = GetComponents <AnimationComponent>();

            _animations = new Bag <AnimationComponent>(anims.Count);
            anims.ForEach((anim) =>
            {
                anim.Sprite.AnimationFinished += animationFinished;
                _animations.Add(anim);
            });

            // Get source components.
            _physics = GetComponent <SpiritPhysicsComponent>();

            // Hook into physics events.
            if (_physics != null)
            {
                _physics.OnFormChange  = onFormChanged;
                _physics.OnStateChange = onStateChanged;
            }

            _currentForm = SpiritForm.SF_BALL;
            playAnimation("BallIdle");
        }
Exemple #2
0
 public void ChangeForm(SpiritForm form)
 {
     Form = form;
     if (OnFormChange != null)
     {
         OnFormChange(form);
     }
 }
Exemple #3
0
 private void onFormChanged(SpiritForm form)
 {
     _currentForm    = form;
     _isChangingForm = true;
     if (MorphAnimations.ContainsKey(form))
     {
         playAnimation(MorphAnimations[form]);
     }
 }