Beispiel #1
0
            private void OnDestroy()
            {
                Destroy(boxCollider);

                if (secondary != null && !secondary.IsDestroyed)
                {
                    secondary.SetParent(null);
                    secondary.Kill(BaseNetworkable.DestroyMode.None);
                }

                if (primary != null && !primary.IsDestroyed)
                {
                    primary.SetParent(null);
                    primary.Kill();
                }
            }
Beispiel #2
0
            private void Start()
            {
                secondary = Spawn(tr.position);

                secondary.SetParent(primary);
                secondary.transform.localPosition = Vector3.zero;
                secondary.transform.localRotation = Quaternion.Euler(0f, 180f, 0f);

                SetSignImages(primary);
                SetSignImages(secondary);

                primary.SendNetworkUpdate(BasePlayer.NetworkQueue.Update);
                secondary.SendNetworkUpdate(BasePlayer.NetworkQueue.Update);

                primary.gameObject.layer = (int)Rust.Layer.Reserved1;

                boxCollider           = primary.gameObject.AddComponent <BoxCollider>();
                boxCollider.size      = new Vector3(1.2f, 2f, 1f);
                boxCollider.center    = new Vector3(0f, 1.1f, 0f);
                boxCollider.isTrigger = true;
            }