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"); }
public void ChangeForm(SpiritForm form) { Form = form; if (OnFormChange != null) { OnFormChange(form); } }
private void onFormChanged(SpiritForm form) { _currentForm = form; _isChangingForm = true; if (MorphAnimations.ContainsKey(form)) { playAnimation(MorphAnimations[form]); } }