コード例 #1
0
        /// <summary>Sync the values of the Item and Original Object if they have the Material & Mesh Changer </summary>
        protected virtual void Sync_Material_ActiveMeshes()
        {
            if (Last_SpawnedItem)
            {
                MaterialChanger OriginalMC = Last_SpawnedItem.GetComponent <MaterialChanger>();
                MaterialChanger ItemSelMC  = ItemSelected.GetComponent <MaterialChanger>();

                if (OriginalMC && ItemSelMC)
                {
                    for (int i = 0; i < ItemSelMC.materialList.Count; i++)
                    {
                        OriginalMC.SetMaterial(i, ItemSelMC.CurrentMaterialIndex(i)); //Set the Materials from the Item to the Original
                    }
                }

                ActiveMeshes OriginalAM = Last_SpawnedItem.GetComponent <ActiveMeshes>();
                ActiveMeshes ItemSelAM  = ItemSelected.GetComponent <ActiveMeshes>();

                if (OriginalAM && ItemSelAM)
                {
                    for (int i = 0; i < ItemSelAM.Count; i++)
                    {
                        OriginalAM.ChangeMesh(i, ItemSelAM.GetActiveMesh(i).Current); //Set the Meshes from the Item to the Original
                    }
                }
            }
        }
コード例 #2
0
ファイル: ChunkModule.cs プロジェクト: jdc20181/OpenCraft
        public void Update(GameTime gameTime)
        {
            var  any = false;
            Mesh _mesh;

            while (IncomingChunks.TryTake(out _mesh))
            {
                any = true;
                var mesh = _mesh as ChunkMesh;
                if (ActiveMeshes.Contains(mesh.Chunk.Coordinates))
                {
                    int existing = ChunkMeshes.FindIndex(m => m.Chunk.Coordinates == mesh.Chunk.Coordinates);
                    ChunkMeshes[existing] = mesh;
                }
                else
                {
                    ActiveMeshes.Add(mesh.Chunk.Coordinates);
                    ChunkMeshes.Add(mesh);
                }
            }
            if (any)
            {
                Game.FlushMainThreadActions();
            }
            WorldLighting.TryLightNext();
        }
コード例 #3
0
ファイル: ChunkModule.cs プロジェクト: jdc20181/OpenCraft
 void UnloadChunk(ReadOnlyChunk chunk)
 {
     Game.Invoke(() =>
     {
         ActiveMeshes.Remove(chunk.Coordinates);
         ChunkMeshes.RemoveAll(m => m.Chunk.Coordinates == chunk.Coordinates);
     });
 }
コード例 #4
0
    private void Start()
    {
        btnAdd.onClick.AddListener(delegate() { BtnClick(btnAdd); });
        btnDelete.onClick.AddListener(delegate() { BtnClick(btnDelete); });
        btnGo.onClick.AddListener(delegate() { BtnClick(btnGo); });
        GameObject playerObj = GameObject.FindGameObjectWithTag("Player").transform.root.gameObject;

        mesh     = GameObject.FindGameObjectWithTag("Player").GetComponent <ActiveMeshes>();
        material = GameObject.FindGameObjectWithTag("Player").GetComponent <MaterialChanger>();
    }
コード例 #5
0
 private void Init(object param)
 {
     cellIndex = (int)param;
     index     = 0;
     btnUp.gameObject.SetActive(false);
     btnNext.gameObject.SetActive(true);
     btnFinish.gameObject.SetActive(false);
     windows[0].SetActive(true);
     for (int i = 1; i < 5; i++)
     {
         windows[i].SetActive(false);
     }
     deer     = GameObject.FindGameObjectWithTag("Player");
     mesh     = deer.GetComponent <ActiveMeshes>();
     material = deer.GetComponent <MaterialChanger>();
 }