SharpHammer / DarkMotion / State.cs

using SharpHammer;
using Newtonsoft.Json;
using System.Collections.Generic;
using System.ComponentModel;

namespace DarkMotion
{
	[JsonObject(MemberSerialization.OptIn)]
	public class State : INotifyPropertyChanged
	{
		[JsonProperty("Name")]
		private string name = "";

		private Vec2 position;

		[JsonProperty("Sequence")]
		private Sequence sequence;

		[JsonProperty("Speed")]
		private float speed = 1.0f;

		[JsonProperty("EDITOR_Parent")]
		private StateMachine stateMachine;

		[JsonProperty("Tag")]
		private string tag = "";

		[JsonProperty("Transitions")]
		private List<Transition> transitions = new List<Transition>();

		public State()
		{
		}

		public State(string name, Sequence sequence, StateMachine stateMachine)
		{
			this.name = name;
			this.sequence = sequence;
			this.stateMachine = stateMachine;
		}

		public event PropertyChangedEventHandler PropertyChanged;

		public string Name
		{
			get
			{
				return name;
			}
			set
			{
				name = value;
			}
		}

		public Vec2 Position
		{
			get
			{
				return position;
			}
			set
			{
				position = value;
			}
		}

		public Sequence Sequence
		{
			get
			{
				return sequence;
			}
			set
			{
				sequence = value;
			}
		}

		public float Speed
		{
			get
			{
				return speed;
			}
			set
			{
				speed = value;
				OnPropertyChanged("Speed");
			}
		}

		public StateMachine StateMachine
		{
			get
			{
				return stateMachine;
			}
		}

		public string Tag
		{
			get
			{
				return tag;
			}
			set
			{
				tag = value;
			}
		}

		public List<Transition> Transitions
		{
			get
			{
				return transitions;
			}
			set
			{
				transitions = value;
			}
		}

		[JsonProperty("Editor_X")]
		public float X
		{
			get
			{
				return position.X;
			}
			set
			{
				position.X = value;
			}
		}

		[JsonProperty("Editor_Y")]
		public float Y
		{
			get
			{
				return position.Y;
			}
			set
			{
				position.Y = value;
			}
		}

		private void OnPropertyChanged(string name)
		{
			if (PropertyChanged != null)
				PropertyChanged(this, new PropertyChangedEventArgs(name));
		}
	}
}
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.