示例#1
0
        void GenerateArgumentPermutations(StateData stateData, NativeList <ActionKey> argumentPermutations)
        {
            var GameFilter = new NativeArray <ComponentType>(1, Allocator.Temp)
            {
                [0] = ComponentType.ReadWrite <AI.Planner.Domains.Game>(),
            };
            var SourceFilter = new NativeArray <ComponentType>(3, Allocator.Temp)
            {
                [0] = ComponentType.ReadWrite <AI.Planner.Domains.Coordinate>(), [1] = ComponentType.ReadWrite <AI.Planner.Domains.Cell>(), [2] = ComponentType.Exclude <AI.Planner.Domains.Blocker>(),
            };
            var TargetFilter = new NativeArray <ComponentType>(3, Allocator.Temp)
            {
                [0] = ComponentType.ReadWrite <AI.Planner.Domains.Coordinate>(), [1] = ComponentType.ReadWrite <AI.Planner.Domains.Cell>(), [2] = ComponentType.Exclude <AI.Planner.Domains.Blocker>(),
            };
            var GameObjectIndices = new NativeList <int>(2, Allocator.Temp);

            stateData.GetTraitBasedObjectIndices(GameObjectIndices, GameFilter);
            var SourceObjectIndices = new NativeList <int>(2, Allocator.Temp);

            stateData.GetTraitBasedObjectIndices(SourceObjectIndices, SourceFilter);
            var TargetObjectIndices = new NativeList <int>(2, Allocator.Temp);

            stateData.GetTraitBasedObjectIndices(TargetObjectIndices, TargetFilter);
            var CellBuffer = stateData.CellBuffer;

            for (int i0 = 0; i0 < GameObjectIndices.Length; i0++)
            {
                var GameIndex  = GameObjectIndices[i0];
                var GameObject = stateData.TraitBasedObjects[GameIndex];



                for (int i1 = 0; i1 < SourceObjectIndices.Length; i1++)
                {
                    var SourceIndex  = SourceObjectIndices[i1];
                    var SourceObject = stateData.TraitBasedObjects[SourceIndex];


                    if (!(CellBuffer[SourceObject.CellIndex].Type != CellType.None))
                    {
                        continue;
                    }


                    for (int i2 = 0; i2 < TargetObjectIndices.Length; i2++)
                    {
                        var TargetIndex  = TargetObjectIndices[i2];
                        var TargetObject = stateData.TraitBasedObjects[TargetIndex];

                        if (!(CellBuffer[SourceObject.CellIndex].Right == stateData.GetTraitBasedObjectId(TargetIndex)))
                        {
                            continue;
                        }


                        if (!(CellBuffer[TargetObject.CellIndex].Type != CellType.None))
                        {
                            continue;
                        }

                        var actionKey = new ActionKey(k_MaxArguments)
                        {
                            ActionGuid      = ActionGuid,
                            [k_GameIndex]   = GameIndex,
                            [k_SourceIndex] = SourceIndex,
                            [k_TargetIndex] = TargetIndex,
                        };
                        argumentPermutations.Add(actionKey);
                    }
                }
            }
            GameObjectIndices.Dispose();
            SourceObjectIndices.Dispose();
            TargetObjectIndices.Dispose();
            GameFilter.Dispose();
            SourceFilter.Dispose();
            TargetFilter.Dispose();
        }
示例#2
0
        void GenerateArgumentPermutations(StateData stateData, NativeList <ActionKey> argumentPermutations)
        {
            var CharacterFilter = new NativeArray <ComponentType>(1, Allocator.Temp)
            {
                [0] = ComponentType.ReadWrite <Generated.AI.Planner.StateRepresentation.Character>(),
            };
            var ToFilter = new NativeArray <ComponentType>(3, Allocator.Temp)
            {
                [0] = ComponentType.ReadWrite <Generated.AI.Planner.StateRepresentation.Waypoint>(), [1] = ComponentType.Exclude <Generated.AI.Planner.StateRepresentation.ActivationLock>(), [2] = ComponentType.Exclude <Generated.AI.Planner.StateRepresentation.KeyLock>(),
            };
            var FromFilter = new NativeArray <ComponentType>(1, Allocator.Temp)
            {
                [0] = ComponentType.ReadWrite <Generated.AI.Planner.StateRepresentation.Waypoint>(),
            };
            var CharacterObjectIndices = new NativeList <int>(2, Allocator.Temp);

            stateData.GetTraitBasedObjectIndices(CharacterObjectIndices, CharacterFilter);

            var ToObjectIndices = new NativeList <int>(2, Allocator.Temp);

            stateData.GetTraitBasedObjectIndices(ToObjectIndices, ToFilter);

            var FromObjectIndices = new NativeList <int>(2, Allocator.Temp);

            stateData.GetTraitBasedObjectIndices(FromObjectIndices, FromFilter);

            var WaypointBuffer  = stateData.WaypointBuffer;
            var CharacterBuffer = stateData.CharacterBuffer;



            for (int i0 = 0; i0 < CharacterObjectIndices.Length; i0++)
            {
                var CharacterIndex  = CharacterObjectIndices[i0];
                var CharacterObject = stateData.TraitBasedObjects[CharacterIndex];



                for (int i1 = 0; i1 < ToObjectIndices.Length; i1++)
                {
                    var ToIndex  = ToObjectIndices[i1];
                    var ToObject = stateData.TraitBasedObjects[ToIndex];

                    if (!(WaypointBuffer[ToObject.WaypointIndex].Occupied == false))
                    {
                        continue;
                    }

                    if (!(WaypointBuffer[ToObject.WaypointIndex].Left == CharacterBuffer[CharacterObject.CharacterIndex].Waypoint))
                    {
                        continue;
                    }



                    for (int i2 = 0; i2 < FromObjectIndices.Length; i2++)
                    {
                        var FromIndex  = FromObjectIndices[i2];
                        var FromObject = stateData.TraitBasedObjects[FromIndex];



                        if (!(CharacterBuffer[CharacterObject.CharacterIndex].Waypoint == stateData.GetTraitBasedObjectId(FromIndex)))
                        {
                            continue;
                        }



                        var actionKey = new ActionKey(k_MaxArguments)
                        {
                            ActionGuid         = ActionGuid,
                            [k_CharacterIndex] = CharacterIndex,
                            [k_ToIndex]        = ToIndex,
                            [k_FromIndex]      = FromIndex,
                        };
                        argumentPermutations.Add(actionKey);
                    }
                }
            }
            CharacterObjectIndices.Dispose();
            ToObjectIndices.Dispose();
            FromObjectIndices.Dispose();
            CharacterFilter.Dispose();
            ToFilter.Dispose();
            FromFilter.Dispose();
        }
示例#3
0
        public static void SwapCellAndUpdateBoard(ActionKey action, StateData state, Cell cell1, Cell cell2)
        {
            // Retrieve Game trait data
            var gameId    = state.GetTraitBasedObjectId(action[GameIndex]);
            var game      = state.GetTraitBasedObject(gameId);
            var gameTrait = state.GetTraitOnObject <Game>(game);

            // Swap cell types
            (cell1.Type, cell2.Type) = (cell2.Type, cell1.Type);
            state.SetTraitOnObjectAtIndex(cell1, action[Cell1Index]);
            state.SetTraitOnObjectAtIndex(cell2, action[Cell2Index]);

            int newScore       = gameTrait.Score;
            var cellsToDestroy = new NativeList <int>(1, Allocator.Temp);

            // Check match3 and destroy used Gem (set to Type = None)
            CheckMatchOnGem(state, cell1, action[Cell1Index], ref cellsToDestroy);
            CheckMatchOnGem(state, cell2, action[Cell2Index], ref cellsToDestroy);

            if (cellsToDestroy.Length > 0)
            {
                #region debug
                cellsToDestroy.Clear();
                CheckMatchOnGem(state, cell1, action[Cell1Index], ref cellsToDestroy);
                CheckMatchOnGem(state, cell2, action[Cell2Index], ref cellsToDestroy);
                #endregion

                // Unset all destroyed cells
                var cellQueue   = new NativeList <int>(Allocator.Temp);
                var cellsQueued = new NativeHashMap <int, byte>(3, Allocator.Temp);
                var cellChanged = new NativeHashMap <int, byte>(3, Allocator.Temp);

                while (cellsToDestroy.Length > 0)
                {
                    for (int i = 0; i < cellsToDestroy.Length; i++)
                    {
                        var cellIndex = cellsToDestroy[i];
                        if (cellsQueued.ContainsKey(cellIndex))
                        {
                            continue;
                        }

                        var cellTrait = state.GetTraitOnObjectAtIndex <Cell>(cellIndex);

                        if (cellTrait.Type == gameTrait.GoalType)
                        {
                            newScore += CustomSwapReward.GoalReward;
                        }
                        else
                        {
                            newScore += CustomSwapReward.BasicReward;
                        }

                        cellTrait.Type = CellType.None;
                        state.SetTraitOnObjectAtIndex(cellTrait, cellIndex);

                        cellQueue.Add(cellIndex);
                        cellsQueued.TryAdd(cellIndex, default);
                    }
                    cellsToDestroy.Clear();

                    // Stitch Unset Gems with Top Gem
                    while (cellQueue.Length > 0)
                    {
                        var cellIndex = cellQueue[0];
                        cellQueue.RemoveAtSwapBack(0);
                        cellsQueued.Remove(cellIndex);
                        var cell = state.GetTraitOnObjectAtIndex <Cell>(cellIndex);

                        if (cell.Top.Id == ObjectId.None)
                        {
                            continue;
                        }

                        if (cell.Type == CellType.None)
                        {
                            var cellTopObject = state.GetTraitBasedObject(cell.Top);
                            var cellTop       = state.GetTraitOnObject <Cell>(cellTopObject);

                            // Find first cell with a known type on top
                            while (cellTop.Type == CellType.None)
                            {
                                if (cellTop.Top.Id == ObjectId.None)
                                {
                                    break;
                                }

                                cellTopObject = state.GetTraitBasedObject(cellTop.Top);
                                cellTop       = state.GetTraitOnObject <Cell>(cellTopObject);
                            }

                            if (cellTop.Type != CellType.None)
                            {
                                cell.Type = cellTop.Type;
                                state.SetTraitOnObjectAtIndex(cell, cellIndex);

                                var newCellTop = cellTop;
                                newCellTop.Type = CellType.None;
                                state.SetTraitOnObject(newCellTop, ref cellTopObject);

                                var index = state.GetTraitBasedObjectIndex(cellTopObject);
                                cellQueue.Add(index);
                                cellsQueued.TryAdd(index, default);

                                // Queue all vertical cells for checking
                                var cellTopIndex = state.GetTraitBasedObjectIndex(cell.Top);
                                while (cellTop.Type != CellType.None)
                                {
                                    cellChanged.TryAdd(cellTopIndex, default);

                                    if (cellTop.Top == TraitBasedObjectId.None)
                                    {
                                        break;
                                    }

                                    cellTopIndex = state.GetTraitBasedObjectIndex(cellTop.Top);
                                    cellTop      = state.GetTraitOnObjectAtIndex <Cell>(cellTopIndex);
                                }
                            }
                        }
                    }

                    // Check cells affected by stitching for chained-explosion
                    var changedKeys = cellChanged.GetKeyArray(Allocator.Temp);
                    for (int i = 0; i < changedKeys.Length; i++)
                    {
                        var cellIndex = changedKeys[i];
                        var cell      = state.GetTraitOnObjectAtIndex <Cell>(cellIndex);
                        CheckMatchOnGem(state, cell, cellIndex, ref cellsToDestroy);
                    }
                    changedKeys.Dispose();
                    cellChanged.Clear();
                }

                cellQueue.Dispose();
                cellsQueued.Dispose();
                cellChanged.Dispose();
            }

            // Score is stored in the Game Object and apply later in the reward function
            gameTrait.Score = newScore;
            state.SetTraitOnObject(gameTrait, ref game);

            cellsToDestroy.Dispose();
        }
示例#4
0
        void GenerateArgumentPermutations(StateData stateData, NativeList <ActionKey> argumentPermutations)
        {
            CharacterObjectIndices.Clear();
            stateData.GetTraitBasedObjectIndices(CharacterObjectIndices, CharacterFilter);

            ToObjectIndices.Clear();
            stateData.GetTraitBasedObjectIndices(ToObjectIndices, ToFilter);

            FromObjectIndices.Clear();
            stateData.GetTraitBasedObjectIndices(FromObjectIndices, FromFilter);

            var CharacterBuffer = stateData.CharacterBuffer;
            var WaypointBuffer  = stateData.WaypointBuffer;
            var CarrierBuffer   = stateData.CarrierBuffer;



            for (int i0 = 0; i0 < CharacterObjectIndices.Length; i0++)
            {
                var CharacterIndex  = CharacterObjectIndices[i0];
                var CharacterObject = stateData.TraitBasedObjects[CharacterIndex];



                if (!(CarrierBuffer[CharacterObject.CarrierIndex].Carried != TraitBasedObjectId.None))
                {
                    continue;
                }



                for (int i1 = 0; i1 < ToObjectIndices.Length; i1++)
                {
                    var ToIndex  = ToObjectIndices[i1];
                    var ToObject = stateData.TraitBasedObjects[ToIndex];


                    if (!(WaypointBuffer[ToObject.WaypointIndex].Occupied == false))
                    {
                        continue;
                    }



                    for (int i2 = 0; i2 < FromObjectIndices.Length; i2++)
                    {
                        var FromIndex  = FromObjectIndices[i2];
                        var FromObject = stateData.TraitBasedObjects[FromIndex];

                        if (!(CharacterBuffer[CharacterObject.CharacterIndex].Waypoint == stateData.GetTraitBasedObjectId(FromIndex)))
                        {
                            continue;
                        }


                        if (!(WaypointBuffer[ToObject.WaypointIndex].Right == stateData.GetTraitBasedObjectId(FromIndex)))
                        {
                            continue;
                        }



                        var actionKey = new ActionKey(k_MaxArguments)
                        {
                            ActionGuid         = ActionGuid,
                            [k_CharacterIndex] = CharacterIndex,
                            [k_ToIndex]        = ToIndex,
                            [k_FromIndex]      = FromIndex,
                        };
                        argumentPermutations.Add(actionKey);
                    }
                }
            }
        }
示例#5
0
        void GenerateArgumentPermutations(StateData stateData, NativeList <ActionKey> argumentPermutations)
        {
            CharacterObjectIndices.Clear();
            stateData.GetTraitBasedObjectIndices(CharacterObjectIndices, CharacterFilter);

            ToObjectIndices.Clear();
            stateData.GetTraitBasedObjectIndices(ToObjectIndices, ToFilter);

            FromObjectIndices.Clear();
            stateData.GetTraitBasedObjectIndices(FromObjectIndices, FromFilter);

            ActivationBlueObjectIndices.Clear();
            stateData.GetTraitBasedObjectIndices(ActivationBlueObjectIndices, ActivationBlueFilter);

            ActivationPinkObjectIndices.Clear();
            stateData.GetTraitBasedObjectIndices(ActivationPinkObjectIndices, ActivationPinkFilter);

            var WaypointBuffer         = stateData.WaypointBuffer;
            var CharacterBuffer        = stateData.CharacterBuffer;
            var ActivationSwitchBuffer = stateData.ActivationSwitchBuffer;



            for (int i0 = 0; i0 < CharacterObjectIndices.Length; i0++)
            {
                var CharacterIndex  = CharacterObjectIndices[i0];
                var CharacterObject = stateData.TraitBasedObjects[CharacterIndex];



                for (int i1 = 0; i1 < ToObjectIndices.Length; i1++)
                {
                    var ToIndex  = ToObjectIndices[i1];
                    var ToObject = stateData.TraitBasedObjects[ToIndex];

                    if (!(WaypointBuffer[ToObject.WaypointIndex].Occupied == false))
                    {
                        continue;
                    }

                    if (!(WaypointBuffer[ToObject.WaypointIndex].Down == CharacterBuffer[CharacterObject.CharacterIndex].Waypoint))
                    {
                        continue;
                    }



                    for (int i2 = 0; i2 < FromObjectIndices.Length; i2++)
                    {
                        var FromIndex  = FromObjectIndices[i2];
                        var FromObject = stateData.TraitBasedObjects[FromIndex];



                        if (!(CharacterBuffer[CharacterObject.CharacterIndex].Waypoint == stateData.GetTraitBasedObjectId(FromIndex)))
                        {
                            continue;
                        }



                        for (int i3 = 0; i3 < ActivationBlueObjectIndices.Length; i3++)
                        {
                            var ActivationBlueIndex  = ActivationBlueObjectIndices[i3];
                            var ActivationBlueObject = stateData.TraitBasedObjects[ActivationBlueIndex];



                            if (!(WaypointBuffer[ActivationBlueObject.WaypointIndex].Occupied == true))
                            {
                                continue;
                            }


                            if (!(ActivationSwitchBuffer[ActivationBlueObject.ActivationSwitchIndex].Type == ActivationType.Blue))
                            {
                                continue;
                            }



                            for (int i4 = 0; i4 < ActivationPinkObjectIndices.Length; i4++)
                            {
                                var ActivationPinkIndex  = ActivationPinkObjectIndices[i4];
                                var ActivationPinkObject = stateData.TraitBasedObjects[ActivationPinkIndex];



                                if (!(WaypointBuffer[ActivationPinkObject.WaypointIndex].Occupied == true))
                                {
                                    continue;
                                }


                                if (!(ActivationSwitchBuffer[ActivationPinkObject.ActivationSwitchIndex].Type == ActivationType.Pink))
                                {
                                    continue;
                                }



                                var actionKey = new ActionKey(k_MaxArguments)
                                {
                                    ActionGuid              = ActionGuid,
                                    [k_CharacterIndex]      = CharacterIndex,
                                    [k_ToIndex]             = ToIndex,
                                    [k_FromIndex]           = FromIndex,
                                    [k_ActivationBlueIndex] = ActivationBlueIndex,
                                    [k_ActivationPinkIndex] = ActivationPinkIndex,
                                };
                                argumentPermutations.Add(actionKey);
                            }
                        }
                    }
                }
            }
        }
示例#6
0
        public bool IsTerminal(StateData stateData)
        {
            var Character1Filter = new NativeArray <ComponentType>(1, Allocator.Temp)
            {
                [0] = ComponentType.ReadWrite <Character>(),
            };
            var Character1ObjectIndices = new NativeList <int>(2, Allocator.Temp);

            stateData.GetTraitBasedObjectIndices(Character1ObjectIndices, Character1Filter);
            var Character2Filter = new NativeArray <ComponentType>(1, Allocator.Temp)
            {
                [0] = ComponentType.ReadWrite <Character>(),
            };
            var Character2ObjectIndices = new NativeList <int>(2, Allocator.Temp);

            stateData.GetTraitBasedObjectIndices(Character2ObjectIndices, Character2Filter);
            var Character3Filter = new NativeArray <ComponentType>(1, Allocator.Temp)
            {
                [0] = ComponentType.ReadWrite <Character>(),
            };
            var Character3ObjectIndices = new NativeList <int>(2, Allocator.Temp);

            stateData.GetTraitBasedObjectIndices(Character3ObjectIndices, Character3Filter);
            var Waypoint1Filter = new NativeArray <ComponentType>(2, Allocator.Temp)
            {
                [0] = ComponentType.ReadWrite <Waypoint>(), [1] = ComponentType.ReadWrite <EscapePoint>(),
            };
            var Waypoint1ObjectIndices = new NativeList <int>(2, Allocator.Temp);

            stateData.GetTraitBasedObjectIndices(Waypoint1ObjectIndices, Waypoint1Filter);
            var Waypoint2Filter = new NativeArray <ComponentType>(2, Allocator.Temp)
            {
                [0] = ComponentType.ReadWrite <Waypoint>(), [1] = ComponentType.ReadWrite <EscapePoint>(),
            };
            var Waypoint2ObjectIndices = new NativeList <int>(2, Allocator.Temp);

            stateData.GetTraitBasedObjectIndices(Waypoint2ObjectIndices, Waypoint2Filter);
            var Waypoint3Filter = new NativeArray <ComponentType>(2, Allocator.Temp)
            {
                [0] = ComponentType.ReadWrite <Waypoint>(), [1] = ComponentType.ReadWrite <EscapePoint>(),
            };
            var Waypoint3ObjectIndices = new NativeList <int>(2, Allocator.Temp);

            stateData.GetTraitBasedObjectIndices(Waypoint3ObjectIndices, Waypoint3Filter);
            var CharacterBuffer = stateData.CharacterBuffer;

            for (int i0 = 0; i0 < Character1ObjectIndices.Length; i0++)
            {
                var Character1Index  = Character1ObjectIndices[i0];
                var Character1Object = stateData.TraitBasedObjects[Character1Index];



                for (int i1 = 0; i1 < Character2ObjectIndices.Length; i1++)
                {
                    var Character2Index  = Character2ObjectIndices[i1];
                    var Character2Object = stateData.TraitBasedObjects[Character2Index];


                    if (!(stateData.GetTraitBasedObjectId(Character1Index) != stateData.GetTraitBasedObjectId(Character2Index)))
                    {
                        continue;
                    }



                    for (int i2 = 0; i2 < Character3ObjectIndices.Length; i2++)
                    {
                        var Character3Index  = Character3ObjectIndices[i2];
                        var Character3Object = stateData.TraitBasedObjects[Character3Index];



                        if (!(stateData.GetTraitBasedObjectId(Character2Index) != stateData.GetTraitBasedObjectId(Character3Index)))
                        {
                            continue;
                        }

                        if (!(stateData.GetTraitBasedObjectId(Character1Index) != stateData.GetTraitBasedObjectId(Character3Index)))
                        {
                            continue;
                        }



                        for (int i3 = 0; i3 < Waypoint1ObjectIndices.Length; i3++)
                        {
                            var Waypoint1Index  = Waypoint1ObjectIndices[i3];
                            var Waypoint1Object = stateData.TraitBasedObjects[Waypoint1Index];



                            if (!(CharacterBuffer[Character1Object.CharacterIndex].Waypoint == stateData.GetTraitBasedObjectId(Waypoint1Index)))
                            {
                                continue;
                            }


                            for (int i4 = 0; i4 < Waypoint2ObjectIndices.Length; i4++)
                            {
                                var Waypoint2Index  = Waypoint2ObjectIndices[i4];
                                var Waypoint2Object = stateData.TraitBasedObjects[Waypoint2Index];



                                if (!(CharacterBuffer[Character2Object.CharacterIndex].Waypoint == stateData.GetTraitBasedObjectId(Waypoint2Index)))
                                {
                                    continue;
                                }

                                for (int i5 = 0; i5 < Waypoint3ObjectIndices.Length; i5++)
                                {
                                    var Waypoint3Index  = Waypoint3ObjectIndices[i5];
                                    var Waypoint3Object = stateData.TraitBasedObjects[Waypoint3Index];



                                    if (!(CharacterBuffer[Character3Object.CharacterIndex].Waypoint == stateData.GetTraitBasedObjectId(Waypoint3Index)))
                                    {
                                        continue;
                                    }
                                    Character1ObjectIndices.Dispose();
                                    Character1Filter.Dispose();
                                    Character2ObjectIndices.Dispose();
                                    Character2Filter.Dispose();
                                    Character3ObjectIndices.Dispose();
                                    Character3Filter.Dispose();
                                    Waypoint1ObjectIndices.Dispose();
                                    Waypoint1Filter.Dispose();
                                    Waypoint2ObjectIndices.Dispose();
                                    Waypoint2Filter.Dispose();
                                    Waypoint3ObjectIndices.Dispose();
                                    Waypoint3Filter.Dispose();
                                    return(true);
                                }
                            }
                        }
                    }
                }
            }
            Character1ObjectIndices.Dispose();
            Character1Filter.Dispose();
            Character2ObjectIndices.Dispose();
            Character2Filter.Dispose();
            Character3ObjectIndices.Dispose();
            Character3Filter.Dispose();
            Waypoint1ObjectIndices.Dispose();
            Waypoint1Filter.Dispose();
            Waypoint2ObjectIndices.Dispose();
            Waypoint2Filter.Dispose();
            Waypoint3ObjectIndices.Dispose();
            Waypoint3Filter.Dispose();

            return(false);
        }
示例#7
0
        void GenerateArgumentPermutations(StateData stateData, NativeList <ActionKey> argumentPermutations)
        {
            GameObjectIndices.Clear();
            stateData.GetTraitBasedObjectIndices(GameObjectIndices, GameFilter);

            SourceObjectIndices.Clear();
            stateData.GetTraitBasedObjectIndices(SourceObjectIndices, SourceFilter);

            TargetObjectIndices.Clear();
            stateData.GetTraitBasedObjectIndices(TargetObjectIndices, TargetFilter);

            var CellBuffer = stateData.CellBuffer;



            for (int i0 = 0; i0 < GameObjectIndices.Length; i0++)
            {
                var GameIndex  = GameObjectIndices[i0];
                var GameObject = stateData.TraitBasedObjects[GameIndex];



                for (int i1 = 0; i1 < SourceObjectIndices.Length; i1++)
                {
                    var SourceIndex  = SourceObjectIndices[i1];
                    var SourceObject = stateData.TraitBasedObjects[SourceIndex];


                    if (!(CellBuffer[SourceObject.CellIndex].Type != CellType.None))
                    {
                        continue;
                    }



                    for (int i2 = 0; i2 < TargetObjectIndices.Length; i2++)
                    {
                        var TargetIndex  = TargetObjectIndices[i2];
                        var TargetObject = stateData.TraitBasedObjects[TargetIndex];

                        if (!(CellBuffer[SourceObject.CellIndex].Right == stateData.GetTraitBasedObjectId(TargetIndex)))
                        {
                            continue;
                        }


                        if (!(CellBuffer[TargetObject.CellIndex].Type != CellType.None))
                        {
                            continue;
                        }



                        var actionKey = new ActionKey(k_MaxArguments)
                        {
                            ActionGuid      = ActionGuid,
                            [k_GameIndex]   = GameIndex,
                            [k_SourceIndex] = SourceIndex,
                            [k_TargetIndex] = TargetIndex,
                        };
                        argumentPermutations.Add(actionKey);
                    }
                }
            }
        }