| | |
| | | /// <param name="tower">The tower controller we're a ghost of</param> |
| | | public virtual void Initialize(Tower tower) |
| | | { |
| | | m_MeshRenderers = GetComponentsInChildren<MeshRenderer>(); |
| | | //m_MeshRenderers = GetComponentsInChildren<MeshRenderer>(); |
| | | controller = tower; |
| | | if (GameUI.instanceExists) |
| | | { |
| | |
| | | tmat.color = new Color(1.0f, 1.0f, 1.0f, 0.0f); |
| | | } |
| | | |
| | | // 查找子结点,技能塔拖动的时候半透明: |
| | | if (controller.towerFeature != EFeatureTower.NULL) |
| | | { |
| | | foreach (Transform t in transform.GetComponentsInChildren<Transform>()) |
| | | { |
| | | if (t.name == "Cube") |
| | | { |
| | | t.GetComponent<MeshRenderer>().material.color = new Color(1.0f, 1.0f, 1.0f, 1.0f); |
| | | t.GetComponent<MeshRenderer>().material.DOColor(new Color(1.0f, 1.0f, 1.0f, 0.4f), 0.4f); |
| | | } |
| | | } |
| | | } |
| | | //特效直接把塔做了进去 |
| | | // // 查找子结点,技能塔拖动的时候半透明: |
| | | // if (controller.towerFeature != EFeatureTower.NULL) |
| | | // { |
| | | // foreach (Transform t in transform.GetComponentsInChildren<Transform>()) |
| | | // { |
| | | // if (t.name == "Effect") |
| | | // { |
| | | // // t.GetComponent<MeshRenderer>().material.color = new Color(1.0f, 1.0f, 1.0f, 1.0f); |
| | | // // t.GetComponent<MeshRenderer>().material.DOColor(new Color(1.0f, 1.0f, 1.0f, 0.4f), 0.4f); |
| | | // // 改为拖动的时候播放特效 |
| | | // ParticleSystem ps = t.gameObject.GetComponent<ParticleSystem>(); |
| | | |
| | | // if (ps == null) |
| | | // ps = t.GetChild(0).GetComponent<ParticleSystem>(); |
| | | |
| | | // ps.Play(); |
| | | // break; |
| | | // } |
| | | // } |
| | | // } |
| | | } |
| | | |
| | | public void SetAttackArea(int lvl, int attid) |
| | |
| | | } |
| | | } |
| | | |
| | | Vector3 up = new Vector3(0, 10, 0); |
| | | /// <summary> |
| | | /// Moves this ghost to a given world position |
| | | /// </summary> |
| | |
| | | /// over invalid locations</param> |
| | | public virtual void Move(Vector3 worldPosition, Quaternion rotation, bool validLocation) |
| | | { |
| | | m_TargetPosition = worldPosition; |
| | | |
| | | m_TargetPosition = worldPosition + up; |
| | | if (!m_ValidPos) |
| | | { |
| | | // Immediately move to the given position |
| | |
| | | |
| | | if (Vector3.SqrMagnitude(currentPos - m_TargetPosition) > 0.01f) |
| | | { |
| | | currentPos = Vector3.SmoothDamp(currentPos, m_TargetPosition, ref m_MoveVel, dampSpeed); |
| | | //currentPos = Vector3.SmoothDamp(currentPos, m_TargetPosition, ref m_MoveVel, dampSpeed); |
| | | |
| | | transform.position = currentPos; |
| | | //transform.position = currentPos; |
| | | transform.position = m_TargetPosition; |
| | | |
| | | } |
| | | else |
| | | { |