wangguan
2020-11-17 8daf2a93dc9837593ccb66e52d30e093ffb6a4ab
停止升级提示
修改面向相机,增加一个偏移
6 files modified
91 ■■■■ changed files
Assets/Materials/UI/tileTowerVSMat.mat 2 ●●● patch | view | raw | blame | history
Assets/Prefabs/UI/PlacementTileMobile.prefab 12 ●●●●● patch | view | raw | blame | history
Assets/Scripts/TowerDefense/Towers/Placement/TowerPlacementGridEndless.cs 32 ●●●● patch | view | raw | blame | history
Assets/Scripts/TowerDefense/UI/HUD/EndlessGameUI.cs 2 ●●● patch | view | raw | blame | history
Assets/Scripts/TowerDefense/UI/HUD/PlacementTile.cs 28 ●●●● patch | view | raw | blame | history
Assets/Scripts/TowerDefense/UI/LookAtSceneCamera.cs 15 ●●●● patch | view | raw | blame | history
Assets/Materials/UI/tileTowerVSMat.mat
@@ -40,7 +40,7 @@
        m_Scale: {x: 1, y: 1}
        m_Offset: {x: 0, y: 0}
    - _MainTex:
        m_Texture: {fileID: 2800000, guid: 93f40a01d57fbff418fc0b54b6ab7d9f, type: 3}
        m_Texture: {fileID: 2800000, guid: 8c9a3d26120e78f40aa4ef9ed23d573c, type: 3}
        m_Scale: {x: 1, y: 1}
        m_Offset: {x: 0, y: 0}
    - _MetallicGlossMap:
Assets/Prefabs/UI/PlacementTileMobile.prefab
@@ -56,7 +56,6 @@
  canPlaceRenderer: {fileID: 5722111975221064870}
  canPlaceMat: {fileID: 2100000, guid: 434316934db1c90498f004f124d7c733, type: 2}
  selectMat: {fileID: 2100000, guid: 3b7aa7626a2d4674ca2aa32958f14ca9, type: 2}
  myPS: {fileID: 7663500723916369405}
  towerVSRenderer: {fileID: 2078962303223178405}
  towerVSMat: {fileID: 2100000, guid: c40b753d26a2b4a4facef99e60c526d2, type: 2}
  fire: {fileID: 2800000, guid: 8c9a3d26120e78f40aa4ef9ed23d573c, type: 3}
@@ -381,6 +380,11 @@
      propertyPath: m_Name
      value: Effect_UI_BaoShiShengJi_TiShi
      objectReference: {fileID: 0}
    - target: {fileID: 3190397260455246885, guid: 4fcc58d4d215bdf43807fe35b9e8f9ad,
        type: 3}
      propertyPath: m_IsActive
      value: 0
      objectReference: {fileID: 0}
    - target: {fileID: 3190397261047448469, guid: 4fcc58d4d215bdf43807fe35b9e8f9ad,
        type: 3}
      propertyPath: playOnAwake
@@ -396,12 +400,6 @@
--- !u!4 &7663500724507464268 stripped
Transform:
  m_CorrespondingSourceObject: {fileID: 3190397260455246884, guid: 4fcc58d4d215bdf43807fe35b9e8f9ad,
    type: 3}
  m_PrefabInstance: {fileID: 5052097780309765736}
  m_PrefabAsset: {fileID: 0}
--- !u!198 &7663500723916369405 stripped
ParticleSystem:
  m_CorrespondingSourceObject: {fileID: 3190397261047448469, guid: 4fcc58d4d215bdf43807fe35b9e8f9ad,
    type: 3}
  m_PrefabInstance: {fileID: 5052097780309765736}
  m_PrefabAsset: {fileID: 0}
Assets/Scripts/TowerDefense/Towers/Placement/TowerPlacementGridEndless.cs
@@ -1033,27 +1033,27 @@
        /// <param name="allTowerP"></param>
        public void PlayPS(List<IntVector2> allTowerP)
        {
            for (int i = 0; i < allTowerP.Count; i++)
            {
                m_Tiles[allTowerP[i].x, allTowerP[i].y].SetParticleSystem(true);
            }
            // for (int i = 0; i < allTowerP.Count; i++)
            // {
            //     m_Tiles[allTowerP[i].x, allTowerP[i].y].SetParticleSystem(true);
            // }
        }
        /// <summary>
        /// /// 停止所有升级动画
        /// </summary>
        public void StopPS()
        {
            int iy = dimensions.y - 1;//3
            for (int ix = 0; ix < dimensions.x; ix++)
            {
                for (int y = iy; y >= dimensions.y - AttackRowNumbers; --y)
                {
                    if (m_arrGridType[ix, y] == PlacementGridType.EGridOpen)
                    {
                        m_Tiles[ix, y].SetParticleSystem(false);
                    }
                }
            }
            // int iy = dimensions.y - 1;//3
            // for (int ix = 0; ix < dimensions.x; ix++)
            // {
            //     for (int y = iy; y >= dimensions.y - AttackRowNumbers; --y)
            //     {
            //         if (m_arrGridType[ix, y] == PlacementGridType.EGridOpen)
            //         {
            //             m_Tiles[ix, y].SetParticleSystem(false);
            //         }
            //     }
            // }
        }
        /// <summary>
@@ -1100,7 +1100,7 @@
                    }
                }
            }
            StopPS();
            //StopPS();
        }
#if UNITY_EDITOR
Assets/Scripts/TowerDefense/UI/HUD/EndlessGameUI.cs
@@ -894,7 +894,7 @@
                    if (m_CurrentArea != null)
                    {
                        (m_CurrentArea as TowerPlacementGridEndless).CheckAllCanPlace(allTowerP);
                        (m_CurrentArea as TowerPlacementGridEndless).PlayPS(allPSTowerP);
                        //(m_CurrentArea as TowerPlacementGridEndless).PlayPS(allPSTowerP);
                    }
Assets/Scripts/TowerDefense/UI/HUD/PlacementTile.cs
@@ -63,7 +63,7 @@
        /// </summary>
        public Material selectMat;
        public ParticleSystem myPS;//可以升级的特效
        //public ParticleSystem myPS;//可以升级的特效
        /// <summary>
@@ -88,21 +88,21 @@
            }
        }
        public void SetParticleSystem(bool isOn)
        {
            if (isOn)
            {
                if (myPS.gameObject.activeSelf != isOn) myPS.gameObject.SetActive(isOn);
                myPS.Play();
        // public void SetParticleSystem(bool isOn)
        // {
        //     if (isOn)
        //     {
        //         if (myPS.gameObject.activeSelf != isOn) myPS.gameObject.SetActive(isOn);
        //         myPS.Play();
            }
            else
            {
                myPS.Stop();
                if (myPS.gameObject.activeSelf != isOn) myPS.gameObject.SetActive(isOn);
        //     }
        //     else
        //     {
        //         myPS.Stop();
        //         if (myPS.gameObject.activeSelf != isOn) myPS.gameObject.SetActive(isOn);
            }
        }
        //     }
        // }
        /// <summary>
        /// 设置是否可以放置
Assets/Scripts/TowerDefense/UI/LookAtSceneCamera.cs
@@ -17,6 +17,18 @@
        private void Start()
        {
            sceneCamera = GameObject.Find("SceneCamera3D").GetComponent<Camera>();
            Invoke("LookAtCamera",0.2f);
        }
        private Vector3 offect = new Vector3(0, 0.07f, 0.04f);
        private void LookAtCamera()
        {
            transform.LookAt(transform.position + sceneCamera.transform.rotation * Vector3.forward,
                sceneCamera.transform.rotation * Vector3.up);
            transform.localPosition = offect;
        }
        // Update is called once per frame
@@ -29,8 +41,7 @@
        void LateUpdate()
        {
            // transform.LookAt(sceneCamera.transform);
            transform.LookAt(transform.position + sceneCamera.transform.rotation * Vector3.forward,
                sceneCamera.transform.rotation * Vector3.up);
        }
    }
}