// -------------------- override protected void OnCreatePressed(bool selectAfterwards) { ControlFreak2.TouchButton button = (ControlFreak2.TouchButton) this.CreateDynamicTouchControl(typeof(ControlFreak2.TouchButton)); TouchControlWizardUtils.CreateButtonAnimator(button, "-Sprite", this.defaultSprite, 1.0f); if (this.pressBinding.enabled) { button.pressBinding.CopyFrom(this.pressBinding); } if (this.toggleBinding.enabled) { button.toggle = true; button.toggleOnlyBinding.CopyFrom(this.toggleBinding); } Undo.RegisterCreatedObjectUndo(button.gameObject, "Create Touch Button"); if (selectAfterwards) { Selection.activeObject = button; } }
// ---------------------- override protected void OnUpdateAnimator(bool skipAnim) { TouchButton button = (TouchButton)this.sourceControl; if ((button == null) || (this.image == null)) { return; } bool pressed = button.Pressed(); bool toggled = button.Toggled(); SpriteConfig sprite = null; if ((pressed && toggled) && ((sprite == null) || !sprite.enabled)) { sprite = this.spriteToggledAndPressed; } if (toggled && ((sprite == null) || !sprite.enabled)) { sprite = this.spriteToggled; } if (pressed && ((sprite == null) || !sprite.enabled)) { sprite = this.spritePressed; } if (((sprite == null) || !sprite.enabled)) { sprite = this.spriteNeutral; } this.BeginSpriteAnim((sprite == null) ? this.spriteNeutral : sprite, false); this.UpdateSpriteAnimation(skipAnim); }