public void DrawCard() { CardType newCard = Deck.instance.DrawCard(); this.cardTypes.Add(newCard); AnimationQueue.Add(() => this.RenderHand(), 0); }
public void CardSelection(int amount) { this.selectionMode = true; this.forceReset = true; this.selectionAmount = amount; AnimationQueue.Add(this.CreateCardSelection, 0f); }
public override void Update(DwarfTime gameTime, ChunkManager chunks, Camera camera) { IsAboveCullPlane = GlobalTransform.Translation.Y - GetBoundingBox().Extents().Y > (chunks.ChunkData.MaxViewingLevel + 5); if (DrawScreenRect) { Drawer2D.DrawRect(GetScreenRect(camera), Color.Transparent, Color.White, 1); } if (DrawBoundingBox) { Drawer3D.DrawBox(BoundingBox, Color.White, 0.02f); Drawer3D.DrawBox(GetRotatedBoundingBox(), Color.Red, 0.02f); } if (DrawReservation && IsReserved) { Drawer3D.DrawBox(BoundingBox, Color.White, 0.02f); } if (AnimationQueue.Count > 0) { MotionAnimation anim = AnimationQueue[0]; anim.Update(gameTime); LocalTransform = anim.GetTransform(); if (anim.IsDone()) { AnimationQueue.RemoveAt(0); } } base.Update(gameTime, chunks, camera); }
public static void CrossFadeQueued(AnimancerState state) { CleanUp(); var layer = state.Layer; // If the layer has no current state, just play the animation immediately. if (!layer.CurrentState.IsValid() || layer.CurrentState.Weight == 0) { var fadeDuration = state.CalculateEditorFadeDuration(AnimancerPlayable.DefaultFadeDuration); layer.Play(state, fadeDuration); return; } if (!PlayableToQueue.TryGetValue(layer, out var queue)) { queue = new AnimationQueue(); PlayableToQueue.Add(layer, queue); } queue.Queue.Add(state); layer.CurrentState.Events.OnEnd -= queue.PlayNext; layer.CurrentState.Events.OnEnd += queue.PlayNext; }
private static void OnComplete(AnimationItem completedItem) { if (queue.Count == 0) { return; } AnimationItem item = queue[0]; if (item.id != completedItem.id) { completedItem.complete = true; } else { queue.RemoveAt(0); if (queue.Count > 0 && !queue[0].isRunning) { AnimationItem nextItem = queue[0]; nextItem.StartAnimation(); if (nextItem.complete) { AnimationQueue.OnComplete(nextItem); } } } }
public List <Enemy> RemoveDefeated() { List <Enemy> enemiesToRemove = new List <Enemy>(); foreach (Enemy enemy in this.enemies) { if (enemy.GetHP() == 0) { enemiesToRemove.Add(enemy); } } ; foreach (Enemy enemy in enemiesToRemove) { this.RemoveEnemy(enemy); } float deathTimeout = 0.8f; List <Enemy> enemiesCopy = new List <Enemy>(this.enemies); AnimationQueue.Add(() => {}, deathTimeout); AnimationQueue.Add(() => { foreach (Enemy enemy in enemiesToRemove) { unity.Destroy(enemy.gameObject); } this.Reposition(enemiesCopy); }, 0); return(enemiesToRemove); }
public void AoEAttack() { Hero.instance.Attack(); Hand.instance.FinishPlayCard(playedCard); this.nextDamage = this.playedCard.damage; foreach (Enemy target in this.enemyGroup.Iterate()) { this.nextTarget = target; this.ExecuteEffects(Phases.PRE_ATTACK); } foreach (Enemy target in this.enemyGroup.Iterate()) { this.nextTarget = target; this.AttackTarget(target, this.nextDamage, true, true); } // Buffer between all attack animations and card effects // Since attacks are all animated instantly in queue for AoE AnimationQueue.Add(() => {}, 1f); foreach (Enemy target in this.enemyGroup.Iterate()) { this.nextTarget = target; this.ApplyCardEffects(target); this.ExecuteEffects(Phases.POST_ATTACK); } this.RemoveDefeated(); }
public MovementWindow(MainWindow mainWindow, System.Windows.Media.Color color1, System.Windows.Media.Color color2, System.Windows.Media.Color color3, int StrokeThickness) { InitializeComponent(); Pointer1.Stroke = new SolidColorBrush(color1); Pointer1.DataContext = model; Pointer2.Stroke = new SolidColorBrush(color2); Pointer2.DataContext = model; lineBrush = new SolidColorBrush(color3); this.StrokeThickness = StrokeThickness; this.mainWindow = mainWindow; recorder = coordinateRecorder.getInstance(this); holder = CoordinateDataBuffer.GetInstance(); this.queue1 = new AnimationQueue(StimulyEllipse1, Canvas.LeftProperty, Canvas.TopProperty); t = new System.Timers.Timer(); t.Elapsed += new ElapsedEventHandler(SendInfo); t.Interval += 100; this.SetBinding(Window.WidthProperty, new Binding("RezolutionX") { Source = model, Mode = BindingMode.OneWayToSource }); this.SetBinding(Window.HeightProperty, new Binding("RezolutionY") { Source = model, Mode = BindingMode.OneWayToSource }); generate = Self_Paced; CourseComplexity = 0; StimulyEllipse1.Visibility = Visibility.Visible; }
public void SetShield(float shield) { this.shield = shield; float newHp = this.hp; AnimationQueue.Add(() => this.UpdateShieldBar(shield), 0f); }
public void SetHP(float hp) { this.hp = hp; float newShield = this.shield; AnimationQueue.Add(() => this.UpdateHealthBar(hp), 0f); }
public Level(XDocument levelData, MizJam1Game game) { this.game = game; this.levelData = levelData; animationQueue = new AnimationQueue(); }
public void Update(DwarfTime gameTime, ChunkManager chunks, Camera camera) { if (ParentMoved) { HasMoved = true; } ParentMoved = false; if (AnimationQueue.Count > 0) { HasMoved = true; MotionAnimation anim = AnimationQueue[0]; anim.Update(gameTime); LocalTransform = anim.GetTransform(); if (anim.IsDone()) { AnimationQueue.RemoveAt(0); } } if (firstIter || propogateTransforms || HasMoved) { PropogateTransforms(); firstIter = false; propogateTransforms = false; } }
public static void ResetGame() { AnimationQueue.Clear(); SceneHelper.CloseAll(); Deck.instance.NewDeck(); WindowManager.ClearOverlays(); WindowManager.ShowScreen(WindowManager.startPanel); }
// PLAYER_START phase public void StartPlayerTurn() { this.turn++; this.ExecuteEffects(Phases.PLAYER_START); Crystals.instance.Refresh(); Hand.instance.DrawHand(); AnimationQueue.Add(() => this.playerTurn = true, 0); }
void Start() { WindowManager.ShowScreen(WindowManager.startPanel); AnimationQueue.Clear(); SceneHelper.CloseAll(); canvasObject.GetComponent <Canvas>().sortingLayerName = "UI"; canvasObject.GetComponent <Canvas>().sortingOrder = WindowManager.UILayer; }
public virtual void Heal(float amount) { float newHp = Mathf.Min(this.health.hp + amount, this.health.maxHealth); this.SetHP(newHp); AnimationQueue.Add(() => Creator.CreateHealAnimation(new Vector3(0.63f, -0.11f, -2), this.transform), 0); AnimationQueue.Add(() => this.CreateHealText(amount), 0f); }
public MovementWindow(MainWindow mainWindow, string mode, int complexity, int Speed, System.Windows.Media.Color color1, System.Windows.Media.Color color2, System.Windows.Media.Color color3) { InitializeComponent(); Pointer1.Stroke = new SolidColorBrush(color1); this.color1 = new SolidColorBrush(color1); Pointer1.DataContext = model; Pointer2.Stroke = new SolidColorBrush(color2); this.color2 = new SolidColorBrush(color2); StimulyEllipse1.Stroke = this.color1; CheckPointEllipse.Stroke = this.color2; Pointer2.DataContext = model; lineBrush = new SolidColorBrush(color3); CourseSpeed = Speed; this.queue1 = new AnimationQueue(StimulyEllipse1, Canvas.LeftProperty, Canvas.TopProperty); this.mainWindow = mainWindow; recorder = coordinateRecorder.getInstance(this); holder = CoordinateDataBuffer.GetInstance(); t = new System.Timers.Timer(); t.Elapsed += new ElapsedEventHandler(SendInfo); t.Interval += 100; this.SetBinding(Window.WidthProperty, new Binding("RezolutionX") { Source = model, Mode = BindingMode.OneWayToSource }); this.SetBinding(Window.HeightProperty, new Binding("RezolutionY") { Source = model, Mode = BindingMode.OneWayToSource }); if (complexity == 0) { CourseSpeed += 4; // Lowest complexity trajectory has too many coordinates and the animation moves to slow. For this increment the course speed more . } if (mode == "Asynchronous") { generate = Asynchronous; checkPointTimer = new System.Timers.Timer(); checkPointTimer.Interval = 1000.0 / CourseSpeed * 50; checkPointTimer.Elapsed += new ElapsedEventHandler(ShowNextCheckPoint); queue1.checkPointHandler += new EventHandler(ShowNextCheckPoint); StimulyEllipse1.Visibility = Visibility.Visible; CheckPointEllipse.Visibility = Visibility.Visible; } if (mode == "Synchronous") { generate = Synchronous; StimulyEllipse1.Visibility = Visibility.Visible; } CourseComplexity = complexity; }
public void RemoveBuff(int id) { this.buffs.RemoveAll(effect => effect.id == id); List <Effect> buffsCopy = new List <Effect>(this.buffs); float newHP = this.hp; float newShield = this.shield; AnimationQueue.Add(() => this.RenderBuffs(buffsCopy, newShield), 0f); }
public Initiative(bool isAIControlledi, LocalObject o) : base(o) { value = 0; r = new RPoint(); animations = new AnimationQueue(); isAIControlled = isAIControlledi; movementCounter = 3; }
public void FillStarByAnimation(float waitTime) { if (!_filled) { _filled = true; AnimationQueue.Enqueue(Animation.Delay(waitTime)); AnimationQueue.Enqueue(Animation.Create(SetAnimation, Easings.Functions.Linear, 0.75f)); } }
public void AddBuff(Effect effect) { this.buffs.Add(effect); List <Effect> buffsCopy = new List <Effect>(this.buffs); float newHP = this.hp; float newShield = this.shield; AnimationQueue.Add(() => this.RenderBuffs(buffsCopy, newShield), 0f); }
// Use this for initialization void Start() { animationQueue = GetComponent <AnimationQueue>(); score = GameObject.Find("ScoreManager"); m_allTiles = new Tile[width, height]; m_allGamePieces = new GamePiece[width, height]; m_levelBuilder = new int[width, height]; SetupTiles(); SetupCamera(); }
private void QueueHandRender() { List <CardType> cardsCopy = new List <CardType>(this.cardTypes); AnimationQueue.Add(() => { this.isRendering = true; this.RenderHand(cardsCopy); }, 0f); AnimationQueue.Add(() => { this.isRendering = false; }, 0f); }
public static void Tick() { DI = Mathf.Min(DI + tick, maxDI); UpdateTickValue(); AnimationQueue.Add(() => { UpdateBar(); ApplyDebuffs(); }, 0f); time = Mathf.Min(time + 1, 14); }
public void ChangeWorld(SOverviewWorld world) { var newWorld = world.Number; var oldWorld = SelectedWorld.Number; FindObjectOfType <Background>().FadeToLevel(newWorld, oldWorld); AnimationQueue.Enqueue(AnimationWithCallback.Create(Animation.Create(SetRelativeYPosition, Easings.Functions.ExponentialEaseIn, 0.5f, 0, -1000), null, () => SetLevelNumbers(world))); AnimationQueue.Enqueue(Animation.Create(SetRelativeXPosition, Easings.Functions.ExponentialEaseOut, 0.5f, 1000, 0)); }
private void LoseBattle() { if (this.gameOver) { return; } this.gameOver = true; AnimationQueue.Add(() => GameEndText.CreateText(this.gameEndAnimation, false, this.transform), 4f); AnimationQueue.Add(App.ResetGame, 0); }
public static void AddExp(int exp) { XP += exp; if (XP >= maxXP) { XP -= maxXP; LevelUp(); } UpdateTickValue(); AnimationQueue.Add(() => { UpdateBar(); }, 0f); }
internal void OpenWorld() { World.IsOpen = true; var materialAnimation = Animation.Create(UpdateMaterialAnimation, Easings.Functions.Linear, 0.6f); var callBack = AnimationWithCallback.Create(materialAnimation, () => { DisableChildren(); }); var fullAnimation = new CompositeAnimation(callBack); AnimationQueue.Enqueue(fullAnimation); }
private void WinBattle() { if (this.gameOver) { return; } this.gameOver = true; AnimationQueue.Add(() => GameEndText.CreateText(this.gameEndAnimation, true, this.transform), 4f); AnimationQueue.Add(() => { Hand.instance.DiscardHand(); WindowManager.ShowScreen(WindowManager.lootUI); }, 0); }
public MovementWindow(MainWindow mainWindow , string mode , int complexity , int Speed, System.Windows.Media.Color color1 , System.Windows.Media.Color color2 , System.Windows.Media.Color color3 ) { InitializeComponent(); Pointer1.Stroke = new SolidColorBrush(color1); this.color1 = new SolidColorBrush(color1); Pointer1.DataContext = model; Pointer2.Stroke = new SolidColorBrush(color2); this.color2 = new SolidColorBrush(color2); StimulyEllipse1.Stroke = this.color1; CheckPointEllipse.Stroke = this.color2; Pointer2.DataContext = model; lineBrush = new SolidColorBrush(color3); CourseSpeed = Speed; this.queue1 = new AnimationQueue(StimulyEllipse1, Canvas.LeftProperty, Canvas.TopProperty); this.mainWindow = mainWindow; recorder = coordinateRecorder.getInstance(this); holder = CoordinateDataBuffer.GetInstance(); t = new System.Timers.Timer(); t.Elapsed += new ElapsedEventHandler(SendInfo); t.Interval += 100; this.SetBinding(Window.WidthProperty, new Binding("RezolutionX") { Source = model, Mode = BindingMode.OneWayToSource }); this.SetBinding(Window.HeightProperty, new Binding("RezolutionY") { Source = model, Mode = BindingMode.OneWayToSource }); if (complexity == 0) { CourseSpeed += 4; // Lowest complexity trajectory has too many coordinates and the animation moves to slow. For this increment the course speed more . } if (mode == "Asynchronous") { generate = Asynchronous; checkPointTimer = new System.Timers.Timer(); checkPointTimer.Interval = 1000.0 / CourseSpeed * 50; checkPointTimer.Elapsed += new ElapsedEventHandler(ShowNextCheckPoint); queue1.checkPointHandler += new EventHandler(ShowNextCheckPoint); StimulyEllipse1.Visibility = Visibility.Visible; CheckPointEllipse.Visibility = Visibility.Visible; } if (mode == "Synchronous") { generate = Synchronous; StimulyEllipse1.Visibility = Visibility.Visible; } CourseComplexity = complexity; }
public MainWindow() { InitializeComponent(); wc = new WebClient(); wc.DownloadStringCompleted += wc_DownloadStringCompleted; wd = new WeatherData(); aq = new AnimationQueue(new List <Storyboard>() { (Storyboard)this.Resources["In"], (Storyboard)this.Resources["Out"] }); UpdateUI(); }
public void Awake() { random = new System.Random(name.GetHashCode()); animationQueue = new AnimationQueue(animation, (animationName, length) => { if (animationName == "SittingIdle") { var delay = MinDelayBetweenAnimations + (float)random.NextDouble() * (MaxDelayBetweenAnimations - MinDelayBetweenAnimations); Debug.Log(string.Format("Play idle for {0} in {1}", name, delay + length)); animationQueue.Enqueue("SittingIdle", delay + length, AnimationPlayMode.Mix, 0.5f, false); } }); animationQueue.Enqueue("SittingIdle", 0.0f, AnimationPlayMode.Mix, 0.5f); }
public LocalPosition(LocalObject o) : base(o) { r = new RPoint(); animations = new AnimationQueue(); }
public MovementWindow(MainWindow mainWindow , System.Windows.Media.Color color1, System.Windows.Media.Color color2, System.Windows.Media.Color color3 , int StrokeThickness) { InitializeComponent(); Pointer1.Stroke = new SolidColorBrush(color1); Pointer1.DataContext = model; Pointer2.Stroke = new SolidColorBrush(color2); Pointer2.DataContext = model; lineBrush = new SolidColorBrush(color3); this.StrokeThickness = StrokeThickness; this.mainWindow = mainWindow; recorder = coordinateRecorder.getInstance(this); holder = CoordinateDataBuffer.GetInstance(); this.queue1 = new AnimationQueue(StimulyEllipse1, Canvas.LeftProperty, Canvas.TopProperty); t = new System.Timers.Timer(); t.Elapsed += new ElapsedEventHandler(SendInfo); t.Interval += 100; this.SetBinding(Window.WidthProperty, new Binding("RezolutionX") { Source = model, Mode = BindingMode.OneWayToSource }); this.SetBinding(Window.HeightProperty, new Binding("RezolutionY") { Source = model, Mode = BindingMode.OneWayToSource }); generate = Self_Paced; CourseComplexity = 0; StimulyEllipse1.Visibility = Visibility.Visible; }