コード例 #1
0
 protected virtual void Awake()
 {
     activePlayer    = null;
     smoothYaw       = new SmoothFloat();
     smoothPitch     = new SmoothFloat();
     smoothTransform = gameObject.EnsureComponent <SmoothTransform>();
     syncedObject    = gameObject.EnsureComponent <SyncedObject>();
 }
コード例 #2
0
ファイル: Multiplayer.cs プロジェクト: senlace/shinkai
        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);
            }
        }