Пример #1
0
 /// <inheritdoc/>
 public override int GetHashCode()
 {
     unchecked
     {
         int result = base.GetHashCode();
         if (MinInjectorVersion != null)
         {
             result = (result * 397) ^ MinInjectorVersion.GetHashCode();
         }
         if (Uri != null)
         {
             result = (result * 397) ^ Uri.GetHashCode();
         }
         if (Name != null)
         {
             result = (result * 397) ^ Name.GetHashCode();
         }
         result = (result * 397) ^ Summaries.GetSequencedHashCode();
         result = (result * 397) ^ Descriptions.GetSequencedHashCode();
         if (Homepage != null)
         {
             result = (result * 397) ^ Homepage.GetHashCode();
         }
         result = (result * 397) ^ NeedsTerminal.GetHashCode();
         result = (result * 397) ^ Feeds.GetSequencedHashCode();
         result = (result * 397) ^ Categories.GetSequencedHashCode();
         result = (result * 397) ^ Icons.GetSequencedHashCode();
         result = (result * 397) ^ Elements.GetSequencedHashCode();
         result = (result * 397) ^ EntryPoints.GetSequencedHashCode();
         result = (result * 397) ^ CapabilityLists.GetSequencedHashCode();
         return(result);
     }
 }
Пример #2
0
        public string GetDetailedDescription()
        {
            var loadStyle = PluginInstance != null
                ? $"Instance based: {PluginInstance.GetType().AssemblyQualifiedName}"
                : $"Assembly path based: {PluginAssemblyPath}";

            var entryPointStyle = EntryPoints != null
                ? "Explicit entry-point based"
                : ProjectGraph != null
                    ? "Static graph based"
                    : "Visual Studio Workaround based";

            var entryPoints = EntryPoints != null
                ? string.Join(
                "\n",
                EntryPoints.Select(e => $"{e.ProjectFile} {{{FormatGlobalProperties(e.GlobalProperties)}}}"))
                : ProjectGraph != null
                    ? string.Join(
                "\n",
                ProjectGraph !.EntryPointNodes.Select(
                    n =>
                    $"{n.ProjectInstance.FullPath} {{{FormatGlobalProperties(n.ProjectInstance.GlobalProperties)}}}"))
                    : "Solution file";

            return($"{loadStyle}\nEntry-point style: {entryPointStyle}\nEntry-points:\n{entryPoints}");
Пример #3
0
        void IXleSerializable.WriteData(XleSerializationInfo info)
        {
            if (EntryPoints == null)
            {
                EntryPoints = new List <EntryPoint>();
            }
            while (EntryPoints.Count > 0 && EntryPoints.Last().Location == Point.Zero)
            {
                EntryPoints.RemoveAt(EntryPoints.Count - 1);
            }

            info.Write("MapName", mMapName);
            info.Write("ExtenderName", ExtenderName);

            info.Write("MapID", mMapID);
            info.Write("TileSet", mTileSet);
            info.Write("TileImage", mTileImage);
            info.Write("OutsideTile", mOutsideTile);
            info.Write("Events", mEvents.ToArray());
            info.Write("EntryPoints", EntryPoints);

            if (HasRoofs)
            {
                info.Write("Roofs", Roofs);
            }
            if (HasGuards)
            {
                info.Write("Guards", Guards);
            }

            WriteData(info);
        }
Пример #4
0
        public EntryPoint GetEntryPoint([CanBeNull] string command = null)
        {
            if (command == null)
            {
                command = Command.NameRun;
            }

            return(EntryPoints.FirstOrDefault(entryPoint => entryPoint.Command == command));
        }
Пример #5
0
        //--------------------//

        #region Clone
        /// <summary>
        /// Creates a deep copy of this <see cref="Feed"/> instance.
        /// </summary>
        /// <returns>The new copy of the <see cref="Feed"/>.</returns>
        public Feed Clone()
        {
            var feed = new Feed {
                UnknownAttributes = UnknownAttributes, UnknownElements = UnknownElements, MinInjectorVersion = MinInjectorVersion, Uri = Uri, Name = Name, Homepage = Homepage, NeedsTerminal = NeedsTerminal
            };

            feed.Feeds.AddRange(Feeds.CloneElements());
            feed.FeedFor.AddRange(FeedFor.CloneElements());
            feed.Summaries.AddRange(Summaries.CloneElements());
            feed.Descriptions.AddRange(Descriptions.CloneElements());
            feed.Categories.AddRange(Categories);
            feed.Icons.AddRange(Icons);
            feed.Elements.AddRange(Elements.CloneElements());
            feed.EntryPoints.AddRange(EntryPoints.CloneElements());
            feed.CapabilityLists.AddRange(CapabilityLists.CloneElements());
            return(feed);
        }
Пример #6
0
        public EntryPoint FetchOrCreateEntryPoint(string type)
        {
            var ep = EntryPoints.SingleOrDefault(pp => pp.Description == type);

            if (ep == null)
            {
                var max = EntryPoints.Max(mm => mm.Id) + 10;
                if (max < 1000)
                {
                    max = 1010;
                }
                ep = new EntryPoint {
                    Id = max, Description = type, Code = type.Truncate(20)
                };
                EntryPoints.InsertOnSubmit(ep);
                SubmitChanges();
            }
            return(ep);
        }
Пример #7
0
        public App()
        {
            InitializeComponent();
            CryptogramLibrary.Functions.Alert       = Alert;
            CryptogramLibrary.Functions.ShareText   = ShareText;
            CryptogramLibrary.Messaging.ViewMessage = ViewMessage;
            MainPage = new MainPage();
            var entryPoints = new System.Collections.Generic.Dictionary <String, String>();

#if DEBUG
            var networkName = "testnet";
            entryPoints.Add(Environment.MachineName, "http://localhost:55007");
#else
            var NetworkName = "ANDREA";
            EntryPoints.Add(Environment.MachineName, "http://www.bitboxlab.com");
#endif
            CryptogramLibrary.Functions.Initialize(entryPoints, networkName);
            //NetworkExtension.Network.Initialize();
        }
Пример #8
0
 /// <inheritdoc/>
 public override int GetHashCode()
 {
     unchecked
     {
         int result = base.GetHashCode();
         result = (result * 397) ^ Uri?.GetHashCode() ?? 0;
         result = (result * 397) ^ MinInjectorVersion?.GetHashCode() ?? 0;
         result = (result * 397) ^ Name?.GetHashCode() ?? 0;
         result = (result * 397) ^ Summaries.GetUnsequencedHashCode();
         result = (result * 397) ^ Descriptions.GetUnsequencedHashCode();
         result = (result * 397) ^ Homepage?.GetHashCode() ?? 0;
         result = (result * 397) ^ NeedsTerminal.GetHashCode();
         result = (result * 397) ^ Feeds.GetUnsequencedHashCode();
         result = (result * 397) ^ Categories.GetUnsequencedHashCode();
         result = (result * 397) ^ Icons.GetUnsequencedHashCode();
         result = (result * 397) ^ Elements.GetUnsequencedHashCode();
         result = (result * 397) ^ EntryPoints.GetUnsequencedHashCode();
         result = (result * 397) ^ CapabilityLists.GetUnsequencedHashCode();
         return(result);
     }
 }
Пример #9
0
        private void NormalizeEntryPoints()
        {
            // Remove invalid entry points
            EntryPoints.RemoveAll(x => string.IsNullOrEmpty(x.Command));

            // Ensure an entry point for the "run" command exists
            var mainEntryPoint = GetEntryPoint();

            if (mainEntryPoint == null)
            {
                EntryPoints.Add(mainEntryPoint = new EntryPoint {
                    Names = { Name }, Command = Command.NameRun
                });
            }

            // Copy the needs-terminal flag from the feed to the main entry point if present
            if (NeedsTerminal)
            {
                mainEntryPoint.NeedsTerminal = true;
            }
        }
Пример #10
0
        /// <summary>
        /// Flattens the <see cref="Group"/> inheritance structure and sets missing default values in <see cref="Implementation"/>s.
        /// </summary>
        /// <param name="feedUri">The feed the data was originally loaded from.</param>
        /// <exception cref="InvalidDataException">One or more required fields are not set.</exception>
        /// <remarks>This method should be called to prepare a <see cref="Feed"/> for solver processing. Do not call it if you plan on serializing the feed again since it may loose some of its structure.</remarks>
        public void Normalize([NotNull] FeedUri feedUri)
        {
            #region Sanity checks
            if (feedUri == null)
            {
                throw new ArgumentNullException(nameof(feedUri));
            }
            #endregion

            if (Name == null)
            {
                throw new InvalidDataException(string.Format(Resources.MissingNameTagInFeed, feedUri));
            }

            // Apply if-0install-version filter
            Elements.RemoveAll(FeedElement.FilterMismatch);
            Icons.RemoveAll(FeedElement.FilterMismatch);
            Categories.RemoveAll(FeedElement.FilterMismatch);
            Feeds.RemoveAll(FeedElement.FilterMismatch);
            FeedFor.RemoveAll(FeedElement.FilterMismatch);
            EntryPoints.RemoveAll(FeedElement.FilterMismatch);

            foreach (var icon in Icons)
            {
                icon.Normalize();
            }
            foreach (var feedReference in Feeds)
            {
                feedReference.Normalize();
            }
            foreach (var interfaceReference in FeedFor)
            {
                interfaceReference.Normalize();
            }

            NormalizeElements(feedUri);
            NormalizeEntryPoints();
        }
Пример #11
0
        public HLSLBlur(Device device, BlurPass pass, string effectFilePath)
            : base(device, effectFilePath, VertexPosition2Texture.VertexDeclaration, null)
        {
            //Create Constant Buffers interfaces
            CBPerDraw = ToDispose(new CBuffer <CBPerDraw_Struct>(device, "PerDraw"));
            CBuffers.Add(CBPerDraw);

            //Create the resource interfaces ==================================================
            SpriteTexture = new ShaderResource("SpriteTexture");
            ShaderResources.Add(SpriteTexture);

            //Create the Sampler interface ==================================================
            SpriteSampler = new ShaderSampler("SpriteSampler");
            ShaderSamplers.Add(SpriteSampler);

            //Load the shaders
            switch (pass)
            {
            case BlurPass.Horizontal:
                _shadersEntryPoint = new EntryPoints()
                {
                    VertexShader_EntryPoint = "VS",
                    PixelShader_EntryPoint  = "PS_BlurHorizontal"
                };
                break;

            case BlurPass.Vertical:
                _shadersEntryPoint = new EntryPoints()
                {
                    VertexShader_EntryPoint = "VS",
                    PixelShader_EntryPoint  = "PS_BlurVertical"
                };
                break;
            }
            base.LoadShaders(_shadersEntryPoint);
        }
        public HLSLVoxelModelInstancedShadow(Device device, string shaderPath, VertexDeclaration VertexDeclaration, EntryPoints shadersEntryPoint = null)
            : base(device, shaderPath, VertexDeclaration, null)
        {
            //Create Constant Buffers interfaces ==================================================
            CBPerDraw = ToDispose(new CBuffer <CBPerDraw_Struct>(device, "PerDrawShadow"));
            CBuffers.Add(CBPerDraw);

            //Load the shaders
            base.LoadShaders(shadersEntryPoint == null ? _shadersEntryPoint : shadersEntryPoint);
        }
Пример #13
0
        //- Operation methods
        public bool ShowArea(IPlayer player, string entryPoint = "deafult")// Dictionary<Keys, Tuple<ColisionResponce, string[]>> playerActions, string entryPoint = "deafult")
        {
            if (EntryPoints == null)
            {
                throw new InvalidOperationException("No entry points have been defined. An area must have at least one entry point defined.");
            }
            if (EntryPoints.ContainsKey("entryPoint"))
            {
                throw new InvalidOperationException("The entry point provided dosen't exist.");
            }
            if (Entities.ContainsKey(player.Name))
            {
                throw new ArgumentException("An entity with the same name allready exists.");
            }

            //- Add the player entity
            PlayerName = player.Name;
            AddEntity(player, EntryPoints[entryPoint]);

            //- Add subscriptions to host events
            Host.KeyPress += ((IPlayer)Entities[PlayerName]).OnKeyPressed;

            //- Make the area the focus
            Focus = true;

            //- Make this area's entities active
            foreach (KeyValuePair <string, IEntity> entity in Entities)
            {
                entity.Value.Active = true;
            }

            //- Draw the area on the console
            List <Tuple <int[], int[]> > positions = new List <Tuple <int[], int[]> >();

            for (int i = 0; i < Grid.GetLength(0); i++)
            {
                for (int j = 0; j < Grid.GetLength(1); j++)
                {
                    positions.Add(new Tuple <int[], int[]>(new int[2] {
                        i, j
                    }, null));
                }
            }
            UpdateDisplay(positions);

            //- Create the player and NPC threads
            //ControllPlayerThread = new System.Threading.Thread(new System.Threading.ThreadStart(((IPlayer)Entities[PlayerName]).ControllPlayer));

            ControllNPCThreads = new List <System.Threading.Thread>();

            foreach (KeyValuePair <string, IEntity> entity in Entities)
            {
                if (entity.Value is INpc)
                {
                    ControllNPCThreads.Add(new System.Threading.Thread(new System.Threading.ThreadStart(((INpc)entity.Value).ControllEntity)));
                }
            }

            //- Start the threads
            //ControllPlayerThread.Start();

            foreach (System.Threading.Thread thread in ControllNPCThreads)
            {
                thread.IsBackground = true;// Kills the threads when the player thread terminates
                thread.Start();
            }

            return(true);
        }
Пример #14
0
        public HLSLUtopiaPointSprite3DText(Device device, string shaderPath, VertexDeclaration VertexDeclaration, iCBuffer CBPerFrame, Include includeHandler, EntryPoints shadersEntryPoint = null)
            : base(device, shaderPath, VertexDeclaration, includeHandler)
        {
            //Create Constant Buffers interfaces ==================================================
            CBuffers.Add(CBPerFrame.Clone());

            //Create the resource interfaces ==================================================
            DiffuseTexture = new ShaderResource("DiffuseTexture");
            ShaderResources.Add(DiffuseTexture);

            //Create the Sampler interface ==================================================
            SamplerDiffuse = new ShaderSampler("SamplerDiffuse");
            ShaderSamplers.Add(SamplerDiffuse);

            //Load the shaders
            base.LoadShaders(shadersEntryPoint == null ? _shadersEntryPoint : shadersEntryPoint);
        }
Пример #15
0
        public HLSLVoxelModelInstanced(Device device, string shaderPath, VertexDeclaration VertexDeclaration, EntryPoints shadersEntryPoint = null)
            : base(device, shaderPath, VertexDeclaration, null)
        {
            //Create Constant Buffers interfaces ==================================================
            CBPerFrame = ToDispose(new CBuffer <CBPerFrameStructure>(device, "VoxelModelPerFrame"));
            CBuffers.Add(CBPerFrame);

            CBPerModel = ToDispose(new CBuffer <CBPerModelStructure>(device, "VoxelModel", true));
            CBuffers.Add(CBPerModel);

            ShadowMap = new ShaderResource("ShadowMap");
            ShaderResources.Add(ShadowMap);

            SamplerBackBuffer = new ShaderSampler("SamplerBackBuffer");
            ShaderSamplers.Add(SamplerBackBuffer);

            //Load the shaders
            base.LoadShaders(shadersEntryPoint == null ? _shadersEntryPoint : shadersEntryPoint);
        }
Пример #16
0
        public HLSLLiquid(Device device, string shaderPath, VertexDeclaration VertexDeclaration, iCBuffer CBPerFrame = null, EntryPoints shadersEntryPoint = null)
            : base(device, shaderPath, VertexDeclaration, new UtopiaIncludeHandler())
        {
            //Create Constant Buffers interfaces ==================================================
            CBPerDraw = ToDispose(new CBuffer <CBPerDraw_Struct>(device, "PerDraw"));
            CBuffers.Add(CBPerDraw);

            if (CBPerFrame != null)
            {
                CBuffers.Add(CBPerFrame.Clone());
            }

            //Create the resource interfaces ==================================================
            TerraTexture = new ShaderResource("TerraTexture");
            ShaderResources.Add(TerraTexture);

            SolidBackBuffer = new ShaderResource("SolidBackBuffer");
            ShaderResources.Add(SolidBackBuffer);

            SkyBackBuffer = new ShaderResource("SkyBackBuffer");
            ShaderResources.Add(SkyBackBuffer);

            BiomesColors = new ShaderResource("BiomesColors");
            ShaderResources.Add(BiomesColors);

            AnimatedTextures = new ShaderResource("AnimatedTextures");
            ShaderResources.Add(AnimatedTextures);

            //Create the Sampler interface ==================================================
            SamplerDiffuse = new ShaderSampler("SamplerDiffuse");
            ShaderSamplers.Add(SamplerDiffuse);

            SamplerBackBuffer = new ShaderSampler("SamplerBackBuffer");
            ShaderSamplers.Add(SamplerBackBuffer);

            SamplerOverlay = new ShaderSampler("SamplerOverlay");
            ShaderSamplers.Add(SamplerOverlay);

            //Load the shaders
            base.LoadShaders(shadersEntryPoint == null ? _shadersEntryPoint : shadersEntryPoint);
        }
Пример #17
0
 static IApp GetApp(EntryPoints app) => app switch
 {
Пример #18
0
        public SpirV(Stream stream)
        {
            using (var br = new BinaryReader(stream))
            {
                // Word 0; file magic
                var magic = br.ReadUInt32();
                if (magic != SpirVMagic)
                {
                    throw new InvalidDataException("File magic was incorrect");
                }

                // Word 1; version number
                br.ReadByte();
                VersionMinor = br.ReadByte();
                VersionMajor = br.ReadByte();
                br.ReadByte();

                // Word 2; generator magic
                GeneratorMagic = br.ReadUInt32();

                // Word 3; bound IDs where 0 < ID < this
                Bound = br.ReadInt32();

                // Word 4; optional instruction schema
                br.ReadInt32();

                // Word 5 and beyond; instructions
                Instructions = new List <Instruction>();
                while (stream.Position < stream.Length)
                {
                    var        inst = new Instruction(br);
                    string     sA;
                    int        iA;
                    List <int> lA;
                    switch (inst.OpCode)
                    {
                    case OpCodeID.Capability:
                        Capabilities.Add((Capability)inst[1]);
                        break;

                    case OpCodeID.Extension:
                        Extensions.Add(inst.String(1));
                        break;

                    case OpCodeID.ExtInstImport:
                        ExtInstImports.Add(inst[1], inst.String(2));
                        break;

                    case OpCodeID.MemoryModel:
                        MemoryModel = (MemoryModel)inst[1];
                        break;

                    case OpCodeID.EntryPoint:
                        sA = inst.String(3, out iA);
                        lA = new List <int>();
                        for (var i = iA; i < inst.Length; i++)
                        {
                            lA.Add(inst[i]);
                        }
                        EntryPoints.Add(new EntryPoint((ExecutionModel)inst[1], inst[2], sA, lA));
                        break;

                    case OpCodeID.ExecutionMode:
                        ExecutionModes.Add(inst[1], (ExecutionMode)inst[2]);
                        break;

                    case OpCodeID.Name:
                        Names.Add(inst[1], inst.String(2));
                        MemberNames.Add(inst[1], new Dictionary <int, string>());
                        break;

                    case OpCodeID.MemberName:
                        MemberNames[inst[1]].Add(inst[2], inst.String(3));
                        break;

                    default:
                        Instructions.Add(new Instruction(br));
                        break;
                    }
                }
            }
        }
Пример #19
0
        public HLSLColorLine(Device engine, string shaderPath, VertexDeclaration VertexDeclaration, EntryPoints shadersEntryPoint = null)
            : base(engine, shaderPath, VertexDeclaration, null)
        {
            //Create Constant Buffers interfaces ==================================================
            CBPerDraw = new CBuffer <CBPerDrawStructure>(engine, "PerDraw");
            CBuffers.Add(CBPerDraw);

            //Load the shaders
            base.LoadShaders(shadersEntryPoint == null ? _shadersEntryPoint : shadersEntryPoint);
        }
Пример #20
0
        public HLSLGhost(Device device, string shaderPath, VertexDeclaration VertexDeclaration, EntryPoints shadersEntryPoint = null)
            : base(device, shaderPath, VertexDeclaration, new UtopiaIncludeHandler())
        {
            //Create Contstant Buffers interfaces ==================================================
            CBPerDraw = ToDispose(new CBuffer <CBPerDrawStructure>(device, "PerDraw"));
            CBuffers.Add(CBPerDraw);

            //Create the resource interfaces ==================================================
            PostEffectBackBuffer = new ShaderResource("PostEffectBackBuffer");
            ShaderResources.Add(PostEffectBackBuffer);

            //Create the Sampler interface ==================================================
            SamplerPostEffectBackBuffer = new ShaderSampler("SamplerPostEffectBackBuffer");
            ShaderSamplers.Add(SamplerPostEffectBackBuffer);

            //Load the shaders
            base.LoadShaders(shadersEntryPoint == null ? _shadersEntryPoint : shadersEntryPoint);
        }
Пример #21
0
        public HLSLCubeColorParticule(Device device, string shaderPath, VertexDeclaration VertexDeclaration, iCBuffer CBPerFrame, Include includeHandler, EntryPoints shadersEntryPoint = null)
            : base(device, shaderPath, VertexDeclaration, includeHandler)
        {
            //Create Constant Buffers interfaces ==================================================
            CBuffers.Add(CBPerFrame.Clone());

            //Load the shaders
            base.LoadShaders(shadersEntryPoint == null ? _shadersEntryPoint : shadersEntryPoint);
        }
Пример #22
0
        public HLSLStaticEntitySprite(Device device, string shaderPath, VertexDeclaration VertexDeclaration, iCBuffer CBPerFrame = null, EntryPoints shadersEntryPoint = null)
            : base(device, shaderPath, VertexDeclaration, new UtopiaIncludeHandler())
        {
            //Create Constant Buffers interfaces ==================================================
            CBPerFrameLocal = ToDispose(new CBuffer <CBPerFrame_Struct>(device, "PerFrameLocal"));
            CBuffers.Add(CBPerFrameLocal);

            if (CBPerFrame != null)
            {
                CBuffers.Add(CBPerFrame.Clone());
            }

            //Create the resource interfaces ==================================================
            DiffuseTexture = new ShaderResource("DiffuseTexture");
            ShaderResources.Add(DiffuseTexture);

            BiomesColors = new ShaderResource("BiomesColors");
            ShaderResources.Add(BiomesColors);

            //Create the Sampler interface ==================================================
            SamplerDiffuse = new ShaderSampler("SamplerDiffuse");
            ShaderSamplers.Add(SamplerDiffuse);

            //Load the shaders
            base.LoadShaders(shadersEntryPoint == null ? _shadersEntryPoint : shadersEntryPoint);
        }
Пример #23
0
        public HLSLVoxelModel(Device device, string shaderPath, VertexDeclaration VertexDeclaration, EntryPoints shadersEntryPoint = null)
            : base(device, shaderPath, VertexDeclaration, null)
        {
            //Create Constant Buffers interfaces ==================================================
            CBPerFrame = ToDispose(new CBuffer <CBPerFrameStructure>(device, "VoxelModelPerFrame"));
            CBuffers.Add(CBPerFrame);

            CBPerModel = ToDispose(new CBuffer <CBPerModelStructure>(device, "VoxelModel", true));
            CBuffers.Add(CBPerModel);

            CBPerPart = ToDispose(new CBuffer <CBPerPartStructure>(device, "VoxelModelPerPart"));
            CBuffers.Add(CBPerPart);

            //Load the shaders
            base.LoadShaders(shadersEntryPoint == null ? _shadersEntryPoint : shadersEntryPoint);
        }
Пример #24
0
 /// <inheritdoc/>
 public bool Equals(Feed other)
 {
     if (other == null)
     {
         return(false);
     }
     if (!base.Equals(other))
     {
         return(false);
     }
     if (MinInjectorVersion != other.MinInjectorVersion)
     {
         return(false);
     }
     if (Uri != other.Uri)
     {
         return(false);
     }
     if (Name != other.Name)
     {
         return(false);
     }
     if (!Summaries.SequencedEquals(other.Summaries))
     {
         return(false);
     }
     if (!Descriptions.SequencedEquals(other.Descriptions))
     {
         return(false);
     }
     if (Homepage != other.Homepage)
     {
         return(false);
     }
     if (NeedsTerminal != other.NeedsTerminal)
     {
         return(false);
     }
     if (!Feeds.SequencedEquals(other.Feeds))
     {
         return(false);
     }
     if (!Categories.SequencedEquals(other.Categories))
     {
         return(false);
     }
     if (!Icons.SequencedEquals(other.Icons))
     {
         return(false);
     }
     if (!Elements.SequencedEquals(other.Elements))
     {
         return(false);
     }
     if (!EntryPoints.SequencedEquals(other.EntryPoints))
     {
         return(false);
     }
     if (!CapabilityLists.SequencedEquals(other.CapabilityLists))
     {
         return(false);
     }
     return(true);
 }
Пример #25
0
 public void RegisterEntryPoint(EntryPoint ep)
 {
     EntryPoints.Add(ep);
 }
Пример #26
0
        /// <summary>
        /// Gets the room coordinates for specified entry points.
        /// </summary>
        /// <param name="room"></param>
        /// <returns></returns>
        public static Vector3 getRoomCoords(EntryPoints room)
        {
            int enumAsInt = (int)room;

            return(coords[enumAsInt]);
        }
Пример #27
0
        public HLSLLoadingCube(Device device, string shaderPath, VertexDeclaration VertexDeclaration, EntryPoints shadersEntryPoint = null)
            : base(device, shaderPath, VertexDeclaration, null)
        {
            //Create Constant Buffers interfaces ==================================================
            CBPerDraw = ToDispose(new CBuffer <CBPerDraw_Struct>(device, "PerDraw"));
            CBuffers.Add(CBPerDraw);

            CBPerFrame = ToDispose(new CBuffer <CBPerFrame_Struct>(device, "PerFrame"));
            CBuffers.Add(CBPerFrame);

            //Create the resource interfaces ==================================================

            //Create the Sampler interface ==================================================

            //Load the shaders
            base.LoadShaders(shadersEntryPoint == null ? _shadersEntryPoint : shadersEntryPoint);
        }
Пример #28
0
        public HLSLCubeTool(Device device, string shaderPath, VertexDeclaration VertexDeclaration, EntryPoints shadersEntryPoint = null)
            : base(device, shaderPath, VertexDeclaration, null)
        {
            //Create Constant Buffers interfaces ==================================================
            CBPerDraw = ToDispose(new CBuffer <CBPerDraw_Struct>(device, "PerDraw"));
            CBuffers.Add(CBPerDraw);

            //Create the resource interfaces ==================================================
            DiffuseTexture = new ShaderResource("DiffuseTexture");
            ShaderResources.Add(DiffuseTexture);

            //Create the Sampler interface ==================================================
            SamplerDiffuse = new ShaderSampler("SamplerDiffuse");
            ShaderSamplers.Add(SamplerDiffuse);

            //Load the shaders
            base.LoadShaders(shadersEntryPoint == null ? _shadersEntryPoint : shadersEntryPoint);
        }
Пример #29
0
        public HLSLTerranShadow(Device device, string shaderPath, VertexDeclaration VertexDeclaration, iCBuffer CBPerFrame = null, EntryPoints shadersEntryPoint = null)
            : base(device, shaderPath, VertexDeclaration, new UtopiaIncludeHandler())
        {
            //Create Contstant Buffers interfaces ==================================================
            CBPerDraw = ToDispose(new CBuffer <CBPerDraw_Struct>(device, "PerDrawShadow"));
            CBuffers.Add(CBPerDraw);

            //Load the shaders
            base.LoadShaders(shadersEntryPoint == null ? _shadersEntryPoint : shadersEntryPoint);
        }
Пример #30
0
    public bool UpdatePath(Vector3 dir)
    {
        //Find next tile
        Vector3 origin = transform.position;

#if TwoD
        RaycastHit2D[] hits = Physics2D.RaycastAll(origin, dir, 0.5f, TileFinderMask);
        //foreach (var thing in hits) Debug.Log(thing);
#else
        RaycastHit[] hits = Physics.RaycastAll(origin, Vector3.back, 0.5f, TileFinderMask);
#endif
        foreach (var hit in hits)
        {
            if (hit.collider != null && hit.collider.gameObject != this.gameObject && hit.collider.gameObject != parentTile.gameObject)
            {
#if DEBUG
                //Debug.Log("Found");
#endif
                Tile oldTile = parentTile;

                GameObject obj = hit.collider.gameObject;
                parentTile = obj.GetComponent <Tile>();

                bool        contains = false;
                EntryPoints entry    = Tile.FlipEntryPoints(Exit);
                foreach (var en in parentTile.Entries)
                {
                    if (en == entry)
                    {
                        contains = true;
                    }
                }

                if (contains)
                {
                    RaycastHit2D checkHits = Physics2D.BoxCast(transform.position, new Vector2(0.25f, 0.25f), 0, Vector2.zero, 0, KiwiFinderMask);
                    if (checkHits.collider != null && checkHits.collider.gameObject != this.gameObject)
                    {
                        Debug.Log("Returning false");
                        return(false);
                    }

                    if (parentTile.Entries[0] == entry)
                    {
                        this.Exit = parentTile.Entries[1];
                    }
                    else if (parentTile.Entries[1] == entry)
                    {
                        this.Exit = parentTile.Entries[0];
                    }

                    //Debug.Log("Contains");
                    transform.parent = obj.transform;

                    List <Vector3> src = parentTile.Path;//parentTile.GetPath(transform.position);
                    Path = new List <Vector3>(src.Count);

                    for (int i = 0; i < src.Count; ++i)
                    {
                        Path.Add(src[i]);
                    }

                    if ((Path[0] - transform.localPosition).sqrMagnitude > (Path[Path.Count - 1] - transform.localPosition).sqrMagnitude)
                    {
                        FlipPath = true;
                        //Flip the path because we are coming from the other direction
                        for (int i = 0; i < Path.Count / 2; ++i)
                        {
                            Vector3 vec = Path[i];
                            Path[i] = Path[Path.Count - 1 - i];
                            Path[Path.Count - 1 - i] = vec;
                        }
                    }

                    transform.localPosition = Path[0];
                    //Debug.Log(Path[0]);

                    next = 1;

                    //foreach (var o in Path) Debug.Log(o);
                    return(true);
                }
                else
                {
                    parentTile = oldTile;
                }
                return(false);
            }
        }
        return(false);
    }