public Animation(Animation anim) { Frames.AddRange(anim.Frames); Duration = anim.Duration; Name = anim.Name; Paused = anim.Paused; }
public void SetFrames(IEnumerable <IFrame> frames) { Frames.Clear(); Frames.AddRange(frames .Select(x => x as Frame) .Where(x => x != null)); }
void GetCustomAnimationFrames(Transform transform, string animation, Frames frames) { const byte COLUMNS = 9; const byte OFFSET = COLUMNS * 5 + 1; const byte TOTALFRAMES = COLUMNS * 2; frames.AddRange(OFFSET, TOTALFRAMES); frames.AddDelay(3); if (ANIMATION_NAME_SNACK != animation) { frames.Clear(); } }
void GetCustomAnimationFrames(Transform transform, string animation, Frames frames) { const byte COLUMNS = 13; const byte OFFSET = COLUMNS * 4 + 1; const byte TOTALFRAMES = 7; var ShiftValue = 0; frames.AddRange(OFFSET, TOTALFRAMES); switch (transform.Direction4) { case Directions4.Down: ShiftValue = COLUMNS * 1; break; case Directions4.Right: ShiftValue = COLUMNS * 0; break; case Directions4.Up: ShiftValue = COLUMNS * 2; break; case Directions4.Left: ShiftValue = COLUMNS * 3; frames.Reverse(); break; } frames.Shift(ShiftValue).AddDelay(3); switch (animation) { case ANIMATION_NAME_STARTUSE: break; case ANIMATION_NAME_ENDUSE: frames.Reverse(); break; default: frames.Clear(); break; } }
/// <summary> /// Handles messages that have been sent to the GameController /// </summary> public void SendMessage(GameMessage message) { switch (message) { case GameMessage.RecordEnd: DisableRecordables(); // disable recordables now that the simulating is complete Frames.AddRange(Recorder.GetRecordedFrames()); // add the recorded frames to the frames list Recorder.gameObject.SetActive(false); // disable the Recorder gameObject for claritys sake Simulation.gameObject.SetActive(false); // disables simulation Stage = GameStage.Replay; // after recording, the stage is replay StartCoroutine(UnFreezeCam()); break; case GameMessage.ReplayEnd: Replayer.gameObject.SetActive(false); if (Winner == null) { Stage = GameStage.Planning; // after replay the stage is planning } else { Stage = GameStage.End; } Replays++; break; case GameMessage.PlanningEnd: Planning.gameObject.SetActive(false); // stops the update loop for this script Planned++; if (Planned == 2) { Stage = GameStage.Record; // after planning the stage is record Planned = 0; } else { SwitchSide(); if (Turn == 1) { Stage = GameStage.Planning; } else { Stage = GameStage.Replay; } } break; case GameMessage.OkClicked: camera.GetComponent <CameraMovement>().CenterCamera(); IsPaused = false; break; case GameMessage.EndScreenClicked: if (End) { SceneManager.LoadScene("MainMenu"); } else { SwitchSide(); Stage = GameStage.Replay; End = true; } break; } }
public void AddFrames(params Frame[] frames) => Frames.AddRange(frames);
public void AddFrames(IEnumerable <Frame> frames) => Frames.AddRange(frames);