Ejemplo n.º 1
0
        private void Process(Client client, ClientItemDropped msg)
        {
            var item = state.history.items.GetOrAddNew(msg.itemGuid);

            item.drop = msg;

            SendToAll(client.peer, msg);
        }
Ejemplo n.º 2
0
        public static void Dropped(GameObject gameObject, TechType tech, Vector3 position)
        {
            var res = new ClientItemDropped();

            res.itemGuid      = GuidHelper.Get(gameObject);
            res.waterParkGuid = GuidHelper.Get(Player.main?.currentWaterPark?.gameObject);
            res.tech          = tech;
            res.position      = position;
            res.data          = ObjectSerializer.GetBytes(gameObject);
            if (res.data == null)
            {
                return;
            }

            Multiplayer.main.Send(res);
            SyncedObject.ApplyTo(gameObject);
        }
Ejemplo n.º 3
0
        private void Process(ClientItemDropped msg)
        {
            var gameObject = ObjectSerializer.GetGameObject(msg.data);

            gameObject.transform.position = msg.position;

            GuidHelper.Set(gameObject, msg.itemGuid);

            var waterParkObject = GuidHelper.Find(msg.waterParkGuid);

            if (waterParkObject != null)
            {
                var waterPark = waterParkObject.GetComponent <WaterPark>();
                if (waterPark != null)
                {
                    var pickupable = gameObject.GetComponent <Pickupable>();
                    if (pickupable != null)
                    {
                        waterPark.AddItem(pickupable);
                    }
                }
            }

            var rigidbody = gameObject.GetComponent <Rigidbody>();

            if (rigidbody != null)
            {
                rigidbody.isKinematic = false;
            }

            SyncedObject.ApplyTo(gameObject);

            var constructor = gameObject.GetComponent <Constructor>();

            if (constructor != null)
            {
                var method = typeof(Constructor).GetMethod("Deploy", BindingFlags.NonPublic | BindingFlags.Instance);
                method.Invoke(constructor, new object[] { true });
                constructor.OnDeployAnimationStart();
                LargeWorldEntity.Register(constructor.gameObject);

                Utils.PlayEnvSound(constructor.releaseSound, constructor.transform.position, 20f);
            }
        }