Пример #1
0
        /// <summary>
        /// Add the core components needed for all Pickup types, and add toggles to existing children.
        /// </summary>
        public static GameObject ConvertToPickup(GameObject selection, Space_XD space, Dynamics dynamics)
        {
            selection = NetObjectAssists.ConvertToBasicNetObject(selection);

            if (dynamics != Dynamics.Static)
            {
                selection.AddRigidbody(space);
                var st = selection.EnsureComponentExists <SyncTransform>();
                st.transformCrusher.SclCrusher.Enabled = false;
            }

            selection.EnsureComponentExists <ContactTrigger>();
            selection.EnsureComponentExists <SyncPickup>();
            var ss = selection.EnsureComponentExists <SyncState>();

            ss.mountableTo.mask = (1 << MountSettings.single.mountNames.Count) - 1;

            if (dynamics != Dynamics.Static)
            {
                selection.EnsureComponentExists <OnStateChangeKinematic>();
            }

            /// Add OnStateChangeToggle to existing children before creating placeholder children
            selection.EnsureComponentOnNestedChildren <OnStateChangeToggle>(false);

            /// Add HitGroups, and set to default
            var hga = selection.EnsureComponentExists <HitGroupAssign>();

            hga.hitGroupMask.Mask = 0;

            selection.CreateChildStatePlaceholders(space, dynamics);

            return(selection);
        }
Пример #2
0
        public static void AddVitalsSystem()
        {
            var go = NetObjectAssists.GetSelectedGameObject();

            if (!go)
            {
                return;
            }

            AddSystem(go, true);
        }
Пример #3
0
        public static void AddInventorySystem()
        {
            var go = NetObjectAssists.GetSelectedGameObject();

            if (!go)
            {
                return;
            }

            AddSystem(go, true);

            ///// Add AutoMountHitscan if has rb and doesn't exist yet
            //if (go.transform.GetNestedComponentInParents<Rigidbody>() || go.transform.GetNestedComponentInParents<Rigidbody2D>())
            //	if (!go.transform.GetNestedComponentInChildren<AutoMountHitscan>())
            //		AddAutoMountHitscan();
        }
Пример #4
0
        public static void ConvertToDamageZone()
        {
            var selection = NetObjectAssists.GetSelectedGameObject();

            if (selection != null)
            {
                if (!selection.CheckReparentable())
                {
                    return;
                }
            }

            selection.EnsureComponentExists <ContactTrigger>();
            selection.EnsureComponentExists <OnTriggerApplyDamage>();

            selection.SetAllCollidersAsTriggger(true);
        }