예제 #1
0
        protected override void Awake()
        {
            base.Awake();

            sync_         = GetComponent <VRC_ObjectSync>();
            pickupHelper_ = GetComponent <CyanEmuPickupHelper>();

            if ((GetComponent <Animator>() != null || GetComponent <Animation>() != null) && GetComponent <VRC_SyncAnimation>() == null)
            {
                gameObject.AddComponent <VRC_SyncAnimation>();
                this.LogWarning("Object sync has animtor or animation component but no Sync Animation component. This will be forced synced!");
            }
        }
예제 #2
0
        /// <summary>
        /// Generate Parent
        /// </summary>
        public void GenerateParent()
        {
            this.transform.gameObject.name = "BattlePhaze Video Player";
            VideoPlayer = this.gameObject.GetOrAddComponent <VRC_SyncVideoStream>();
            VRC_ObjectSync VideoSync = this.gameObject.GetOrAddComponent <VRC_ObjectSync>();

            VideoPlayer.AutoStart            = AutoStart;
            VideoPlayer.AllowNonOwnerControl = AllowNonOwnerControl;
            VideoPlayer.videoTextureFormat   = VideoTextureFormat;
            VideoPlayer.Videos           = null;
            VideoPlayer.Videos           = BattlePhazeVideoEntry.ToArray();
            VideoPlayer.MaxStreamQuality = MaxStreamQuality;
        }
예제 #3
0
 public static void RespawnObject(VRC_ObjectSync sync)
 {
     sync.GetComponent <CyanEmuObjectSyncHelper>().Respawn();
 }
예제 #4
0
 public static void TeleportTo(VRC_ObjectSync obj, Vector3 position, Quaternion rotation)
 {
     obj.GetComponent <CyanEmuObjectSyncHelper>().TeleportTo(position, rotation);
 }
예제 #5
0
 public static void InitializeObjectSync(VRC_ObjectSync sync)
 {
     sync.gameObject.AddComponent <CyanEmuObjectSyncHelper>();
 }
예제 #6
0
    // Token: 0x06005981 RID: 22913 RVA: 0x001F15A0 File Offset: 0x001EF9A0
    public override void Awake()
    {
        base.Awake();
        this.ReplicatePosition = true;
        this.ReplicateVelocity = true;
        VRC_ObjectSync componentInSelfOrParent = base.gameObject.GetComponentInSelfOrParent <VRC_ObjectSync>();

        if (componentInSelfOrParent != null)
        {
            bool synchronizePhysics = componentInSelfOrParent.SynchronizePhysics;
            this.ReplicateVelocity = synchronizePhysics;
            this.ReplicatePosition = synchronizePhysics;
        }
        this.rigidbody = base.gameObject.GetComponent <Rigidbody>();
        if (this.rigidbody != null)
        {
            this.rigidbody.collisionDetectionMode = CollisionDetectionMode.ContinuousDynamic;
        }
        if (this.GetRotation == null)
        {
            this.GetRotation = (() => (!this.hasRigidbody) ? base.transform.rotation : this.rigidbody.rotation);
        }
        if (this.SetRotation == null)
        {
            this.SetRotation = delegate(Quaternion rotation)
            {
                if (this.hasRigidbody && !this.isHeld)
                {
                    this.rigidbody.MoveRotation(rotation);
                }
                else
                {
                    base.transform.rotation = rotation;
                }
            };
        }
        if (this.GetPosition == null)
        {
            this.GetPosition = (() => (!this.hasRigidbody) ? base.transform.position : this.rigidbody.position);
        }
        if (this.SetPosition == null)
        {
            this.SetPosition = delegate(Vector3 position)
            {
                if (this.hasRigidbody && !this.isHeld)
                {
                    this.rigidbody.MovePosition(position);
                }
                else
                {
                    base.transform.position = position;
                }
            };
        }
        if (this.GetVelocity == null)
        {
            this.GetVelocity = (() => (this.hasRigidbody && !this.isHeld) ? this.rigidbody.velocity : this.ObservedVelocity);
        }
        if (this.SetVelocity == null)
        {
            this.SetVelocity = delegate(Vector3 velocity)
            {
                if (this.hasRigidbody)
                {
                    this.rigidbody.velocity = velocity;
                }
            };
        }
        if (this.hasRigidbody)
        {
            this.rigidbody.sleepThreshold = Mathf.Max(0.05f, this.rigidbody.sleepThreshold);
        }
        if (this.InterpolateFunction == null)
        {
            if (SyncPhysics.f__mg0 == null)
            {
                SyncPhysics.f__mg0 = new TweenFunctions.TweenFunction <SyncPhysics.PositionEvent>(TweenFunctions.CatMullRomTween <SyncPhysics.PositionEvent>);
            }
            this.InterpolateFunction = SyncPhysics.f__mg0;
        }
        this.StorePhysicsState();
    }