Commit 40ed08b0 authored by wanqing's avatar wanqing

修改代码

parent ec68a3f6
...@@ -51,6 +51,7 @@ public class BattleUI : MonoBehaviour ...@@ -51,6 +51,7 @@ public class BattleUI : MonoBehaviour
private int m_mouseIndex = 0;//点击次数 private int m_mouseIndex = 0;//点击次数
private bool m_bIsShowMouse = true;//是否显示手指图标 private bool m_bIsShowMouse = true;//是否显示手指图标
private int m_bombIndex = 0;//炸弹计数 private int m_bombIndex = 0;//炸弹计数
private bool m_bResult = false;//结果
public bool IsLeftEmtryBomb { get { return m_bombIndex >= 3; } }//是否不剩炸弹了 public bool IsLeftEmtryBomb { get { return m_bombIndex >= 3; } }//是否不剩炸弹了
public bool IsBombButtonCanInteractable { get { return m_boomBtn.interactable; } } public bool IsBombButtonCanInteractable { get { return m_boomBtn.interactable; } }
void Awake() void Awake()
...@@ -257,6 +258,8 @@ public class BattleUI : MonoBehaviour ...@@ -257,6 +258,8 @@ public class BattleUI : MonoBehaviour
{ {
m_clawMoveSpeed.text = string.Format("系数越小,越快\n{0:f3}", GameServices.configService.playerConfig.ClawMoveSpeed); m_clawMoveSpeed.text = string.Format("系数越小,越快\n{0:f3}", GameServices.configService.playerConfig.ClawMoveSpeed);
}); });
SetTakeBtnState(false);
m_bResult = false;
} }
//设置战斗UI状态 //设置战斗UI状态
public void SetBattleObjState(bool bool_) public void SetBattleObjState(bool bool_)
...@@ -321,11 +324,23 @@ public class BattleUI : MonoBehaviour ...@@ -321,11 +324,23 @@ public class BattleUI : MonoBehaviour
//take按钮 //take按钮
public void OnClickTakeBtn() public void OnClickTakeBtn()
{ {
if(m_bResult)
{
BattleCtrl.instance.OnBattleWin();
}
else
{
BattleCtrl.instance.OnBattleFail();
}
} }
//设置take按钮状态 //设置take按钮状态
public void SetTakeBtnState(bool value) public void SetTakeBtnState(bool value)
{ {
m_takeBtnObj.SetActive(value); m_takeBtnObj.SetActive(value);
} }
//结果状态
public void SetResultState(bool value)
{
m_bResult = value;
}
} }
...@@ -71,9 +71,9 @@ public class StorageView : MonoBehaviour ...@@ -71,9 +71,9 @@ public class StorageView : MonoBehaviour
} }
private void OnTriggerEnter(Collider other) private void OnTriggerEnter(Collider other)
{ {
if (other.gameObject.CompareTag("Target") && m_curTargetTrans && m_bControlCollisionBox) if (other.gameObject.CompareTag("Target") && m_curTargetTrans /*&& m_bControlCollisionBox*/)
{ {
m_bControlCollisionBox = false; //m_bControlCollisionBox = false;
//if (m_dicInsideBox.ContainsKey(m_curTargetTrans) && m_dicInsideBox[m_curTargetTrans]) //if (m_dicInsideBox.ContainsKey(m_curTargetTrans) && m_dicInsideBox[m_curTargetTrans])
//{ //{
// m_curTargetTrans.transform.Rotate(transform.up, 90.0f); // m_curTargetTrans.transform.Rotate(transform.up, 90.0f);
...@@ -97,27 +97,27 @@ public class StorageView : MonoBehaviour ...@@ -97,27 +97,27 @@ public class StorageView : MonoBehaviour
} }
private void OnTriggerExit(Collider other) private void OnTriggerExit(Collider other)
{ {
if (other.gameObject.CompareTag("Target") && m_curTargetTrans && !m_bControlCollisionBox) //if (other.gameObject.CompareTag("Target") && m_curTargetTrans && !m_bControlCollisionBox)
{ //{
m_bControlCollisionBox = true; // m_bControlCollisionBox = true;
m_hitBoxPoint = other.ClosestPoint(other.transform.position); // m_hitBoxPoint = other.ClosestPoint(other.transform.position);
//if (m_dicInsideBox.ContainsKey(m_curTargetTrans) && m_dicInsideBox[m_curTargetTrans]) // //if (m_dicInsideBox.ContainsKey(m_curTargetTrans) && m_dicInsideBox[m_curTargetTrans])
//{ // //{
// MeshCollider varBox = other.gameObject.GetComponent<MeshCollider>(); // // MeshCollider varBox = other.gameObject.GetComponent<MeshCollider>();
// if (m_dicInsideCollisonBox.ContainsKey(varBox)) // // if (m_dicInsideCollisonBox.ContainsKey(varBox))
// { // // {
// m_dicInsideCollisonBox[varBox] = false; // // m_dicInsideCollisonBox[varBox] = false;
// } // // }
//} // //}
//else // //else
{ // {
//MeshCollider varBox = other.gameObject.GetComponent<MeshCollider>(); // //MeshCollider varBox = other.gameObject.GetComponent<MeshCollider>();
//if (m_dicBox.ContainsKey(varBox)) // //if (m_dicBox.ContainsKey(varBox))
//{ // //{
// m_dicBox[varBox] = false; // // m_dicBox[varBox] = false;
//} // //}
} // }
} //}
} }
//放入箱子里面 //放入箱子里面
public void InsideBox(Collider other) public void InsideBox(Collider other)
...@@ -246,7 +246,7 @@ public class StorageView : MonoBehaviour ...@@ -246,7 +246,7 @@ public class StorageView : MonoBehaviour
} }
m_targetTrans[i].transform.position = varPos; m_targetTrans[i].transform.position = varPos;
} }
UpdateExitBox(); //UpdateExitBox();
} }
// 抬起回调 // 抬起回调
void OnTouchUp() void OnTouchUp()
...@@ -277,6 +277,7 @@ public class StorageView : MonoBehaviour ...@@ -277,6 +277,7 @@ public class StorageView : MonoBehaviour
//延时判断是否需要变化材质球 //延时判断是否需要变化材质球
void DelayMatChangeHandle() void DelayMatChangeHandle()
{ {
bool varBool_ = true;
for (int i = 0; i < m_targetTrans.Length; i++) for (int i = 0; i < m_targetTrans.Length; i++)
{ {
if (string.Equals(m_targetTrans[i].name, m_modelTorchStr)) if (string.Equals(m_targetTrans[i].name, m_modelTorchStr))
...@@ -284,6 +285,7 @@ public class StorageView : MonoBehaviour ...@@ -284,6 +285,7 @@ public class StorageView : MonoBehaviour
if(m_targetTrans[i].transform.position.y >= m_modelTorchOverPosY) if(m_targetTrans[i].transform.position.y >= m_modelTorchOverPosY)
{ {
m_targetTrans[i].GetComponent<MeshRenderer>().sharedMaterial = m_redMat; m_targetTrans[i].GetComponent<MeshRenderer>().sharedMaterial = m_redMat;
varBool_ = false;
} }
else else
{ {
...@@ -295,6 +297,7 @@ public class StorageView : MonoBehaviour ...@@ -295,6 +297,7 @@ public class StorageView : MonoBehaviour
if (m_targetTrans[i].transform.position.y >= m_modelBinocularOverPosY) if (m_targetTrans[i].transform.position.y >= m_modelBinocularOverPosY)
{ {
m_targetTrans[i].GetComponent<MeshRenderer>().sharedMaterial = m_redMat; m_targetTrans[i].GetComponent<MeshRenderer>().sharedMaterial = m_redMat;
varBool_ = false;
} }
else else
{ {
...@@ -306,6 +309,7 @@ public class StorageView : MonoBehaviour ...@@ -306,6 +309,7 @@ public class StorageView : MonoBehaviour
if (m_targetTrans[i].transform.position.y >= m_modelCompassOverPosY) if (m_targetTrans[i].transform.position.y >= m_modelCompassOverPosY)
{ {
m_targetTrans[i].GetComponent<MeshRenderer>().sharedMaterial = m_redMat; m_targetTrans[i].GetComponent<MeshRenderer>().sharedMaterial = m_redMat;
varBool_ = false;
} }
else else
{ {
...@@ -313,6 +317,7 @@ public class StorageView : MonoBehaviour ...@@ -313,6 +317,7 @@ public class StorageView : MonoBehaviour
} }
} }
} }
BattleCtrl.instance.battleUI.SetResultState(varBool_);
} }
//碰到其他目标 //碰到其他目标
public void SetTargetCollison(Transform trans, bool bool_) public void SetTargetCollison(Transform trans, bool bool_)
......
...@@ -1161,7 +1161,7 @@ Transform: ...@@ -1161,7 +1161,7 @@ Transform:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6421492585296530445} m_GameObject: {fileID: 6421492585296530445}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: -0.092, z: 0.08} m_LocalPosition: {x: 0, y: 0.88, z: 0.08}
m_LocalScale: {x: 3, y: 2, z: 3} m_LocalScale: {x: 3, y: 2, z: 3}
m_Children: [] m_Children: []
m_Father: {fileID: 7609197319393572573} m_Father: {fileID: 7609197319393572573}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment