예제 #1
0
        public void Init(MultiPlayerId id = default)
        {
            Authoritative = !id;
            Id            = id ? id : MultiPlayerManager.Instance.NewId();

            Init();
        }
예제 #2
0
        public void Init(Trainset set, MultiPlayerId id, List <TrainCar>?carOrder)
        {
            _syncs.Add(set, this);

            _trainset = set;

            if (Authoritative)
            {
                _bogiePosition = new BogiePosition[set.cars.Sum(c => c.Bogies.Length)];
            }
            else
            {
                _offsets       = new double[set.cars.Sum(c => c.Bogies.Length)];
                _trackPosition = new double[_offsets.Length];
                _dampVel       = new double[_offsets.Length];
                _vels          = new float[_offsets.Length];
                _tracks        = new RailTrack[_offsets.Length];
                _bogiePos      = new Vector3[set.cars.Max(c => c.Bogies.Length)];
            }

            if (carOrder is {})