コード例 #1
0
 public JsonSequenceAtom(string sequenceName, AreaFlag where, float str, float offset)
 {
     sequence = sequenceName;
     area     = where.ToString();
     strength = str;
     time     = offset;
 }
コード例 #2
0
            void DisplayAreaFlag(int index, GUILayoutOption[] options)
            {
                //GUILayout.Label("Area Flag Display");
                if (DefaultOptions != null && DefaultOptions.Count > index)
                {
                    AreaFlag o     = DefaultOptions[index];
                    string   label = o.ToString();

                    //Remove the underscores?

                    GUILayout.Label(label, options);
                }
            }
コード例 #3
0
 public override string ToString()
 {
     return(_name.ToString());
 }
コード例 #4
0
        /// <summary>
        /// This function is for
        /// This function has unintended consequences if you use multiple areaflags on the same area (such as Chest_Both)
        ///
        /// </summary>
        /// <param name="enabled"></param>
        /// <param name="flag"></param>
        public void SetHapticLocationActivity(bool enabled, AreaFlag flag)
        {
            throw new System.Exception("Incomplete\n");

            if (DefinedAreas.Contains(flag))
            {
                var indexOfArea = DefinedAreas.IndexOf(flag);
                if (indexOfArea < 0)
                {
                    Debug.LogError("Deactivate Haptic Location failed. It did not contain the requested flag " + flag.ToString() + "\n");
                    return;
                }
                SceneReferences[indexOfArea].LocationActive = enabled;
                AreaFlag locationsArea = SceneReferences[indexOfArea].MyLocation.Where;
                if (enabled)
                {
                    DisabledRegions.DisableArea(locationsArea);
                }
                else
                {
                    DisabledRegions.DisableArea(locationsArea);
                }
            }
        }
コード例 #5
0
        /// <summary>
        /// This function replaces existing elements so we can change the suit definition more easily at runtime (say the player's arm is added or destroyed)
        /// </summary>
        /// <param name="SingleFlagToModify"></param>
        /// <param name="SingleHolder"></param>
        /// <param name="newCollider"></param>
        /// <returns></returns>
        public bool ModifyValidRegions(AreaFlag SingleFlagToModify, GameObject SingleHolder, HardlightCollider newCollider)
        {
            bool Succeeded = false;

            if (!SingleFlagToModify.IsSingleArea())
            {
                Debug.LogError("Attempted to modify the valid regions of the Hardlight Suit by providing a complex AreaFlag.\n\tThis function does not yet support complex area flags. Call it individually for each flag if you need to do this.");

                return(false);
            }

            if (SingleHolder == null || newCollider == null || SingleFlagToModify == AreaFlag.None)
            {
                Debug.LogError("Attempted to modify the valid regions of the Hardlight Suit to provide invalid elements (either the collider or the holder) or to provide an AreaFlag of None (" + SingleFlagToModify.ToString() + ")");
                return(false);
            }

            bool ReplacedExistingElement = false;

            var               indexOfFlag = -1;
            GameObject        oldHolder   = null;
            HardlightCollider oldCollider = null;

            //If we have the area flag already
            if (Definition.DefinedAreas.Contains(SingleFlagToModify))
            {
                ReplacedExistingElement = true;

                //Find which index it is (index is the access key to all three lists)
                indexOfFlag = Definition.DefinedAreas.IndexOf(SingleFlagToModify);

                //Store the old holder and old collider
                oldHolder   = Definition.ZoneHolders[indexOfFlag];
                oldCollider = Definition.SceneReferences[indexOfFlag];

                oldHolder.SetActive(false);

                //No longer have this location as disabled
                DisabledRegions.EnableArea(SingleFlagToModify);

                //Replace the old elements
                Definition.ZoneHolders[indexOfFlag]     = SingleHolder;
                Definition.SceneReferences[indexOfFlag] = newCollider;
                Succeeded = true;
            }
            //Flag does not yet exist in the dictionary (it was empty so it was deleted)
            else
            {
                //Store the index of the new element we're adding.
                indexOfFlag = DefinedAreas.Count;
                Definition.DefinedAreas.Add(SingleFlagToModify);

                //Add the new elements
                Definition.ZoneHolders.Add(SingleHolder);
                Definition.SceneReferences.Add(newCollider);

                //This location is now enabled.
                DisabledRegions.EnableArea(SingleFlagToModify);

                Succeeded = true;
            }

            if (ReplacedExistingElement)
            {
                //Do something about the old elements?
                //What if we want to revert?
            }

            return(Succeeded);
        }