Наследование: GenericNode, IShellNode
Пример #1
0
        private IEnumerable <ShellNode> ShellModelToNodes(ShellPageModel shellPageModel, string villageName)
        {
            List <ShellNode> nodes = new List <ShellNode>();
            int count = shellPageModel.Floors.Count();

            for (int i = 0; i < count; i++)
            {
                ShellNode node = new ShellNode();
                node.VillageName  = villageName;
                node.Position     = shellPageModel.Positions[i];
                node.Floor        = shellPageModel.Floors[i];
                node.Orientation  = shellPageModel.Orientations[i];
                node.Price        = shellPageModel.Prices[i];
                node.Title        = shellPageModel.Titles[i];
                node.AreaNumber   = shellPageModel.AreaNumbers[i];
                node.AreaStr      = shellPageModel.AreaStrings[i];
                node.FollowDay    = shellPageModel.FollowDays[i];
                node.FollowNumber = shellPageModel.FollowNumbers[i];
                node.UnitPrice    = shellPageModel.UnitPrices[i];
                node.YearInfo     = shellPageModel.YearInfos[i];
                node.CrawlDate    = DateTime.Now;
                node.LinkUrl      = shellPageModel.LinkUrls[i];
                nodes.Add(node);
            }

            return(nodes);
        }
    public void setupModel()
    {
        n                = new ShellNode[resolutionX, resolutionZ];
        srfMeshPoints    = new Vector3[resolutionX * resolutionZ];
        srfMeshTriangles = new int[(resolutionX - 1) * (resolutionZ - 1) * 6];

        float dx = (x1 - x0) / (resolutionX - 1.0f);
        float dy = (z1 - z0) / (resolutionZ - 1.0f);

        for (int j = 0; j < resolutionZ; ++j)
        {
            for (int i = 0; i < resolutionX; ++i)
            {
                float x = x0 + i * dx;
                float z = z0 + j * dy;

                n[i, j]    = new ShellNode();
                n[i, j].p  = new Vector3(x, meshDefautlElevation, z);
                n[i, j].p0 = n[i, j].p;

                srfMeshPoints[j * resolutionX + i] = n[i, j].p;
            }
        }

        int k = 0;

        for (int j = 0; j < resolutionZ - 1; ++j)
        {
            for (int i = 0; i < resolutionX - 1; ++i)
            {
                {
                    int n0 = j * resolutionX + i;


                    srfMeshTriangles[k++] = n0;
                    srfMeshTriangles[k++] = n0 + 1 + resolutionX;
                    srfMeshTriangles[k++] = n0 + 1;

                    srfMeshTriangles[k++] = n0;
                    srfMeshTriangles[k++] = n0 + resolutionX;
                    srfMeshTriangles[k++] = n0 + resolutionX + 1;
                }
            }
        }

        //mesh functions
        srfMesh           = new Mesh();
        srfMesh.name      = "interactiveMesh";
        srfMesh.vertices  = srfMeshPoints;
        srfMesh.triangles = srfMeshTriangles;
        MeshFilter mf = GetComponent <MeshFilter>();

        //  mf.mesh = vizmesh;
        mf.sharedMesh = srfMesh;

        MeshCollider mc = GetComponent <MeshCollider>();

        mc.sharedMesh = srfMesh;
    }
        public void BuildShell(BuildWeaponShellEvent e, ShellNode shell)
        {
            GameObject shellInstance = this.CreateInstance(shell.resourceData);

            shellInstance.SetActive(true);
            if (shell.Entity.HasComponent <ShellInstanceComponent>())
            {
                shell.Entity.GetComponent <ShellInstanceComponent>().ShellInstance = shellInstance;
            }
            else
            {
                shell.Entity.AddComponent(new ShellInstanceComponent(shellInstance));
            }
        }
Пример #4
0
        private BsonDocument ShellModeToBsonDocument(ShellNode shellNode)
        {
            BsonDocument document = BsonDocument.Parse(shellNode.ToJson());

            return(document);
        }
 public void BuildShell(NodeAddedEvent evt, [Combine] ShellNode shell, SingleNode <MapInstanceComponent> map)
 {
     base.NewEvent <BuildWeaponShellEvent>().Attach(shell).ScheduleDelayed(0.3f);
 }