public NavGrid(string id, Transition[] transitions, NavTypeData[] nav_type_data, CellOffset[] bounding_offsets, NavTableValidator[] validators, int update_range_x, int update_range_y, int max_links_per_cell)
    {
        this.id          = id;
        Validators       = validators;
        navTypeData      = nav_type_data;
        this.transitions = transitions;
        boundingOffsets  = bounding_offsets;
        List <NavType> list = new List <NavType>();

        updateRangeX    = update_range_x;
        updateRangeY    = update_range_y;
        maxLinksPerCell = max_links_per_cell + 1;
        for (int i = 0; i < transitions.Length; i++)
        {
            DebugUtil.Assert(i >= 0 && i <= 255);
            transitions[i].id = (byte)i;
            if (!list.Contains(transitions[i].start))
            {
                list.Add(transitions[i].start);
            }
            if (!list.Contains(transitions[i].end))
            {
                list.Add(transitions[i].end);
            }
        }
        ValidNavTypes           = list.ToArray();
        DebugViewLinkType       = new bool[ValidNavTypes.Length];
        DebugViewValidCellsType = new bool[ValidNavTypes.Length];
        NavType[] validNavTypes = ValidNavTypes;
        foreach (NavType nav_type in validNavTypes)
        {
            GetNavTypeData(nav_type);
        }
        Links                = new Link[maxLinksPerCell * Grid.CellCount];
        NavTable             = new NavTable(Grid.CellCount);
        this.transitions     = transitions;
        transitionsByNavType = new Transition[10][];
        for (int k = 0; k < 10; k++)
        {
            List <Transition> list2   = new List <Transition>();
            NavType           navType = (NavType)k;
            for (int l = 0; l < transitions.Length; l++)
            {
                Transition item = transitions[l];
                if (item.start == navType)
                {
                    list2.Add(item);
                }
            }
            transitionsByNavType[k] = list2.ToArray();
        }
        foreach (NavTableValidator navTableValidator in validators)
        {
            NavTableValidator navTableValidator2 = navTableValidator;
            navTableValidator2.onDirty = (Action <int>)Delegate.Combine(navTableValidator2.onDirty, new Action <int>(AddDirtyCell));
        }
        potentialScratchPad = new PathFinder.PotentialScratchPad(maxLinksPerCell);
        InitializeGraph();
        NavGraph = new NavGraph(Grid.CellCount, this);
    }
        private static string LoadFeature(string longName, List <YamlIO.Error> errors)
        {
            string name = string.Empty;

            if (!GetPathAndName(GetPath(), longName, out name))
            {
                Debug.LogWarning("LoadFeature GetPathAndName: Attempting to load feature: " + name + " failed");
                return(longName);
            }
            if (!featuresettings.ContainsKey(name))
            {
                FeatureSettings featureSettings = YamlIO.LoadFile <FeatureSettings>(GetPath() + name + ".yaml", null, null);
                if (featureSettings != null)
                {
                    featuresettings.Add(name, featureSettings);
                    if (featureSettings.forceBiome != null)
                    {
                        LoadBiome(featureSettings.forceBiome, errors);
                        DebugUtil.Assert(biomes.BiomeBackgroundElementBandConfigurations.ContainsKey(featureSettings.forceBiome), longName, "(feature) referenced a missing biome named", featureSettings.forceBiome);
                    }
                }
                else
                {
                    Debug.LogWarning("WorldGen: Attempting to load feature: " + name + " failed");
                }
            }
            return(name);
        }
예제 #3
0
파일: TaskManager.cs 프로젝트: nek3/NewGame
        //--------------------------------------------------------
        //	ITaskGroup 関数
        //--------------------------------------------------------
        /// <summary>
        /// タスク追加
        /// </summary>
        /// <param name="action">実行関数</param>
        public void AddTask(Action <Action> action)
        {
            DebugUtil.Assert(mStatus == GroupStatus.Initialized);
            DebugUtil.NullAssert(action);

            mTaskList.Add(new Task(action));
        }
예제 #4
0
        /// <remarks>
        /// Iterating would scale better if filter names were:
        ///     (A) a bitfield instead of a hash set.  Or,
        ///     (B) an array instead of a hash set.
        /// </remarks>
        /// <returns>
        /// If receiver is empty and candidate has any of the receiver's filter components.
        /// </returns>
        public static bool Filter(ReceiverComponent receiver, GameEntity candidate)
        {
            if (IsFull(receiver))
            {
                return(false);
            }

            HashSet <int> filterIndexes = receiver.filterComponentIndexes;

            if (filterIndexes == null)
            {
                DebugUtil.Assert(filterIndexes != null,
                                 "ReceiverUtils.Filter: Expects filter component indexes are defined on " + receiver);
                return(false);
            }

            foreach (int filterIndex in filterIndexes)
            {
                if (candidate.HasComponent(filterIndex))
                {
                    return(true);
                }
            }

            return(false);
        }
예제 #5
0
        /// <summary>
        /// ロード中のフレーム更新
        /// </summary>
        /// <returns> ロード状態じゃなくなった場合にtrueを返す </returns>
        public bool Update()
        {
            if (!mIsLoading)
            {
                return(true);
            }
            DebugUtil.Assert(Request != null);

            try {
                if (Request.isDone && Request.asset != null)
                {
                    //XXX mizoguchi AssetBundle.LoadAsset系がキャッシュしてくれるので、自前でキャッシュ処理はしない
                    // ロード終了イベント
                    if (mEnded != null)
                    {
                        mEnded(Request.asset);
                    }
                    mIsLoading = false;
                    return(true);
                }
            } catch (System.NullReferenceException ex) {
                DebugUtil.Log(ex.Source);
                DebugUtil.Log(ex.StackTrace);
                mIsLoading = false;
            }
            return(false);
        }
    public static bool HasReservedTubeEntrance(int cell, int minion)
    {
        DebugUtil.Assert(HasTubeEntrance[cell]);
        TubeEntrance tubeEntrance = tubeEntrances[cell];

        return(tubeEntrance.reservations.Contains(minion));
    }
예제 #7
0
 public KAnimBatchTextureCache.Entry CreateTexture(string name, int size_in_floats, int texture_property_id, int texture_size_property_id)
 {
     DebugUtil.Assert(size_in_floats > 0);
     KAnimBatchTextureCache.Entry entry = cache.Get(size_in_floats, texture_property_id, texture_size_property_id);
     entry.name = name;
     return(entry);
 }
예제 #8
0
 public void LoadAnims()
 {
     if (!KAnimBatchManager.Instance().isReady)
     {
         Debug.LogError("KAnimBatchManager is not ready when loading anim:" + base.name);
     }
     if (animFiles.Length <= 0)
     {
         DebugUtil.Assert(false, "KBatchedAnimController has no anim files:" + base.name);
     }
     if (animFiles[0].buildBytes == null)
     {
         DebugUtil.LogErrorArgs(base.gameObject, $"First anim file needs to be the build file but {animFiles[0].GetData().name} doesn't have an associated build");
     }
     overrideAnims.Clear();
     anims.Clear();
     SetBatchGroup(animFiles[0].GetData());
     for (int i = 0; i < animFiles.Length; i++)
     {
         AddAnims(animFiles[i]);
     }
     forceRebuild = true;
     if (layering != null)
     {
         layering.HideSymbols();
     }
     if (usingNewSymbolOverrideSystem)
     {
         DebugUtil.Assert((UnityEngine.Object)GetComponent <SymbolOverrideController>() != (UnityEngine.Object)null);
     }
 }
 public void RemoveAtSwap(int index)
 {
     ValidateIndex(index);
     elements[index] = elements[size - 1];
     sizeImpl--;
     DebugUtil.Assert(sizeImpl >= 0);
 }
예제 #10
0
 public Chore(ChoreType chore_type, ChoreProvider chore_provider, bool run_until_complete, Action <Chore> on_complete, Action <Chore> on_begin, Action <Chore> on_end, PriorityScreen.PriorityClass priority_class, int priority_value, bool is_preemptable, bool allow_in_context_menu, int priority_mod, bool add_to_daily_report, ReportManager.ReportType report_type)
 {
     if (priority_value == 2147483647)
     {
         priority_class = PriorityScreen.PriorityClass.topPriority;
         priority_value = 2;
     }
     if (priority_value < 1 || priority_value > 9)
     {
         Debug.LogErrorFormat("Priority Value Out Of Range: {0}", priority_value);
     }
     masterPriority = new PrioritySetting(priority_class, priority_value);
     priorityMod    = priority_mod;
     id             = ++nextId;
     if ((UnityEngine.Object)chore_provider == (UnityEngine.Object)null)
     {
         chore_provider = GlobalChoreProvider.Instance;
         DebugUtil.Assert((UnityEngine.Object)chore_provider != (UnityEngine.Object)null);
     }
     choreType        = chore_type;
     runUntilComplete = run_until_complete;
     onComplete       = on_complete;
     onEnd            = on_end;
     onBegin          = on_begin;
     IsPreemptable    = is_preemptable;
     AddPrecondition(ChorePreconditions.instance.IsValid, null);
     AddPrecondition(ChorePreconditions.instance.IsPermitted, null);
     AddPrecondition(ChorePreconditions.instance.IsPreemptable, null);
     AddPrecondition(ChorePreconditions.instance.HasUrge, null);
     AddPrecondition(ChorePreconditions.instance.IsMoreSatisfyingEarly, null);
     AddPrecondition(ChorePreconditions.instance.IsMoreSatisfyingLate, null);
     AddPrecondition(ChorePreconditions.instance.IsOverrideTargetNullOrMe, null);
     chore_provider.AddChore(this);
 }
 public void Render()
 {
     if (ready)
     {
         foreach (BatchSet activeBatchSet in activeBatchSets)
         {
             DebugUtil.Assert(activeBatchSet != null);
             DebugUtil.Assert(activeBatchSet.group != null);
             Mesh mesh = activeBatchSet.group.mesh;
             for (int i = 0; i < activeBatchSet.batchCount; i++)
             {
                 KAnimBatch batch = activeBatchSet.GetBatch(i);
                 float      num   = 0.01f / (float)(1 + batch.id % 256);
                 if (batch.size != 0 && batch.active && batch.materialType != KAnimBatchGroup.MaterialType.UI)
                 {
                     Vector3 zero     = Vector3.zero;
                     Vector3 position = batch.position;
                     zero.z = position.z + num;
                     int layer = batch.layer;
                     Graphics.DrawMesh(mesh, zero, Quaternion.identity, activeBatchSet.group.GetMaterial(batch.materialType), layer, null, 0, batch.matProperties);
                 }
             }
         }
     }
 }
    private string ReplaceTags(string text)
    {
        DebugUtil.Assert(text != null);
        int num  = text.IndexOf('{');
        int num2 = text.IndexOf('}');

        if (0 <= num && num < num2)
        {
            StringBuilder stringBuilder = new StringBuilder();
            int           num3          = 0;
            while (0 <= num)
            {
                string value = text.Substring(num3, num - num3);
                stringBuilder.Append(value);
                num2 = text.IndexOf('}', num);
                if (num >= num2)
                {
                    break;
                }
                string tag            = text.Substring(num + 1, num2 - num - 1);
                string tagDescription = GetTagDescription(tag);
                stringBuilder.Append(tagDescription);
                num3 = num2 + 1;
                num  = text.IndexOf('{', num2);
            }
            stringBuilder.Append(text.Substring(num3, text.Length - num3));
            return(stringBuilder.ToString());
        }
        return(text);
    }
예제 #13
0
        /// <summary>
        /// Parents child object to parent objects if both entities are linked to game objects.
        /// </summary>
        /// <returns>
        /// If parent and child are linked to game objects.
        /// </returns>
        public static bool TryAddChild(int parentEntityId, int childEntityId,
                                       bool silentIfChildIsUnlinked = false)
        {
            GameObject parentObject = GetObject(parentEntityId);

            DebugUtil.Assert(parentObject != null,
                             "GameLinkUtils.TryAddChild: Did you expect parent ID " + parentEntityId +
                             " to be linked to a game object? Child ID " + childEntityId);
            if (parentObject == null)
            {
                return(false);
            }

            GameObject childObject = GetObject(childEntityId);

            if (!silentIfChildIsUnlinked)
            {
                DebugUtil.Assert(childObject != null,
                                 "GameLinkUtils.TryAddChild: Did you expect child ID " + childEntityId +
                                 " to be linked to a game object? Parent ID " + parentEntityId);
            }
            if (childObject == null)
            {
                return(false);
            }

            SceneNodeView.AddChild(parentObject, childObject);
            return(true);
        }
예제 #14
0
        public ChoreTable CreateTable()
        {
            DebugUtil.Assert(interruptGroupId == 0);
            Entry[]     array = new Entry[infos.Count];
            Stack <int> stack = new Stack <int>();

            for (int i = 0; i < infos.Count; i++)
            {
                int  priority = 10000 - i * 100;
                int  num      = 10000 - i * 100;
                Info info     = infos[i];
                int  num2     = info.interruptGroupId;
                if (num2 != 0)
                {
                    if (stack.Count != num2)
                    {
                        stack.Push(num);
                    }
                    else
                    {
                        num = stack.Peek();
                    }
                }
                else if (stack.Count > 0)
                {
                    stack.Pop();
                }
                ref Entry reference = ref array[i];
                Info      info2     = infos[i];
                reference = new Entry(info2.def, priority, num);
            }
예제 #15
0
    public void Init(BuildingChoresPanel.DupeEntryData data)
    {
        choreConsumer = data.consumer;
        if (data.context.IsPotentialSuccess())
        {
            string newValue = (!((Object)data.context.chore.driver == (Object)data.consumer.choreDriver)) ? string.Format(DUPLICANTS.CHORES.PRECONDITIONS.RANK_FORMAT.text, data.rank) : DUPLICANTS.CHORES.PRECONDITIONS.CURRENT_ERRAND.text;
            label.text = DUPLICANTS.CHORES.PRECONDITIONS.SUCCESS_ROW.Replace("{Duplicant}", data.consumer.name).Replace("{Rank}", newValue);
        }
        else
        {
            Chore.PreconditionInstance preconditionInstance = data.context.chore.GetPreconditions()[data.context.failedPreconditionId];
            string text = preconditionInstance.description;
            bool   test = text != null;
            Chore.PreconditionInstance preconditionInstance2 = data.context.chore.GetPreconditions()[data.context.failedPreconditionId];
            DebugUtil.Assert(test, "Chore requires description!", preconditionInstance2.id);
            if ((Object)data.context.chore.driver != (Object)null)
            {
                text = text.Replace("{Assignee}", data.context.chore.driver.GetProperName());
            }
            text       = text.Replace("{Selected}", data.context.chore.gameObject.GetProperName());
            label.text = DUPLICANTS.CHORES.PRECONDITIONS.FAILURE_ROW.Replace("{Duplicant}", data.consumer.name).Replace("{Reason}", text);
        }
        Image image = icon;

        JobsTableScreen.PriorityInfo priorityInfo = JobsTableScreen.priorityInfo[data.personalPriority];
        image.sprite    = priorityInfo.sprite;
        toolTip.toolTip = TooltipForDupe(data.context, data.consumer, data.rank);
    }
 private static int ManifestFlagIndex(Tag tag)
 {
     if (tagTable.TryGetValue(tag, out int value))
     {
         return(value);
     }
     value = tagTable.Count;
     tagTable.Add(tag, value);
     inverseTagTable.Add(tag);
     DebugUtil.Assert(inverseTagTable.Count == value + 1);
     if (tagTable.Count >= 384)
     {
         string text = "Out of tag bits:\n";
         int    num  = 0;
         foreach (KeyValuePair <Tag, int> item in tagTable)
         {
             text = text + item.Key.ToString() + ", ";
             num++;
             if (num % 64 == 0)
             {
                 text += "\n";
             }
         }
         Debug.LogError(text);
     }
     return(value);
 }
예제 #17
0
    private void UnregisterVisibilityListener()
    {
        DebugUtil.Assert(visibilityListenerRegistered);
        Singleton <KBatchedAnimUpdater> .Instance.VisibilityUnregister(this);

        visibilityListenerRegistered = false;
    }
예제 #18
0
	public override void Fight( UnitController fighter, UnitController.UnitState unitState )
	{
		DebugUtil.Assert( unitState == UnitController.UnitState.FIGHTING, "Unaccepted argument for Fight function in enemy unit!" );
		if ( mState != UnitController.UnitState.FIGHTING )
		{
			base.Fight( fighter, unitState );
		}
	}
예제 #19
0
        public NameSetting(string bundleName, params string [] dirPathList)
        {
            BundleName = bundleName;
            DebugUtil.Assert(dirPathList.Length > 0);

            Dirs = new string[dirPathList.Length];
            dirPathList.CopyTo(Dirs, 0);
        }
    public static void SetTubeEntranceReservationCapacity(int cell, int newReservationCapacity)
    {
        DebugUtil.Assert(HasTubeEntrance[cell]);
        TubeEntrance value = tubeEntrances[cell];

        value.reservationCapacity = newReservationCapacity;
        tubeEntrances[cell]       = value;
    }
    public static void SetTubeEntranceOperational(int cell, bool operational)
    {
        DebugUtil.Assert(HasTubeEntrance[cell]);
        TubeEntrance value = tubeEntrances[cell];

        value.operational   = operational;
        tubeEntrances[cell] = value;
    }
        private void OnValidate()
        {
            DebugUtil.Assert(m_Trigger != null,
                             this + ".OnValidate: Has no Trigger.");

            DebugUtil.Assert(m_KinematicBody != null,
                             this + ".OnValidate: Has no Kinematic Body.");
        }
예제 #23
0
 public MinMaxNormAxisInput(AxisType axis)
 {
     Axis = axis;
     InputDeviceConfig.AxisMapping axisMapping = InputManager.activeDevice.config.GetAxisMapping(axis);
     DebugUtil.Assert(axisMapping != null, string.Format("Axis {0} have to be mapped.", axis));
     MinInput = axisMapping.min;
     MaxInput = axisMapping.max;
 }
 public void AddBehaviourPrecondition(Tag tag, Func <object, bool> precondition, object arg)
 {
     DebugUtil.Assert(!behaviourPreconditions.ContainsKey(tag));
     behaviourPreconditions[tag] = new BehaviourPrecondition
     {
         cb  = precondition,
         arg = arg
     };
 }
예제 #25
0
        /// <summary>
        /// ロード開始
        /// </summary>
        public void Start(AssetBundle assetBundle, string assetBundleName, string assetName, Action <UnityEngine.Object> onEnded)
        {
            DebugUtil.Assert(!mIsLoading);

            mIsLoading       = true;
            mAssetName       = assetName;
            mAssetBundleName = assetBundleName;
            mEnded          += onEnded;
        }
예제 #26
0
        /// <summary>
        /// ロード開始
        /// </summary>
        public void Start(AssetBundle assetBundle, string assetBundleName, string assetName, Action <UnityEngine.Object> onEnded)
        {
            DebugUtil.Assert(!mIsLoading);

            mEnded += onEnded;
            Request = assetBundle.LoadAssetAsync(assetName);
            DebugUtil.Assert(Request != null);
            mIsLoading = true;
        }
예제 #27
0
    /*********************************************/

    private static KeyCode GetJoystickKey(uint in_index, uint in_buttonNumber)
    {
        DebugUtil.Assert(in_index <= 3);
        DebugUtil.Assert(in_buttonNumber <= 19);

        string str = "Joystick" + (in_index + 1u) + "Button" + in_buttonNumber;

        return((KeyCode)System.Enum.Parse(typeof(KeyCode), str));
    }
 public void SetSymbolScale(int symbol_index, float scale)
 {
     DebugUtil.Assert(symbol_index < symbolCount);
     if (symbolInstances[symbol_index].scale != scale)
     {
         symbolInstances[symbol_index].scale = scale;
         MarkDirty();
     }
 }
 public void SetSymbolTint(int symbol_index, Color color)
 {
     DebugUtil.Assert(symbol_index < symbolCount);
     if (symbolInstances[symbol_index].color != color)
     {
         symbolInstances[symbol_index].color = color;
         MarkDirty();
     }
 }
    private bool DoTalking(Conversation setup, MinionIdentity new_speaker)
    {
        DebugUtil.Assert(setup != null, "setup was null");
        DebugUtil.Assert((UnityEngine.Object)new_speaker != (UnityEngine.Object)null, "new_speaker was null");
        if ((UnityEngine.Object)setup.lastTalked != (UnityEngine.Object)null)
        {
            setup.lastTalked.Trigger(25860745, setup.lastTalked.gameObject);
        }
        DebugUtil.Assert(setup.conversationType != null, "setup.conversationType was null");
        Conversation.Topic nextTopic = setup.conversationType.GetNextTopic(new_speaker, setup.lastTopic);
        if (nextTopic == null || nextTopic.mode == Conversation.ModeType.End || nextTopic.mode == Conversation.ModeType.Segue)
        {
            return(false);
        }
        Thought thoughtForTopic = GetThoughtForTopic(setup, nextTopic);

        if (thoughtForTopic == null)
        {
            return(false);
        }
        ThoughtGraph.Instance sMI = new_speaker.GetSMI <ThoughtGraph.Instance>();
        if (sMI == null)
        {
            return(false);
        }
        sMI.AddThought(thoughtForTopic);
        setup.lastTopic      = nextTopic;
        setup.lastTalked     = new_speaker;
        setup.lastTalkedTime = GameClock.Instance.GetTime();
        DebugUtil.Assert(lastConvoTimeByMinion != null, "lastConvoTimeByMinion was null");
        lastConvoTimeByMinion[setup.lastTalked] = GameClock.Instance.GetTime();
        Effects component = setup.lastTalked.GetComponent <Effects>();

        DebugUtil.Assert((UnityEngine.Object)component != (UnityEngine.Object)null, "effects was null");
        component.Add("GoodConversation", true);
        Conversation.Mode mode = Conversation.Topic.Modes[(int)nextTopic.mode];
        DebugUtil.Assert(mode != null, "mode was null");
        StartedTalkingEvent startedTalkingEvent = new StartedTalkingEvent();

        startedTalkingEvent.talker = new_speaker.gameObject;
        startedTalkingEvent.anim   = mode.anim;
        StartedTalkingEvent data = startedTalkingEvent;

        foreach (MinionIdentity minion in setup.minions)
        {
            if (!(bool)minion)
            {
                DebugUtil.DevAssert(false, "minion in setup.minions was null");
            }
            else
            {
                minion.Trigger(-594200555, data);
            }
        }
        setup.numUtterances++;
        return(true);
    }