Esempio n. 1
0
    public ReplayInputs GetReplayInputs()
    {
        var replayInputs = new ReplayInputs();

        replayInputs.startX    = replay.startX;
        replayInputs.startY    = replay.startY;
        replayInputs.clearTime = frameID;
        replayInputs.frames    = frames.ToArray();
        return(replayInputs);
    }
Esempio n. 2
0
    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;
    }
Esempio n. 3
0
 // 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");
     //}
 }
Esempio n. 4
0
    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;
    }
Esempio n. 5
0
    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;
    }
Esempio n. 6
0
    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>();
    }