Ejemplo n.º 1
0
    // 入れた矢印の向きに応じて「コライダーを表示」、「矢印のテクスチャを取得」、「移動後の位置を取得」するメソッド
    void SetUpdateTexture()
    {
        if (MainTexture == RightTexture && !Right)
        {
            ColSwitchOff();
            RightCol.SetActive(true);
            UpdateMaterial.GetComponent <Renderer>().material = PlayerMaterial.GetComponent <Renderer>().material;
            return;
        }

        if (MainTexture == LeftTexture && !Left)
        {
            ColSwitchOff();
            LeftCol.SetActive(true);
            UpdateMaterial.GetComponent <Renderer>().material = PlayerMaterial.GetComponent <Renderer>().material;
            return;
        }

        if (MainTexture == UpTexture && !Up)
        {
            ColSwitchOff();
            UpCol.SetActive(true);
            UpdateMaterial.GetComponent <Renderer>().material = PlayerMaterial.GetComponent <Renderer>().material;
            return;
        }

        if (MainTexture == DownTexture && !Down)
        {
            ColSwitchOff();
            DownCol.SetActive(true);
            UpdateMaterial.GetComponent <Renderer>().material = PlayerMaterial.GetComponent <Renderer>().material;
            return;
        }
    }
Ejemplo n.º 2
0
        public object Put(UpdateMaterial request)
        {
            var entity = request.ConvertTo <Material>();

            return(InTransaction(db =>
            {
                Logic.Update(entity);
                return new CommonResponse(Logic.GetById(entity.Id));
            }));
        }
Ejemplo n.º 3
0
    // Update is called once per frame
    void Update()
    {
        // if player started game
        if (StartMiniGame.get.m_StartGame)
        {
            // still has playtime, spawn an obstacle every m_SpawnInterval
            if (m_currentSpawnInterval >= m_SpawnInterval && m_GameTime >= 0)
            {
                HandleMiniGame();
                m_currentSpawnInterval = 0;
            }

            m_GameTime -= Time.deltaTime;
        }

        m_currentSpawnInterval += Time.deltaTime;

        // if game is over
        if (m_GameTime < 0 && !m_gameOver)
        {
            StartMiniGame.get.m_IngameHUD.SetActive(false);
            StartMiniGame.get.m_EndGameScreen.SetActive(true);

            if (MaterialPlayerScript.get.m_MaterialsGathered >= 25)
            {
                StartMiniGame.get.m_EndGameText.text = $"Congrats! You caught {MaterialPlayerScript.get.m_MaterialsGathered} Items!\nYou received 2 Materials, that have been added to your inventory!";

                UpdateMaterial.UpdateResourcesForCurrentSelectedCharacter(2);
            }
            else if (MaterialPlayerScript.get.m_MaterialsGathered >= 15)
            {
                StartMiniGame.get.m_EndGameText.text = $"Congrats! You caught {MaterialPlayerScript.get.m_MaterialsGathered} Items!\nYou received 1 Material, that has been added to your inventory!";

                UpdateMaterial.UpdateResourcesForCurrentSelectedCharacter(1);
            }
            else
            {
                StartMiniGame.get.m_EndGameText.text = $"You didn't catch enough Items!\nTry again next time.";
            }

            m_gameOver = true;
        }
        else
        {
            StartMiniGame.get.m_CountdownText.text = ((int)m_GameTime).ToString();
        }
    }
Ejemplo n.º 4
0
    // Update is called once per frame
    void Update()
    {
        if (!m_GameOver)
        {
            // update enemy health
            m_EnemyHealthText.text = ExperienceEnemy.get.m_EnemyHealth.ToString();
            if (ExperienceEnemy.get.m_EnemyHealth <= 0)
            {
                ExperienceEnemy.get.m_EnemyAnimator.SetBool("IsDead", true);
            }

            // if player is dead
            if (m_PlayerHealth <= 0)
            {
                m_GameOver = true;

                StartMiniGame.get.m_EndGameScreen.SetActive(true);
                StartMiniGame.get.m_EndGameText.text = "You couldn't beat the Boss this time..\nTry again another time!";
            }
            // player won without getting hit
            else if (ExperienceEnemy.get.m_EnemyHealth <= 0 && m_PlayerHealth == 3)
            {
                m_GameOver = true;

                StartMiniGame.get.m_EndGameScreen.SetActive(true);
                StartMiniGame.get.m_EndGameText.text = $"Congrats! You defeated the Boss!\nYour Character earned 250 Experience!";

                UpdateMaterial.UpdateExperience(250);
            }
            // player won
            else if (ExperienceEnemy.get.m_EnemyHealth <= 0 && m_PlayerHealth > 0)
            {
                m_GameOver = true;

                StartMiniGame.get.m_EndGameScreen.SetActive(true);
                StartMiniGame.get.m_EndGameText.text = $"Congrats! You defeated the Boss!\nYour Character earned 125 Experience!";

                UpdateMaterial.UpdateExperience(125);
            }
        }
    }
Ejemplo n.º 5
0
    void SetUpdateTexture()
    {
        if (MainTexture == RightTexture && !Right)
        {
            ColSwitchOff();
            RightCol.SetActive(true);
            RotateModel.transform.rotation = Quaternion.Euler(0f, 0f, 0f);
            UpdateMaterial.GetComponent <Renderer>().material = PlayerMaterial.GetComponent <Renderer>().material;
            return;
        }

        if (MainTexture == LeftTexture && !Left)
        {
            ColSwitchOff();
            LeftCol.SetActive(true);
            RotateModel.transform.rotation = Quaternion.Euler(0f, 180f, 0f);
            UpdateMaterial.GetComponent <Renderer>().material = PlayerMaterial.GetComponent <Renderer>().material;
            return;
        }

        if (MainTexture == UpTexture && !Up)
        {
            ColSwitchOff();
            UpCol.SetActive(true);
            RotateModel.transform.rotation = Quaternion.Euler(0f, 270f, 0f);
            UpdateMaterial.GetComponent <Renderer>().material = PlayerMaterial.GetComponent <Renderer>().material;
            return;
        }

        if (MainTexture == DownTexture && !Down)
        {
            ColSwitchOff();
            DownCol.SetActive(true);
            RotateModel.transform.rotation = Quaternion.Euler(0f, 90f, 0f);
            UpdateMaterial.GetComponent <Renderer>().material = PlayerMaterial.GetComponent <Renderer>().material;
            return;
        }
    }
Ejemplo n.º 6
0
        static void ProcessUpdateMaterial(string caption, float scriptVersion, UpdateMaterial updateMaterial, UpdateMaterialFile updateMaterialFile = null)
        {
            bool          VCSEnabled    = (UnityEditor.VersionControl.Provider.enabled && UnityEditor.VersionControl.Provider.isActive);
            var           matIds        = AssetDatabase.FindAssets("t:Material");
            List <string> materialFiles = new List <string>(); // Contain the list dirty files

            try
            {
                for (int i = 0, length = matIds.Length; i < length; i++)
                {
                    var path = AssetDatabase.GUIDToAssetPath(matIds[i]);
                    var mat  = AssetDatabase.LoadAssetAtPath <Material>(path);

                    EditorUtility.DisplayProgressBar(
                        "Update material " + caption + "...",
                        string.Format("{0} / {1} materials updated.", i, length),
                        i / (float)(length - 1));

                    bool isHDRPShader = mat.shader.name == "HDRP/LitTessellation" ||
                                        mat.shader.name == "HDRP/Lit" ||
                                        mat.shader.name == "HDRP/LayeredLit" ||
                                        mat.shader.name == "HDRP/LayeredLitTessellation" ||
                                        mat.shader.name == "HDRP/StackLit" ||
                                        mat.shader.name == "HDRP/Unlit" ||
                                        mat.shader.name == "HDRP/Fabric" ||
                                        mat.shader.name == "HDRP/Decal" ||
                                        mat.shader.name == "HDRP/TerrainLit";

                    if (mat.shader.IsShaderGraph())
                    {
                        var outputNodeType = GraphUtil.GetOutputNodeType(AssetDatabase.GetAssetPath(mat.shader));

                        isHDRPShader |= outputNodeType == typeof(HDUnlitMasterNode);
                        isHDRPShader |= outputNodeType == typeof(HDLitMasterNode);
                        isHDRPShader |= outputNodeType == typeof(HairMasterNode);
                        isHDRPShader |= outputNodeType == typeof(FabricMasterNode);
                        isHDRPShader |= outputNodeType == typeof(StackLitMasterNode);
                    }

                    if (isHDRPShader)
                    {
                        // We don't handle embed material as we can't rewrite fbx files
                        if (Path.GetExtension(path).ToLower() == ".fbx")
                        {
                            continue;
                        }

                        bool dirty = updateMaterial(path, mat);

                        // Checkout the file and tag it as dirty
                        if (dirty)
                        {
                            CoreEditorUtils.CheckOutFile(VCSEnabled, mat);
                            EditorUtility.SetDirty(mat);
                            materialFiles.Add(path);
                        }
                    }
                }
            }
            finally
            {
                EditorUtility.ClearProgressBar();
                // Save all dirty assets
                AssetDatabase.SaveAssets();
            }

            if (updateMaterialFile == null)
            {
                return;
            }

            // Now that all the asset have been modified and save, we can safely update the .mat file and remove removed property
            try
            {
                for (int i = 0, length = materialFiles.Count; i < length; i++)
                {
                    string path = materialFiles[i];

                    EditorUtility.DisplayProgressBar(
                        "Update .mat files...",
                        string.Format("{0} / {1} materials .mat file updated.", i, length),
                        i / (float)(length - 1));

                    // Note: The file is supposed to be checkout by the previous loop
                    updateMaterialFile(path);
                }
            }
            finally
            {
                EditorUtility.ClearProgressBar();
                // No need to save in this case
            }
        }
Ejemplo n.º 7
0
        static void UpdateMaterialToNewerVersion(string caption, float scriptVersion, UpdateMaterial updateMaterial, UpdateMaterialFile updateMaterialFile = null)
        {
            bool          VCSEnabled    = (UnityEditor.VersionControl.Provider.enabled && UnityEditor.VersionControl.Provider.isActive);
            var           matIds        = AssetDatabase.FindAssets("t:Material");
            List <string> materialFiles = new List <string>(); // Contain the list dirty files

            try
            {
                for (int i = 0, length = matIds.Length; i < length; i++)
                {
                    var path = AssetDatabase.GUIDToAssetPath(matIds[i]);
                    var mat  = AssetDatabase.LoadAssetAtPath <Material>(path);

                    EditorUtility.DisplayProgressBar(
                        "Update material to new version " + caption + "...",
                        string.Format("{0} / {1} materials updated.", i, length),
                        i / (float)(length - 1));

                    if (mat.shader.name == "HDRenderPipeline/LitTessellation" ||
                        mat.shader.name == "HDRenderPipeline/Lit" ||
                        mat.shader.name == "HDRenderPipeline/LayeredLit" ||
                        mat.shader.name == "HDRenderPipeline/LayeredLitTessellation" ||
                        mat.shader.name == "HDRenderPipeline/StackLit" ||
                        mat.shader.name == "HDRenderPipeline/Unlit" ||
                        mat.shader.name == "HDRenderPipeline/Fabric" ||
                        mat.shader.name == "HDRenderPipeline/Decal"
                        )
                    {
                        // We don't handle embed material as we can't rewrite fbx files
                        if (Path.GetExtension(path).ToLower() == ".fbx")
                        {
                            continue;
                        }

                        // Get current version
                        float materialVersion = UpdateMaterial_GetVersion(path, mat);

                        if (materialVersion < scriptVersion)
                        {
                            updateMaterial(path, mat);

                            // Update version number to script number (so next script can upgrade correctly)
                            mat.SetFloat("_HdrpVersion", scriptVersion);


                            // Checkout the file and tag it as dirty
                            CoreEditorUtils.CheckOutFile(VCSEnabled, mat);
                            EditorUtility.SetDirty(mat);
                            materialFiles.Add(path);
                        }
                    }
                }
            }
            finally
            {
                EditorUtility.ClearProgressBar();
                // Save all dirty assets
                AssetDatabase.SaveAssets();
            }

            if (updateMaterialFile == null)
            {
                return;
            }

            // Now that all the asset have been modified and save, we can safely update the .mat file and remove removed property
            try
            {
                for (int i = 0, length = materialFiles.Count; i < length; i++)
                {
                    string path = materialFiles[i];

                    EditorUtility.DisplayProgressBar(
                        "Update .mat files...",
                        string.Format("{0} / {1} materials .mat file updated.", i, length),
                        i / (float)(length - 1));

                    // Note: The file is supposed to be checkout by the previous loop
                    updateMaterialFile(path);
                }
            }
            finally
            {
                EditorUtility.ClearProgressBar();
                // No need to save in this case
            }
        }
        static void UpdateMaterialToNewerVersion(string caption, UpdateMaterial updateMaterial, UpdateMaterialFile updateMaterialFile = null)
        {
            bool          VSCEnabled    = (UnityEditor.VersionControl.Provider.enabled && UnityEditor.VersionControl.Provider.isActive);
            var           matIds        = AssetDatabase.FindAssets("t:Material");
            List <string> materialFiles = new List <string>(); // Contain the list dirty files

            try
            {
                for (int i = 0, length = matIds.Length; i < length; i++)
                {
                    var path = AssetDatabase.GUIDToAssetPath(matIds[i]);
                    var mat  = AssetDatabase.LoadAssetAtPath <Material>(path);

                    EditorUtility.DisplayProgressBar(
                        "Update material to new version " + caption + "...",
                        string.Format("{0} / {1} materials updated.", i, length),
                        i / (float)(length - 1));

                    if (mat.shader.name == "HDRenderPipeline/LitTessellation" ||
                        mat.shader.name == "HDRenderPipeline/Lit" ||
                        mat.shader.name == "HDRenderPipeline/LayeredLit" ||
                        mat.shader.name == "HDRenderPipeline/LayeredLitTessellation" ||
                        mat.shader.name == "HDRenderPipeline/StackLit" ||
                        mat.shader.name == "HDRenderPipeline/Unlit"
                        )
                    {
                        // Need to be processed in order - All function here should be re-entrant (i.e after upgrade it can be recall)
                        bool dirty = updateMaterial(path, mat);

                        if (dirty)
                        {
                            // Checkout the file and tag it as dirty
                            CoreUtils.CheckOutFile(VSCEnabled, mat);
                            EditorUtility.SetDirty(mat);
                            materialFiles.Add(path);
                        }
                    }
                }
            }
            finally
            {
                EditorUtility.ClearProgressBar();
                // Save all dirty assets
                AssetDatabase.SaveAssets();
            }

            if (updateMaterialFile == null)
            {
                return;
            }

            // Now that all the asset have been modified and save, we can safely update the .mat file and remove removed property
            try
            {
                for (int i = 0, length = materialFiles.Count; i < length; i++)
                {
                    string path = materialFiles[i];

                    EditorUtility.DisplayProgressBar(
                        "Update .mat files...",
                        string.Format("{0} / {1} materials .mat file updated.", i, length),
                        i / (float)(length - 1));

                    // Note: The file is supposed to be checkout by the previous loop
                    updateMaterialFile(path);
                }
            }
            finally
            {
                EditorUtility.ClearProgressBar();
                // No need to save in this case
            }
        }