예제 #1
0
        public static ReplayController Create(string name)
        {
            FileInfo fileLocation = new FileInfo($"UserData/Replays/{name}.replay");

            if (!fileLocation.Exists)
            {
                return(null);
            }
            GameObject       go          = new GameObject("ReplayController");
            ReplayController _controller = go.AddComponent <ReplayController>();

            Logger.Info($"Loading Replay for {name}");
            string[] replay = File.ReadAllText(fileLocation.FullName).Split('|');
            foreach (string position in replay)
            {
                _controller._replay.Add(new ReplayPacket(position));
            }
            if (_controller._replay.Count == replay.Length)
            {
                Logger.Info($"Loaded Replay for {name}");
            }
            else
            {
                Logger.Info($"Failed to load replay for {name}");
            }
            _controller.Replay = true;
            return(_controller);
        }
예제 #2
0
 void MovementPlay()
 {
     if (_replay.Count == 0)
     {
         Logger.Info($"Movement is 0"); Replay = false; return;
     }
     position = _replay[0].CharacterPosition;
     if (_replay.Count >= 2)
     {
         targetPosition = _replay[1].CharacterPosition;
     }
     update             = 0f;
     transform.position = new Vector3(2f, 0f, 2.5f);
     _replay.RemoveAt(0);
 }