Exemplo n.º 1
0
        /************************************************************************************************************************/

        /// <summary>
        /// Creates and returns a new <see cref="CartesianMixerState"/> or <see cref="DirectionalMixerState"/>
        /// depending on the <see cref="Type"/>.
        /// </summary>
        /// <remarks>
        /// Note that using methods like <see cref="AnimancerPlayable.Play(ITransition)"/> will also call
        /// <see cref="ITransition.Apply"/>, so if you call this method manually you may want to call that method
        /// as well. Or you can just use <see cref="AnimancerUtilities.CreateStateAndApply"/>.
        /// <para></para>
        /// This method also assigns it as the <see cref="AnimancerTransition{TState}.State"/>.
        /// </remarks>
        public override MixerState <Vector2> CreateState()
        {
            switch (_Type)
            {
            case MixerType.Cartesian: State = new CartesianMixerState(); break;

            case MixerType.Directional: State = new DirectionalMixerState(); break;

            default: throw new ArgumentOutOfRangeException(nameof(_Type));
            }
            InitializeState();
            return(State);
        }
Exemplo n.º 2
0
            /************************************************************************************************************************/

            /// <summary>
            /// Creates and returns a new <see cref="CartesianMixerState"/> or <see cref="DirectionalMixerState"/>
            /// depending on the <see cref="Type"/> connected to the 'layer'.
            /// <para></para>
            /// This method also assigns it as the <see cref="AnimancerState.Serializable{TState}.State"/>.
            /// </summary>
            public override MixerState <Vector2> CreateState(AnimancerLayer layer)
            {
                switch (_Type)
                {
                case MixerType.Cartesian: State = new CartesianMixerState(layer); break;

                case MixerType.Directional: State = new DirectionalMixerState(layer); break;

                default: throw new ArgumentOutOfRangeException("_Type");
                }
                InitialiseState();
                return(State);
            }