public ActorData(GameObject input) { Actor inputActor = input.GetComponent <Actor>(); superState = inputActor.GetSuperState(); state = inputActor.curState; position = new Vector3Data(input.transform.position); prefabPath = inputActor.prefabPath; isActive = input.activeSelf; if (isActive) { if (inputActor.GetDestinationTile() != null) { destinationTile = new TileCoordinates(inputActor.GetDestinationTile()); } if (inputActor.GetDestinationTileForMove() != null) { destinationTileForMove = new TileForMoveCoordinates(inputActor.GetDestinationTileForMove()); } //curTile = new TileCoordinates(inputTraveler.GetCurTile()); if (inputActor.GetCurTile() != null) { curTile = new TileCoordinates(inputActor.GetCurTile()); } if (inputActor.GetCurTileForMove() != null) { curTileForMove = new TileForMoveCoordinates(inputActor.GetCurTileForMove()); } } }
public override State Build(FSMRepresentationBuilder fb) { ConcreteSubStateImpl retval = null; var sr = fb.GetStateRep(this.SuperStateName); if (sr != null) { sr.Build(fb); SuperState superState = fb.GetBuiltSuperState(this.SuperStateName); if (superState != null) { retval = new ConcreteSubStateImpl(this.StateName, superState); fb.AddBuiltConcreteState(retval); } else { var e = $"Could not build sub state ({this.StateName}) because super state ({this.SuperStateName}) had an error."; fb.SetError(); fb.Error(sr.SyntaxLocation, e); } } else { var e = $"Super state ({this.SuperStateName}) was not declared."; fb.SetError(); fb.Error(null, e); } return(retval); }
public static SuperState WithStart() { var superState = new SuperState(); superState.nest.source = GraphSource.Embed; superState.nest.embed = StateGraph.WithStart(); return(superState); }
public void SuperTransition(Peach peach) { sound = peach.Content.Load <SoundEffect>("Sound Effects/Power Up"); sound.Play(); var state = new SuperState(); peach.PowerUpState = state; peach.SwitchToSuperSprite(PreviousState); }
//public void AddMoveStartedEventHandler(MoveStartedEventHandler newEvent) //{ // if (moveStartedEvent == null) // { // moveStartedEvent += newEvent; // return; // } // System.Delegate[] invocations = moveStartedEvent.GetInvocationList(); // bool isNew = true; // for (int i = 0; i < invocations.Length; i++) // { // if (invocations[i].Target == newEvent.Target) // isNew = false; // } // if (isNew) // moveStartedEvent += newEvent; //} #endregion #region ICombatant public virtual bool ValidatingEnemy(ICombatant enemy) { SuperState enemySuperState = enemy.GetSuperState(); // 적이 살아 있을 때. if (enemySuperState != SuperState.Dead && enemySuperState != SuperState.SkirmishDefeated && enemySuperState != SuperState.PassedOut) { return(true); } else { return(false); } }
//public void AddMoveStartedEventHandler(MoveStartedEventHandler newEvent) //{ // if (moveStartedEvent == null) // { // moveStartedEvent += newEvent; // return; // } // System.Delegate[] invocations = moveStartedEvent.GetInvocationList(); // bool isNew = true; // for (int i = 0; i < invocations.Length; i++) // { // if (invocations[i].Target == newEvent.Target) // isNew = false; // } // if (isNew) // moveStartedEvent += newEvent; //} #endregion #region ICombatant public bool ValidatingEnemy(ICombatant enemy) { SuperState enemySuperState = enemy.GetSuperState(); // 적이 사냥터 내에 있으며 살아 있을 때. if (enemySuperState == SuperState.Battle || enemySuperState == SuperState.SearchingMonster || enemySuperState == SuperState.AfterBattle || enemySuperState == SuperState.ExitingHuntingArea || enemySuperState == SuperState.BossBattle) { return(true); } else { return(false); } }
public void AddBuiltSuperState(SuperState s) { this.itsSuperStateDictionary.Add(s.Name, s); AddBuiltState(s); }
public void ResizeObjects(Point dest) { Point offset; offset = new Point(dest.X - MovingPoint.X, dest.Y - MovingPoint.Y); foreach (DrawableObject obj in SelectedObjects) { obj.ResizeCheck(ref offset, ResizingType); } foreach (DrawableObject obj in SelectedObjects) { if (obj is Transition) { PreviousObject = OnObject; OnObject = draw.GetOnObject(dest); OnTransition = (Transition)obj; if (OnObject == null) { offset = new Point(dest.X - MovingPoint.X, dest.Y - MovingPoint.Y); OnTransition.Resize(offset, ResizingType); if (ResizingType == ResizingTypes.Spline0) { OnTransition.StartObject = null; } else if (ResizingType == ResizingTypes.Spline3) { OnTransition.EndObject = null; } } else if (ResizingType == ResizingTypes.Spline0) { if ((obj is Transition && (OnObject is End || OnObject is Abort || OnObject is Relation)) || (obj is SuperTransition && (OnObject is Alias || OnObject is SimpleState || OnObject is StateAlias)) || (OnObject is Origin && OnObject.OutTransitions.Length != 0 && OnTransition != OnObject.OutTransitions.First())) { OnObject = null; return; } else { double angle; OnObject.Intersect(dest, ref StartDrawPoint, ref OnTransition.StartAngle); offset = new Point(StartDrawPoint.X - MovingPoint.X, StartDrawPoint.Y - MovingPoint.Y); OnTransition.Resize(offset, ResizingType); OnTransition.OutDir(OnObject.OutDir(StartDrawPoint, out angle), 1); } if (PreviousObject != OnObject) { OnTransition.StartObject = OnObject; } } else if (ResizingType == ResizingTypes.Spline3) { if (OnObject is Origin || OnObject is Relation) { OnObject = null; return; } else { double angle; OnObject.Intersect(dest, ref StartDrawPoint, ref OnTransition.EndAngle); offset = new Point(StartDrawPoint.X - MovingPoint.X, StartDrawPoint.Y - MovingPoint.Y); OnTransition.Resize(offset, ResizingType); OnTransition.OutDir(OnObject.OutDir(StartDrawPoint, out angle), 2); } if (PreviousObject != OnObject) { OnTransition.EndObject = OnObject; } } } else if (obj is SimpleState || obj is StateAlias) { State oState = (State)obj; obj.Resize(offset, ResizingType); foreach (Transition oTransition in oState.InTransitions) { oTransition.MoveEndTo(oState.PointFromAngle(oTransition.EndAngle)); } foreach (Transition oTransition in oState.OutTransitions) { oTransition.MoveStartTo(oState.PointFromAngle(oTransition.StartAngle)); } } else if (obj is SuperState) { SuperState oState = (SuperState)obj; obj.Resize(offset, ResizingType); foreach (Transition oTransition in oState.InTransitions) { oTransition.MoveEndTo(oState.PointFromOffset(ResizingType, oTransition.EndPoint, oTransition.EndAngle)); } foreach (Transition oTransition in oState.OutTransitions) { oTransition.MoveStartTo(oState.PointFromOffset(ResizingType, oTransition.StartPoint, oTransition.StartAngle)); } } else if (obj is Nested) { Nested oState = (Nested)obj; obj.Resize(offset, ResizingType); foreach (Transition oTransition in oState.InTransitions) { oTransition.MoveEndTo(oState.PointFromOffset(ResizingType, oTransition.EndPoint, oTransition.EndAngle)); } foreach (Transition oTransition in oState.OutTransitions) { oTransition.MoveStartTo(oState.PointFromOffset(ResizingType, oTransition.StartPoint, oTransition.StartAngle)); } } else { obj.Resize(offset, ResizingType); } } MovingPoint.Offset(offset); }
public SuperSubStateImpl(string str, SuperState ss) : base(str) { this.SuperState = ss; }
public ConcreteSubStateImpl(string theName, SuperState ss) : base(theName) { this.SuperState = ss; }
public void ResetToReuse() { superState = SuperState.Idle; state = State.Idle; isNew = true; }
public void SetSuperState(SuperState input) { superState = input; }