public ReplayInputs GetReplayInputs() { var replayInputs = new ReplayInputs(); replayInputs.startX = replay.startX; replayInputs.startY = replay.startY; replayInputs.clearTime = frameID; replayInputs.frames = frames.ToArray(); return(replayInputs); }
public void StartPlaying(string save, Player player) { replay = FromJson(save); frames = replay.frames.ToList(); //positions = replay.positions.ToList(); Debug.Log("StartPlaying(" + frames.Count + ")"); frameID = 0; player.transform.position = new Vector3(0.001f * replay.startX, 0.001f * replay.startY, 0); playMode = PlayMode.REPLAY; }
// Start is called before the first frame update void Start() { frames = new List <Frame>(); positions = new List <Position>(); replay = new ReplayInputs(); //if (PlayerPrefs.HasKey("save_replay")) //{ // StartPlaying(PlayerPrefs.GetString("save_replay"), GetComponent<Player>()); // PlayerPrefs.DeleteKey("save_replay"); //} }
public void StartPlaying(BContentful.ScoreData save, Player player) { replay = save.replayInputs; frames = replay.frames.ToList(); //positions = replay.positions.ToList(); positions = new List <Position>(); Debug.Log("StartPlaying(" + frames.Count + ")"); frameID = 0; player.transform.position = new Vector3(0.001f * replay.startX, 0.001f * replay.startY, 0); playMode = PlayMode.REPLAY; }
public void StartRecording(Player player) { Debug.Log("StartRecording"); replay = new ReplayInputs(); replay.startX = (int)(player.transform.position.x * 1000); replay.startY = (int)(player.transform.position.y * 1000); player.transform.position = new Vector3(0.001f * replay.startX, 0.001f * replay.startY, 0); frames = new List <Frame>(); frameID = 0; playMode = PlayMode.RECORD; }
void Start() { controllerRigidbody = GetComponent <Rigidbody2D>(); controllerCollider = GetComponent <Collider2D>(); softGroundMask = LayerMask.GetMask("Ground Soft"); hardGroundMask = LayerMask.GetMask("Ground Hard"); animatorGroundedBool = Animator.StringToHash("Grounded"); animatorRunningSpeed = Animator.StringToHash("RunningSpeed"); animatorJumpTrigger = Animator.StringToHash("Jump"); CanMove = true; replayInputs = GetComponent <ReplayInputs>(); }