/// <summary> /// Initializes a new instance of the <see cref="SingleAnimationGameAction" /> class. /// </summary> /// <param name="parent">The parent task.</param> /// <param name="singleAnimation">The single animation.</param> /// <param name="animation">The AnimationUI component.</param> /// <param name="dependencyProperty">The dependency property to animate.</param> public SingleAnimationGameAction(IGameAction parent, SingleAnimation singleAnimation, AnimationUI animation, DependencyProperty dependencyProperty) : base(parent, "SingleAnimationGameAction" + instances++) { this.animation = animation; this.singleAnimation = singleAnimation; this.dependencyProperty = dependencyProperty; }
/// <summary> /// Initializes a new instance of the <see cref="PlaySoundGameAction" /> class. /// </summary> /// <param name="parent">The parent task.</param> /// <param name="soundInfo">The sound info to play</param> /// <param name="volume">The sound volume</param> /// <param name="loop">The sound loop is enabled</param> public PlaySoundGameAction(IGameAction parent, SoundInfo soundInfo, float volume = 1, bool loop = false) : base(parent, "PlaySoundGameAction" + instances++) { this.SoundInfo = soundInfo; this.volume = volume; this.loop = loop; }
protected override void CreateScene() { this.Load(WaveContent.Scenes.Scene1); AnimationSlot animationSlot1 = new AnimationSlot() { TransformationType = AnimationSlot.TransformationTypes.Position, TotalTime = TimeSpan.FromSeconds(1.5f), StartPosition = new Vector3(0, 0, 0), EndPosition = new Vector3(0, 2, 0), }; AnimationSlot animationSlot2 = new AnimationSlot() { TransformationType = AnimationSlot.TransformationTypes.Rotation, TotalTime = TimeSpan.FromSeconds(1.5f), StartRotation = new Vector3(0, 0, 0), EndRotation = new Vector3(0, (float)Math.PI * 2, 0), }; Animation3DBehavior cubeAnimationBehavior = this.EntityManager.Find("cube").FindComponent<Animation3DBehavior>(); this.animationSequence = this.CreateGameAction(this.CreateGameAction(new Animation3DGameAction(animationSlot1, cubeAnimationBehavior))) .ContinueWith(new Animation3DGameAction(animationSlot2, cubeAnimationBehavior)); }
/// <summary> /// Creates instance of the GameActionIconBox and store reference on action. Also adds MouseClick action GameActionClicked. /// </summary> /// <param name="action"></param> public GameActionIconBox(IGameAction action) { this.action = action; Load(action.IconPath()); Size = new Miyagi.Common.Data.Size(25, 25); MouseClick += GameActionClicked; }
public void RegisterDelayedAction(IGameAction action, float delayInSeconds, ActionCompletedCallback callback = null) { delayedActions.Add(action); delayedActionsTime.Add(delayInSeconds); RegisterCallback(action, callback); }
public IGameAction PlayerPasses(params Player[] players) { foreach (var player in players) LastAction = new PlayerPassAction(LastAction, player); return LastAction; }
private void ColorChangeActionCompleted(IGameAction action) { if (Parent == null || ParentGameObject.Destroyed) return; PrepareColorChangeAction(); }
protected void RegisterCallback(IGameAction action, ActionCompletedCallback callback) { if (callback != null && !callbacks.ContainsKey(action)) { callbacks.Add(action, callback); action.OnGameActionFinished += OnGameActionFinished; } }
/// <summary> /// Continue with another action. /// </summary> /// <param name="parent">The parent action.</param> /// <param name="nextAction">The next action.</param> /// <returns>An action that continue with the next action when the parent is completed</returns> /// <exception cref="System.NotSupportedException">It is not possible to continue with, aborted or finised task. Defer the run command to a posterior stage.</exception> public static IGameAction ContinueWith(this IGameAction parent, IGameAction nextAction) { if (nextAction.State == WaveEngine.Framework.Services.TaskState.Finished || nextAction.State == WaveEngine.Framework.Services.TaskState.Aborted) { throw new NotSupportedException("It is not possible to continue with, aborted or finised task. Defer the run command to a posterior stage."); } return new GameActionNode(parent, nextAction); }
public override void CopyInto(IGameAction newObject) { var action = newObject as ColorChangeAction; Debug.Assert(action != null); action.Color = Color; base.CopyInto(newObject); }
private void OnGameActionFinished(IGameAction source) { source.OnGameActionFinished -= OnGameActionFinished; if (callbacks.ContainsKey(source)) { callbacks[source](source); callbacks.Remove(source); } }
public override void CopyInto(IGameAction newObject) { var action = newObject as GivePointsAction; Debug.Assert(action != null); action.Points = Points; base.CopyInto(newObject); }
public override void CopyInto(IGameAction newObject) { var action = newObject as PhysicsImpulseAction; Debug.Assert(action != null); action.Impulse = Impulse; base.CopyInto(newObject); }
public override void CopyInto(IGameAction newObject) { var action = newObject as DirectMovementAction; Debug.Assert(action != null); action.MovementAmount = MovementAmount; base.CopyInto(newObject); }
public override void CopyInto(IGameAction newObject) { var action = newObject as OneShotEmitParticleAction; Debug.Assert(action != null); action.ParticleName = ParticleName; base.CopyInto(newObject); }
public override void CopyInto(IGameAction newObject) { var action = newObject as DirectAngularMovementAction; Debug.Assert(action != null); action.MovementSpeed = MovementSpeed; action.MovementAngle = MovementAngle; base.CopyInto(newObject); }
public override void CopyInto(IGameAction newObject) { var action = newObject as FireProjectileAction; Debug.Assert(action != null); action.ProjectileName = ProjectileName; action.ProjectileLayer = ProjectileLayer; action.ProjectilePosition = ProjectilePosition; action.Direction = Direction; base.CopyInto(newObject); }
private void Match_OnActionEnd(IGameAction action) { if (action is TargetAction) { TargetAction targetAction = (TargetAction)action; IInventoryItem item = _creaturesInventory[targetAction.Source].ItemList.FirstOrDefault(x => x.GameAction == action); if (item != null) { RemoveItemFromInventory(targetAction.Source, item); OnRemoveInventoryItem?.Invoke(targetAction.Source, item); } } }
public void FireAction(IGameAction action, IGameObject target, ActionCompletedCallback callback = null, float delay = 0f) { action.Parent = Parent; action.Target = target; if (delay > 0f) { actionManager.RegisterDelayedAction(action, delay, callback); } else { actionManager.RegisterAction(action, callback); } }
/// <summary> /// 转换Action /// </summary> /// <typeparam name="T"></typeparam> /// <param name="inputAction"></param> /// <param name="outputAction"></param> /// <param name="error"></param> /// <returns></returns> protected bool ParseAction <T>(IGameAction inputAction, out T outputAction, out string error) where T : class, IGameAction { if (inputAction is T) { outputAction = inputAction as T; error = null; return(true); } outputAction = null; error = GetActionTypeErrorString(inputAction.GetType().Name, typeof(T).Name); return(false); }
public List <IGameAction> GetGameActionsFromRecord() { List <IGameAction> gameActions = new List <IGameAction>(); for (int i = 0, count = ActionTypes.Count; i < count; ++i) { Type actionType = Type.GetType(ActionTypes[i]); IGameAction gameAction = (IGameAction)Activator.CreateInstance(actionType); gameAction.PopulateFromJson(ActionDatas[i]); gameActions.Add(gameAction); } return(gameActions); }
private void SetStates(SwitchEnum star1, SwitchEnum star2, SwitchEnum star3) { float delay = 0; float delta = 0.5f; IGameAction animations = null; if (this.Owner != null && this.Owner.Scene != null) { animations = this.Owner.Scene.CreateEmptyGameAction(); } if (this.star1Component != null) { this.star1Component.State = star1; if (star1 == SwitchEnum.ON) { delay += delta; animations.ContinueWith(this.CreateStarAnimation(this.star1Component.Owner, delay)); } } if (this.star2Component != null) { this.star2Component.State = star2; if (star2 == SwitchEnum.ON) { delay += delta; animations.ContinueWith(this.CreateStarAnimation(this.star2Component.Owner, delay)); } } if (this.star3Component != null) { this.star3Component.State = star3; if (star3 == SwitchEnum.ON) { delay += delta; animations.ContinueWith(this.CreateStarAnimation(this.star3Component.Owner, delay)); } } if (animations != null) { animations.Run(); } }
public bool TryApplyAction(ServerGameState state, IGameAction action) { if (state != null) { var gameState = state.SharedState; if (gameState.TryApply(action)) { AddAction(state, action); TryEndGame(state); return(true); } } return(false); }
public void gameActionOnEmptySpaceIsValid() { IGameEngine engine = GetDefaultGameEngine(2); IList <IPlayer> players = engine.Players; IPlayer player2 = players[1]; Assert.True(player2 is MockPlayer); Assert.False(player2 is MockHumanPlayer); IGameAction action = player2.RequestAction(); bool isValid = engine.IsValidGameAction(action); Assert.True(isValid); }
public AIHandler(IGameAction gameAction, CreatureFaction faction) { this.gameAction = gameAction; this.Faction = faction; if (this.Faction == CreatureFaction.Enemy) { creatureList = gameAction.GetAllEnemies(); } else if (this.Faction == CreatureFaction.Npc) { creatureList = gameAction.GetAllNpcs(); } }
public void SelectState(BehaiourState state) { Stop(); IGameAction action; if (!_behaviours.TryGetValue(state, out action)) { return; } _current = action; _state = state; _current.Ended += OnActionEnd; _current.Start(); }
private void OnComplete(IGameAction action) { _completedCount++; if (action.Status == /*ActionStatus.Failure*/ _breakStatus) { End(/*ActionStatus.Failure*/ _breakStatus); } else { if (_completedCount == Count) { End(/*ActionStatus.Success*/ _returnStatus); } } }
public SelecteMagicTargetState(IGameAction action, FDCreature creature, MagicDefinition magic) : base(action) { this.Creature = creature; this.Magic = magic; if (this.Creature == null) { throw new ArgumentNullException("creature"); } if (this.Magic == null) { throw new ArgumentNullException("magic"); } }
public bool Turn() { int teamId = CurrentTeamId; IPlayer me = _players[teamId]; GetAvailableMoves(teamId); int moveNo = me.OnMove(Board, _availableMoves.ToArray()); IGameAction action = _actions[moveNo]; action.Act(this); TurnNo++; return(true); }
public void gameActionOnOccupiedSpaceIsNotValid() { IGameEngine engine = GetDefaultGameEngine(2); IList <IPlayer> players = engine.Players; IPlayer player2 = players[1]; IGameAction action = player2.RequestAction(); //should request an action from player 1 and do that action engine.DoTurn(); //the original requested action should no longer be valid bool isValid = engine.IsValidGameAction(action); Assert.False(isValid); }
protected override void Start() { base.Start(); IGameAction action = this.CreateDelayGameAction(TimeSpan.FromSeconds(1.0f)) .ContinueWith(new FloatAnimationGameAction(this.teapot, 0.0f, 255.0f, TimeSpan.FromSeconds(1.5f), EaseFunction.None, (v) => { this.disappearMaterial.Threshold = v; })) .ContinueWith(new FloatAnimationGameAction(this.teapot, 255.0f, 0.0f, TimeSpan.FromSeconds(1.5f), EaseFunction.None, (v) => { this.disappearMaterial.Threshold = v; })); action.Run(); }
/// <summary> /// Initializes a new instance of the <see cref="WaitCountGameAction" /> class. /// </summary> /// <param name="parent">The parent action.</param> /// <param name="countLimit">The count limit.</param> /// <param name="childActions">The child action list</param> public WaitCountGameAction(IGameAction parent, int countLimit, params IGameAction[] childActions) : base(parent, "WaitCountGameAction" + instances++) { if (countLimit < 0 || countLimit > childActions.Length) { throw new ArgumentOutOfRangeException("countLimit"); } if (childActions == null) { throw new ArgumentNullException("childActions"); } this.childActions = childActions; this.CountLimit = countLimit; }
/// <summary> /// Initializes a new instance of the <see cref="GameAction" /> class. /// </summary> /// <param name="parent">The parent.</param> /// <param name="taskName">Name of the task.</param> /// <exception cref="System.ArgumentException">parent task cannot be null. if is a root task, use the other constructor</exception> protected GameAction(IGameAction parent, string taskName) { this.IsSkippable = true; if (parent == null) { throw new ArgumentException("parent task cannot be null. if is a root task, use the other constructor"); } this.Parent = parent; parent.Completed += this.OnParentComplete; this.State = GameActionState.Waiting; this.Scene = parent.Scene; this.Name = taskName; }
public IGameAction GetAction(ActorData actorData) { if (actorData.Entity.EntityAnimator.IsAnimating) { return(null); } if (actorData.StoredAction != null) { IGameAction actionToReturn = actorData.StoredAction; actorData.StoredAction = null; return(actionToReturn); } return(ResolveActionForAggresion(actorData)); }
/// <summary> /// Initializes a new instance of the <see cref="WaitCountGameAction" /> class. /// </summary> /// <param name="parent">The parent action.</param> /// <param name="countLimit">The count limit.</param> /// <param name="childActionGenerators">The child generator action list</param> public WaitCountGameAction(IGameAction parent, int countLimit, params Func<IGameAction>[] childActionGenerators) : base(parent, "WaitCountGameAction" + instances++) { if (countLimit < 0 || countLimit > childActionGenerators.Length) { throw new ArgumentOutOfRangeException("countLimit"); } if (childActionGenerators == null) { throw new ArgumentNullException("childActionGenerators"); } this.childActionGenerators = childActionGenerators; this.CountLimit = countLimit; }
/// <summary> /// Initializes a new instance of the <see cref="GameAction" /> class. /// </summary> /// <param name="parent">The parent.</param> /// <param name="taskName">Name of the task.</param> /// <exception cref="System.ArgumentException">parent task cannot be null. if is a root task, use the other constructor</exception> protected GameAction(IGameAction parent, string taskName) { this.IsSkippable = true; if (parent == null) { throw new ArgumentException("parent task cannot be null. if is a root task, use the other constructor"); } this.Parent = parent; parent.Completed += this.OnParentComplete; this.State = TaskState.Waiting; this.Scene = parent.Scene; this.Name = taskName; }
public void ReportObservedAction(IGameAction action) { if (Observing) { ObservedItem.Actions.Add(action); if (ObservedItem.ModName == "") { try { System.Diagnostics.StackTrace stackTrace = new System.Diagnostics.StackTrace(); System.Diagnostics.StackFrame[] stackFrames = stackTrace.GetFrames(); ObservedItem.ModName = stackFrames[2].GetMethod().DeclaringType.Assembly.GetName().Name; } catch { Debug.LogError("Failed to retrieve calling assembly name"); } } } }
public override void DoAction(IEventArgs args) { IGameAction action = args.ComponentMap.GetAction(name); if (action != null) { action.Act(args); } else { if (defaultAction != null) { defaultAction.Act(args); } } }
protected override ActionStatus Run(IGameAction gameAction, IScenarioContent content, ClearArgs args, out string error) { switch (args.type) { case "text": return(ClearTextCmd(gameAction, args, out error)); // TODO other default: error = string.Format( "{0} Run -> UNESPECTED ERROR! the type `{1}` is not supported.", typeName, args.type); return(ActionStatus.Error); } }
private void OnComplete(IGameAction action) { if (action.Status == /*ActionStatus.Failure*/ _breakStatus) { End(/*ActionStatus.Failure*/ _breakStatus); return; } if (_enumerator == null || !_enumerator.MoveNext()) { End(/*ActionStatus.Success*/ _returnStatus); return; } _enumerator.Current?.Start(); }
public MenuState(IGameAction gameAction, FDPosition central) : base(gameAction) { this.Central = central; this.MenuItemPositions = new FDPosition[4] { FDPosition.At(Central.X - 1, Central.Y), FDPosition.At(Central.X, Central.Y - 1), FDPosition.At(Central.X + 1, Central.Y), FDPosition.At(Central.X, Central.Y + 1), }; this.MenuItemIds = new MenuItemId[4]; this.MenuActions = new Func <StateOperationResult> [4]; this.MenuItemEnabled = new bool[4]; }
public IGameAction GetAction(GameEntity entity) { // todo: remove this and use BlockedUntil. But for sure? Maybe this check is better? // now it causes problems when an animating actor is leaving sight (animation doesn't finish -> infinite loop) if (entity.view.Controller.Animator.IsAnimating) { return(null); } if (entity.hasPreparedAction) { IGameAction actionToReturn = entity.preparedAction.Action; entity.RemovePreparedAction(); return(actionToReturn); } if (!entity.hasActivity) { float score; Skill skill = _utilityAi.ResolveSkillWhenIdle(out score, entity); Activity newActivity; try { newActivity = skill.ActivityCreator.CreateActivity(_activityCreationContext, score, null, entity); } catch (Exception e) { Debug.LogError(e.Message + ", stack trace: " + e.StackTrace); newActivity = new WaitActivity(_actionFactory, 2, "Wait"); } entity.AddActivity(newActivity); newActivity.OnStart(entity); } IActivity activity = entity.activity.Activity; ActivityStep activityStep = activity.CheckAndResolveStep(entity); if (activityStep.State == ActivityState.FinishedSuccess || activityStep.State == ActivityState.FinishedFailure) { entity.RemoveActivity(); } IGameAction actionFromActivity = activityStep.GameAction; return(actionFromActivity); }
/// <summary> /// Perform cancel action /// </summary> protected override void PerformCancel() { if (this.childActions != null) { for (int i = 0; i < this.childActions.Length; i++) { IGameAction action = this.childActions[i]; if (action.State == TaskState.Running || action.State == TaskState.Waiting) { action.Cancel(); } } } base.PerformCancel(); }
protected override ActionStatus Run(IGameAction gameAction, IScenarioContent content, IfGotoArgs args, out string error) { ScenarioAction action; if (!ParseAction <ScenarioAction>(gameAction, out action, out error)) { return(ActionStatus.Error); } if (CompareResult(args.condition, args.left, args.right)) { return(action.GotoCommand(args.flag, out error)); } error = null; return(ActionStatus.Continue); }
public MenuActionState(IGameAction gameAction, int creatureId, FDPosition position) : base(gameAction, position) { this.CreatureId = creatureId; this.Creature = gameAction.GetCreature(creatureId); // Magic this.SetMenu(0, MenuItemId.ActionMagic, IsMenuMagicEnabled(), () => { CreatureShowInfoPack pack = new CreatureShowInfoPack(this.Creature, CreatureInfoType.SelectMagic); gameAction.GetCallback().OnHandlePack(pack); subState = SubActionState.SelectMagic; return(StateOperationResult.None()); }); // Attack this.SetMenu(1, MenuItemId.ActionAttack, IsMenuAttackEnabled(), () => { SelectAttackTargetState attackState = new SelectAttackTargetState(gameAction, this.Creature); return(StateOperationResult.Push(attackState)); }); // Item this.SetMenu(2, MenuItemId.ActionItems, IsMenuItemEnabled(), () => { MenuItemState itemState = new MenuItemState(gameAction, this.CreatureId, this.Central); return(StateOperationResult.Push(itemState)); }); // Rest this.SetMenu(3, MenuItemId.ActionRest, true, () => { // Check Treasure treasureItem = gameAction.GetTreatureAt(this.Creature.Position); if (treasureItem != null) { subState = SubActionState.ConfirmPickTreasure; return(StateOperationResult.None()); } gameAction.DoCreatureRest(this.CreatureId); return(StateOperationResult.Clear()); }); }
public MenuItemState(IGameAction gameAction, int creatureId, FDPosition position) : base(gameAction, position) { this.CreatureId = creatureId; this.Creature = gameAction.GetCreature(creatureId); // Exchange this.SetMenu(0, MenuItemId.ItemExchange, IsMenuExchangeEnabled(), () => { CreatureShowInfoPack pack = new CreatureShowInfoPack(this.Creature, CreatureInfoType.SelectAllItem); SendPack(pack); subState = SubActionState.SelectExchangeItem; return(StateOperationResult.None()); }); // Use this.SetMenu(1, MenuItemId.ItemUse, IsMenuUseEnabled(), () => { CreatureShowInfoPack pack = new CreatureShowInfoPack(this.Creature, CreatureInfoType.SelectUseItem); SendPack(pack); subState = SubActionState.SelectUseItem; return(StateOperationResult.None()); }); // Equip this.SetMenu(2, MenuItemId.ItemEquip, IsMenuEquipEnabled(), () => { CreatureShowInfoPack pack = new CreatureShowInfoPack(this.Creature, CreatureInfoType.SelectEquipItem); SendPack(pack); subState = SubActionState.SelectEquipItem; return(StateOperationResult.None()); }); // Discard this.SetMenu(3, MenuItemId.ItemDiscard, IsMenuDiscardEnabled(), () => { CreatureShowInfoPack pack = new CreatureShowInfoPack(this.Creature, CreatureInfoType.SelectAllItem); SendPack(pack); subState = SubActionState.SelectDiscardItem; return(StateOperationResult.None()); }); }
public Result PerformAction(IGameAction <TGameModel> gameAction, ref TGameModel game) { Result result = gameAction.Validate(game); if (!result.Success) { return(result); } try { return(gameAction.Perform(ref game)); } catch (Exception e) { return(Result.Create(false, new[] { $"{gameAction} was valid, but threw an exception: {e.Message}" })); } }
private void InitializeContext(IGameAction action) { var task = action as GameTask; if (task != null) { task.Context = Context; } var composite = action as Composite; if (composite != null) { foreach (var child in composite) { InitializeContext(child); } } }
public bool Turn() { int teamId = CurrentTeamId; IPlayer me = _players[teamId]; List <Move> availableMoves; List <IGameAction> actions; GetAvailableMoves(teamId, out availableMoves, out actions); int moveNo = me.OnMove(Board, availableMoves.ToArray()); IGameAction action = actions[moveNo]; action.Act(this); TurnNo++; return(true); }
public GameState GetLastValidState(IGameAction finalAction, GameActionValidator validator) { GameState state = GetInitialState(); if (finalAction == null) return state; foreach (var gameAction in finalAction.Sequence) { var newState = gameAction.TryApply(state, validator); if (validator.IsValid) state = newState; else { break; } } return state; }
/// <summary> /// Initializes a new instance of the <see cref="GameActionSet" /> class. /// </summary> /// <param name="parent">The parent action.</param> /// <param name="actionGenerators">The action list.</param> public GameActionSet(IGameAction parent, IEnumerable<Func<IGameAction>> actionGenerators) { this.actionGenerators = actionGenerators; this.parent = parent; }
/// <summary> /// Initializes a new instance of the <see cref="GameActionSet" /> class. /// </summary> /// <param name="parent">The parent action.</param> /// <param name="actions">The action list.</param> public GameActionSet(IGameAction parent, IEnumerable<IGameAction> actions) { this.actions = actions; this.parent = parent; }
/// <summary> /// Parent action is completed /// </summary> /// <param name="parent">The parent action</param> private void OnParentComplete(IGameAction parent) { this.Run(); }
/// <summary> /// Initializes a new instance of the <see cref="PlayMusicGameAction" /> class. /// </summary> /// <param name="parent">The parent task.</param> /// <param name="musicInfo">The music info to play</param> public PlayMusicGameAction(IGameAction parent, MusicInfo musicInfo) : base(parent, "PlayMusicGameAction" + instances++) { this.musicInfo = musicInfo; }
public void AddActionAfter(IGameAction action) { this.actionsAfter.Add(action); }
/// <summary> /// Initializes a new instance of the <see cref="ActiveWaitConditionGameAction" /> class. /// </summary> /// <param name="parent">The parent action</param> /// <param name="breakPredicate">The condition predicate</param> /// <param name="eventCount">The event count</param> public ActiveWaitConditionGameAction(IGameAction parent, Func<bool> breakPredicate, int eventCount = 1) : base(parent, "ActiveWaitConditionGameAction" + instances++) { this.Predicate = breakPredicate; this.EventCount = eventCount; }
protected override void CreateScene() { this.Load(WaveContent.Scenes.Scene2); AnimationSlot animationSlot0_1 = new AnimationSlot() { TransformationType = AnimationSlot.TransformationTypes.Rotation, TotalTime = TimeSpan.FromSeconds(1.5f), StartRotation = new Vector3(0, 0, 0), EndRotation = new Vector3(0, MathHelper.ToRadians(180), 0), }; AnimationSlot animationSlot1_1 = new AnimationSlot() { TransformationType = AnimationSlot.TransformationTypes.Rotation, TotalTime = TimeSpan.FromSeconds(1.5f), StartRotation = new Vector3(0, 0, 0), EndRotation = new Vector3(0, 0, MathHelper.ToRadians(16)), }; AnimationSlot animationSlot2_1 = new AnimationSlot() { TransformationType = AnimationSlot.TransformationTypes.Rotation, TotalTime = TimeSpan.FromSeconds(1.5f), StartRotation = new Vector3(0, 0, MathHelper.ToRadians(-20)), EndRotation = new Vector3(0, 0, MathHelper.ToRadians(2)), }; AnimationSlot animationSlot3_1 = new AnimationSlot() { TransformationType = AnimationSlot.TransformationTypes.Rotation, TotalTime = TimeSpan.FromSeconds(1.5f), StartRotation = new Vector3(0, 0, 0), EndRotation = new Vector3(0, 0, MathHelper.ToRadians(-20)), }; AnimationSlot animationSlot0_2 = new AnimationSlot() { TransformationType = AnimationSlot.TransformationTypes.Rotation, TotalTime = TimeSpan.FromSeconds(1.5f), StartRotation = new Vector3(0, MathHelper.ToRadians(180), 0), EndRotation = new Vector3(0, MathHelper.ToRadians(53), 0), }; AnimationSlot animationSlot1_2 = new AnimationSlot() { TransformationType = AnimationSlot.TransformationTypes.Rotation, TotalTime = TimeSpan.FromSeconds(1.5f), StartRotation = new Vector3(0, 0, MathHelper.ToRadians(16)), EndRotation = new Vector3(0, 0, MathHelper.ToRadians(-75)), }; AnimationSlot animationSlot2_2 = new AnimationSlot() { TransformationType = AnimationSlot.TransformationTypes.Rotation, TotalTime = TimeSpan.FromSeconds(1.5f), StartRotation = new Vector3(0, 0, MathHelper.ToRadians(2)), EndRotation = new Vector3(0, 0, MathHelper.ToRadians(50)), }; AnimationSlot animationSlot3_2 = new AnimationSlot() { TransformationType = AnimationSlot.TransformationTypes.Rotation, TotalTime = TimeSpan.FromSeconds(1.5f), StartRotation = new Vector3(0, 0, MathHelper.ToRadians(-20)), EndRotation = new Vector3(0, 0, MathHelper.ToRadians(-65)), }; this.cube1 = this.EntityManager.Find("cube1"); this.cube2 = this.EntityManager.Find("base.zone0.zone1.zone2.zone3.cube2"); Animation3DBehavior animationBehavior0 = this.EntityManager.Find("base.zone0").FindComponent<Animation3DBehavior>(); Animation3DBehavior animationBehavior1 = this.EntityManager.Find("base.zone0.zone1").FindComponent<Animation3DBehavior>(); Animation3DBehavior animationBehavior2 = this.EntityManager.Find("base.zone0.zone1.zone2").FindComponent<Animation3DBehavior>(); Animation3DBehavior animationBehavior3 = this.EntityManager.Find("base.zone0.zone1.zone2.zone3").FindComponent<Animation3DBehavior>(); this.animationSequence = this.CreateGameAction(new Animation3DGameAction(animationSlot0_1, animationBehavior0)) .CreateParallelGameActions(new List<IGameAction>() { new Animation3DGameAction(animationSlot2_1, animationBehavior2), new Animation3DGameAction(animationSlot1_1, animationBehavior1), new Animation3DGameAction(animationSlot3_1, animationBehavior3) }).WaitAll() .ContinueWithAction(() => { this.cube1.IsVisible = false; this.cube2.IsVisible = true; }) .CreateParallelGameActions(new List<IGameAction>() { new Animation3DGameAction(animationSlot0_2, animationBehavior0), new Animation3DGameAction(animationSlot1_2, animationBehavior1), new Animation3DGameAction(animationSlot2_2, animationBehavior2), new Animation3DGameAction(animationSlot3_2, animationBehavior3) }).WaitAll(); }
public void AddActionBefore(IGameAction action) { this.actionsBefore.Add(action); }
/// <summary> /// Initializes a new instance of the <see cref="WaitGameAction" /> class. /// </summary> /// <param name="parent">The parent action</param> /// <param name="duration">The duration of the action</param> public WaitGameAction(IGameAction parent, TimeSpan duration) : base(parent, "WaitGameAction" + instances++) { this.Duration = duration; }