Merge branch 'main' of http://shu.sheziwanglo.cn:3000/wulongxiao/_TheStrongestSnail
This commit is contained in:
commit
7766829b4f
@ -424,6 +424,7 @@ MonoBehaviour:
|
||||
SelfTextTrans: {fileID: 0}
|
||||
SelfImage: {fileID: 0}
|
||||
IsOtherWoniu: 0
|
||||
player: {fileID: 0}
|
||||
--- !u!114 &20259224
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -983,7 +984,7 @@ RectTransform:
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||
m_AnchoredPosition: {x: -153, y: 93}
|
||||
m_AnchoredPosition: {x: -153, y: 149}
|
||||
m_SizeDelta: {x: 100, y: 100}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!95 &74076852
|
||||
@ -1602,7 +1603,7 @@ RectTransform:
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||
m_AnchoredPosition: {x: -326, y: -34}
|
||||
m_AnchoredPosition: {x: -326, y: 32}
|
||||
m_SizeDelta: {x: 100, y: 100}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!95 &135970892
|
||||
@ -2246,7 +2247,7 @@ RectTransform:
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||
m_AnchoredPosition: {x: -23.000015, y: -82}
|
||||
m_AnchoredPosition: {x: -23.000015, y: 20}
|
||||
m_SizeDelta: {x: 100, y: 100}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!95 &175091444
|
||||
@ -2323,6 +2324,7 @@ GameObject:
|
||||
- component: {fileID: 177818107}
|
||||
- component: {fileID: 177818108}
|
||||
- component: {fileID: 177818109}
|
||||
- component: {fileID: 177818110}
|
||||
m_Layer: 5
|
||||
m_Name: woniu
|
||||
m_TagString: Untagged
|
||||
@ -2464,6 +2466,7 @@ MonoBehaviour:
|
||||
SelfTextTrans: {fileID: 1246685950}
|
||||
SelfImage: {fileID: 0}
|
||||
IsOtherWoniu: 0
|
||||
player: {fileID: 0}
|
||||
--- !u!95 &177818108
|
||||
Animator:
|
||||
serializedVersion: 5
|
||||
@ -2502,6 +2505,29 @@ MonoBehaviour:
|
||||
SelfWoniuText: {fileID: 1046374311}
|
||||
HaveBet: 0
|
||||
BetText: {fileID: 1246685950}
|
||||
--- !u!114 &177818110
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 177818102}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: a0e93af545a029e44bc39dff4b909107, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
objectToMove: {fileID: 177818103}
|
||||
pathPoints: []
|
||||
duration: 5
|
||||
isLooping: 0
|
||||
Speed: 0
|
||||
EndPos: {fileID: 0}
|
||||
posGroup: {fileID: 0}
|
||||
JumpPos: {fileID: 0}
|
||||
OutParent: {fileID: 0}
|
||||
ReturnPos: {fileID: 0}
|
||||
allHouseContro: {fileID: 0}
|
||||
--- !u!1 &197030554
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -5132,7 +5158,7 @@ RectTransform:
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||
m_AnchoredPosition: {x: -201.00002, y: -40}
|
||||
m_AnchoredPosition: {x: -201.00002, y: 54}
|
||||
m_SizeDelta: {x: 100, y: 100}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!95 &488757079
|
||||
@ -6566,7 +6592,7 @@ RectTransform:
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||
m_AnchoredPosition: {x: 294, y: 86}
|
||||
m_AnchoredPosition: {x: 294, y: 152}
|
||||
m_SizeDelta: {x: 100, y: 100}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!95 &615808351
|
||||
@ -7888,6 +7914,7 @@ MonoBehaviour:
|
||||
SelfTextTrans: {fileID: 0}
|
||||
SelfImage: {fileID: 0}
|
||||
IsOtherWoniu: 0
|
||||
player: {fileID: 0}
|
||||
--- !u!114 &708679844
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -8214,6 +8241,7 @@ MonoBehaviour:
|
||||
SelfTextTrans: {fileID: 0}
|
||||
SelfImage: {fileID: 0}
|
||||
IsOtherWoniu: 0
|
||||
player: {fileID: 0}
|
||||
--- !u!114 &715869107
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -8316,6 +8344,7 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: fafd91fc9fb41634bb76aef9127888d7, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
otherWonius: []
|
||||
OtherWoniuPre: {fileID: 4217838679404656796, guid: cb258e284be1975488c77564b0cadd91, type: 3}
|
||||
allHouseContro: {fileID: 142654723}
|
||||
JiaWoniu:
|
||||
@ -8331,7 +8360,7 @@ MonoBehaviour:
|
||||
- {fileID: 74076849}
|
||||
- {fileID: 1725000187}
|
||||
- {fileID: 728954428}
|
||||
ReTurnPos: {fileID: 0}
|
||||
ReTurnPos: {fileID: 1300544800}
|
||||
--- !u!1 &718419355
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -8498,7 +8527,7 @@ RectTransform:
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||
m_AnchoredPosition: {x: 290, y: -89.000046}
|
||||
m_AnchoredPosition: {x: 290, y: 39}
|
||||
m_SizeDelta: {x: 100, y: 100}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!95 &728954430
|
||||
@ -10119,6 +10148,7 @@ MonoBehaviour:
|
||||
SelfTextTrans: {fileID: 0}
|
||||
SelfImage: {fileID: 0}
|
||||
IsOtherWoniu: 0
|
||||
player: {fileID: 0}
|
||||
--- !u!114 &898215882
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -10344,7 +10374,7 @@ RectTransform:
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||
m_AnchoredPosition: {x: -253, y: 103}
|
||||
m_AnchoredPosition: {x: -253, y: 153}
|
||||
m_SizeDelta: {x: 100, y: 100}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!95 &918823861
|
||||
@ -11987,6 +12017,7 @@ MonoBehaviour:
|
||||
SelfTextTrans: {fileID: 0}
|
||||
SelfImage: {fileID: 0}
|
||||
IsOtherWoniu: 0
|
||||
player: {fileID: 0}
|
||||
--- !u!114 &1049673035
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -12399,6 +12430,7 @@ MonoBehaviour:
|
||||
SelfTextTrans: {fileID: 0}
|
||||
SelfImage: {fileID: 0}
|
||||
IsOtherWoniu: 0
|
||||
player: {fileID: 177818107}
|
||||
--- !u!114 &1088858452
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -15671,6 +15703,7 @@ MonoBehaviour:
|
||||
SelfTextTrans: {fileID: 0}
|
||||
SelfImage: {fileID: 0}
|
||||
IsOtherWoniu: 0
|
||||
player: {fileID: 177818107}
|
||||
--- !u!114 &1377318870
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -15839,7 +15872,7 @@ RectTransform:
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||
m_AnchoredPosition: {x: 185.99998, y: -36}
|
||||
m_AnchoredPosition: {x: 185.99998, y: 22}
|
||||
m_SizeDelta: {x: 100, y: 100}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!95 &1386019235
|
||||
@ -17114,6 +17147,7 @@ MonoBehaviour:
|
||||
SelfTextTrans: {fileID: 0}
|
||||
SelfImage: {fileID: 0}
|
||||
IsOtherWoniu: 0
|
||||
player: {fileID: 177818107}
|
||||
--- !u!114 &1519901234
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -17899,6 +17933,7 @@ MonoBehaviour:
|
||||
SelfTextTrans: {fileID: 0}
|
||||
SelfImage: {fileID: 0}
|
||||
IsOtherWoniu: 0
|
||||
player: {fileID: 177818107}
|
||||
--- !u!114 &1557156373
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -19752,7 +19787,7 @@ RectTransform:
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||
m_AnchoredPosition: {x: 146, y: 66}
|
||||
m_AnchoredPosition: {x: 146, y: 132}
|
||||
m_SizeDelta: {x: 100, y: 100}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!95 &1725000189
|
||||
@ -20641,6 +20676,7 @@ MonoBehaviour:
|
||||
SelfTextTrans: {fileID: 0}
|
||||
SelfImage: {fileID: 0}
|
||||
IsOtherWoniu: 0
|
||||
player: {fileID: 177818107}
|
||||
--- !u!95 &1790882393
|
||||
Animator:
|
||||
serializedVersion: 5
|
||||
@ -21979,7 +22015,7 @@ RectTransform:
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||
m_AnchoredPosition: {x: 17, y: 36}
|
||||
m_AnchoredPosition: {x: 17, y: 94}
|
||||
m_SizeDelta: {x: 100, y: 100}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!95 &1887905479
|
||||
@ -23732,7 +23768,7 @@ RectTransform:
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||
m_AnchoredPosition: {x: -95.000015, y: -9}
|
||||
m_AnchoredPosition: {x: -95.000015, y: 41}
|
||||
m_SizeDelta: {x: 100, y: 100}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!95 &2131031524
|
||||
@ -23830,7 +23866,7 @@ RectTransform:
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||
m_AnchoredPosition: {x: 24.999985, y: 135}
|
||||
m_AnchoredPosition: {x: 24.999985, y: 185}
|
||||
m_SizeDelta: {x: 100, y: 100}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!95 &2132522078
|
||||
@ -24390,6 +24426,7 @@ MonoBehaviour:
|
||||
SelfTextTrans: {fileID: 0}
|
||||
SelfImage: {fileID: 0}
|
||||
IsOtherWoniu: 0
|
||||
player: {fileID: 0}
|
||||
--- !u!114 &2143530053
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -3631,7 +3631,7 @@ RectTransform:
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 540, y: -1339.5}
|
||||
m_AnchoredPosition: {x: 686, y: -1387.5}
|
||||
m_SizeDelta: {x: 1018, y: 0}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!114 &1071890038
|
||||
|
@ -247,12 +247,14 @@ public class AllHouseContro : MonoBehaviour
|
||||
battleRoyaleGameDetails();
|
||||
|
||||
LoadPanel.instance.ShowPanel();
|
||||
player.gameObject.SetActive(true);
|
||||
CanMoveWoniu();//允许蜗牛移动
|
||||
ClearText();
|
||||
//ReHouseText();
|
||||
BoosReturn();
|
||||
player.ReturnStartPos();
|
||||
allother.Reflash();//假蜗牛随机
|
||||
allother.HideJiaWoniu();
|
||||
// allother.Reflash();//假蜗牛随机
|
||||
allother.ClearAllWoniu();
|
||||
IsHideLoadPanel = false;
|
||||
GetInfo516();
|
||||
|
@ -1,3 +1,4 @@
|
||||
using DG.Tweening;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
@ -6,13 +7,15 @@ using static UnityEngine.UIElements.UxmlAttributeDescription;
|
||||
|
||||
public class Allother : MonoBehaviour
|
||||
{
|
||||
//public List<otherWoniu> otherWonius=new List<otherWoniu>();
|
||||
public List<otherWoniu> otherWonius;
|
||||
|
||||
// public List<HouseBtn> House;//蜗牛进入的父物体
|
||||
public GameObject OtherWoniuPre;//其他蜗牛预制体
|
||||
public AllHouseContro allHouseContro;
|
||||
|
||||
public List<GameObject> JiaWoniu;//场下留下的假蜗牛
|
||||
private List<GameObject> hiddenSnails = new List<GameObject>(); // 用来记录未显示的蜗牛
|
||||
|
||||
public Transform ReTurnPos;//返回点
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
@ -26,24 +29,55 @@ public class Allother : MonoBehaviour
|
||||
// CreateWoniu();//创建蜗牛
|
||||
|
||||
//}
|
||||
//public async void ControWoniuToMove()
|
||||
// {
|
||||
// foreach (otherWoniu item in otherWonius)
|
||||
// {
|
||||
// await Task.Delay(1000);
|
||||
// item.OtherWoniuMove();
|
||||
|
||||
// }
|
||||
// }
|
||||
//public async void ControWoniuToMove()
|
||||
// {
|
||||
// foreach (otherWoniu item in otherWonius)
|
||||
// {
|
||||
// await Task.Delay(1000);
|
||||
// item.OtherWoniuMove();
|
||||
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
|
||||
public void Reflash()//假蜗牛随机
|
||||
public void HideJiaWoniu()
|
||||
{
|
||||
// 初始化时将所有蜗牛隐藏,并添加到未显示列表
|
||||
foreach (GameObject go in JiaWoniu)
|
||||
{
|
||||
go.GetComponent<RectTransform>().anchoredPosition = new Vector2(Random.Range(-350, 350), Random.Range(-80, 80));
|
||||
go.SetActive(false);
|
||||
hiddenSnails.Add(go);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void Reflash() // 随机显示假蜗牛
|
||||
{
|
||||
if (hiddenSnails.Count == 0)
|
||||
{
|
||||
Debug.Log("所有假蜗牛都已显示!");
|
||||
return;
|
||||
}
|
||||
|
||||
// 每次随机显示一定数量(例如 1 到 3 个)
|
||||
int numToShow = Random.Range(1, Mathf.Min(4, hiddenSnails.Count + 1));
|
||||
|
||||
for (int i = 0; i < numToShow; i++)
|
||||
{
|
||||
// 随机选择一个未显示的蜗牛
|
||||
int randomIndex = Random.Range(0, hiddenSnails.Count);
|
||||
GameObject snail = hiddenSnails[randomIndex];
|
||||
|
||||
// 设置位置
|
||||
snail.GetComponent<RectTransform>().anchoredPosition = new Vector2(
|
||||
Random.Range(-350, 550),
|
||||
Random.Range(0, 40)
|
||||
);
|
||||
|
||||
// 显示蜗牛
|
||||
snail.SetActive(true);
|
||||
|
||||
// 从未显示列表中移除
|
||||
hiddenSnails.RemoveAt(randomIndex);
|
||||
}
|
||||
}
|
||||
|
||||
@ -54,16 +88,23 @@ public class Allother : MonoBehaviour
|
||||
{
|
||||
if (house.otherWonius != null)
|
||||
{
|
||||
for (int i = 0; i < house.otherWonius.Count; i++)
|
||||
{
|
||||
Destroy(house.otherWonius[i].gameObject);
|
||||
|
||||
}
|
||||
|
||||
house.otherWonius.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
for (int i=0;i<otherWonius.Count;i++)
|
||||
{
|
||||
if (otherWonius[i] != null)
|
||||
{
|
||||
DOTween.Kill(otherWonius[i].gameObject);
|
||||
|
||||
|
||||
Destroy(otherWonius[i].gameObject);
|
||||
}
|
||||
|
||||
}
|
||||
otherWonius.Clear();
|
||||
}
|
||||
|
||||
//清空指定房间蜗牛
|
||||
@ -77,17 +118,24 @@ public class Allother : MonoBehaviour
|
||||
{
|
||||
for (int j = 0; j< allHouseContro.HouseBtnList[i].otherWonius.Count; j++)
|
||||
{
|
||||
Destroy(allHouseContro.HouseBtnList[i].otherWonius[i].gameObject);
|
||||
if (allHouseContro.HouseBtnList[i].otherWonius[j].gameObject!=null)
|
||||
{
|
||||
|
||||
}
|
||||
Destroy(allHouseContro.HouseBtnList[i].otherWonius[j].gameObject);
|
||||
}
|
||||
|
||||
allHouseContro.HouseBtnList[i].otherWonius.Clear();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//对应房间蜗牛回起始点
|
||||
public void ReturnstartPos(int roomNo)
|
||||
public IEnumerator ReturnstartPos(int roomNo)
|
||||
{
|
||||
allHouseContro.ControAllDoorOpen();
|
||||
for (int i = 0; i < allHouseContro.HouseBtnList.Count; i++)
|
||||
{
|
||||
if (allHouseContro.HouseBtnList[i].roomNo == roomNo)
|
||||
@ -95,6 +143,8 @@ public class Allother : MonoBehaviour
|
||||
for (int j = 0; j < allHouseContro.HouseBtnList[i].otherWonius.Count; j++)
|
||||
{
|
||||
allHouseContro.HouseBtnList[i].otherWonius[j].GetComponent<OtherMove>().EndPos = ReTurnPos;
|
||||
allHouseContro.HouseBtnList[i].otherWonius[j].GetComponent<OtherMove>().ReTurnStartPosMove();
|
||||
yield return new WaitForSeconds(0.3f);
|
||||
}
|
||||
allHouseContro.HouseBtnList[i].otherWonius.Clear();
|
||||
}
|
||||
@ -103,36 +153,38 @@ public class Allother : MonoBehaviour
|
||||
|
||||
|
||||
|
||||
public void CreateWoniu()
|
||||
{
|
||||
foreach (HouseBtn house in allHouseContro.HouseBtnList)
|
||||
{
|
||||
for (int i = 0; i < house.roomUserNo-house.otherWonius.Count; i++)
|
||||
{
|
||||
//public void CreateWoniu()
|
||||
//{
|
||||
// foreach (HouseBtn house in allHouseContro.HouseBtnList)
|
||||
// {
|
||||
// for (int i = 0; i < house.roomUserNo-house.otherWonius.Count; i++)
|
||||
// {
|
||||
|
||||
// 在指定范围内随机生成位置
|
||||
float randomX = Random.Range(-250f, 250f); // X轴范围
|
||||
float randomY = Random.Range(-80f, 80f); // Y轴范围
|
||||
Vector2 randomPosition = new Vector2(randomX, randomY);
|
||||
// // 在指定范围内随机生成位置
|
||||
// float randomX = Random.Range(-250f, 250f); // X轴范围
|
||||
// float randomY = Random.Range(-80f, 80f); // Y轴范围
|
||||
// Vector2 randomPosition = new Vector2(randomX, randomY);
|
||||
|
||||
// 实例化蜗牛
|
||||
GameObject ot = Instantiate(OtherWoniuPre, transform);
|
||||
ot.GetComponent<RectTransform>().anchoredPosition = randomPosition;
|
||||
// // 实例化蜗牛
|
||||
// GameObject ot = Instantiate(OtherWoniuPre, transform);
|
||||
// ot.GetComponent<RectTransform>().anchoredPosition = randomPosition;
|
||||
|
||||
// 添加到蜗牛列表并设置其行为
|
||||
// // 添加到蜗牛列表并设置其行为
|
||||
|
||||
house.otherWonius.Add(ot.GetComponent<otherWoniu>());
|
||||
ot.GetComponent<otherWoniu>().OtherWoniuMove(house); // 移动到目标房间
|
||||
// house.otherWonius.Add(ot.GetComponent<otherWoniu>());
|
||||
|
||||
// ot.GetComponent<otherWoniu>().OtherWoniuMove(house); // 移动到目标房间
|
||||
|
||||
Debug.Log("生成蜗牛,随机位置:" + randomPosition);
|
||||
}
|
||||
}
|
||||
// Debug.Log("生成蜗牛,随机位置:" + randomPosition);
|
||||
// }
|
||||
// }
|
||||
|
||||
}
|
||||
//}
|
||||
|
||||
public void startIEmove()
|
||||
{
|
||||
StartCoroutine(IECreateWoniu());
|
||||
Reflash();
|
||||
}
|
||||
public IEnumerator IECreateWoniu()
|
||||
{
|
||||
@ -144,6 +196,7 @@ public class Allother : MonoBehaviour
|
||||
GameObject ot = Instantiate(OtherWoniuPre, transform);
|
||||
ot.GetComponent<RectTransform>().anchoredPosition = new Vector2(Random.Range(-250, 250), Random.Range(-80, 0));
|
||||
house.otherWonius.Add(ot.GetComponent<otherWoniu>());
|
||||
otherWonius.Add(ot.GetComponent<otherWoniu>());
|
||||
ot.GetComponent<otherWoniu>().OtherWoniuMove(house);//进房间
|
||||
|
||||
Debug.Log("生成蜗牛");
|
||||
|
@ -196,7 +196,7 @@ public class OtherMove : MonoBehaviour
|
||||
objectToMove.GetComponent<PlayerMovePos>().StartPos = EndPos;
|
||||
|
||||
|
||||
objectToMove.GetComponent<PlayerMovePos>().PlayAni.SetInteger("State", 0);
|
||||
|
||||
|
||||
|
||||
// rectTransform.anchoredPosition = new Vector2(rectTransform.anchoredPosition.x + Random.Range(-100, 100), rectTransform.anchoredPosition.y);
|
||||
@ -213,26 +213,130 @@ public class OtherMove : MonoBehaviour
|
||||
objectToMove.GetComponent<PlayerMovePos>().IsLeft = true;
|
||||
Rotate();
|
||||
}
|
||||
rectTransform.DOAnchorPosX(rectTransform.anchoredPosition.x + range, 1f).SetEase(Ease.Linear);
|
||||
rectTransform.DOAnchorPosX(rectTransform.anchoredPosition.x + range, 1f).SetEase(Ease.Linear).OnComplete(() => { objectToMove.GetComponent<PlayerMovePos>().PlayAni.SetInteger("State", 0); });
|
||||
|
||||
});
|
||||
|
||||
|
||||
//});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public void AfterReMove()
|
||||
{
|
||||
Debug.Log("其他蜗牛返回起点");
|
||||
RectTransform rectTransform = objectToMove.GetComponent<RectTransform>();
|
||||
|
||||
|
||||
//objectToMove.DOMoveY(objectToMove.position.y + 100, 0.5f).OnComplete(() => {
|
||||
rectTransform.DOAnchorPosY(rectTransform.anchoredPosition.y+Random.Range(-200,-20), 0.5f).SetEase(Ease.Linear)
|
||||
.OnComplete(() => {
|
||||
|
||||
|
||||
// rectTransform.anchoredPosition = new Vector2(rectTransform.anchoredPosition.x + Random.Range(-100, 100), rectTransform.anchoredPosition.y);
|
||||
float range = Random.Range(-350, 350);
|
||||
// 判断物体是否需要旋转
|
||||
if (range > 0 && objectToMove.GetComponent<PlayerMovePos>().IsLeft)
|
||||
{
|
||||
objectToMove.GetComponent<PlayerMovePos>().IsLeft = false;
|
||||
// 旋转物体使其面向左侧(绕Y轴旋转180度)
|
||||
Rotate();
|
||||
}
|
||||
else if (range < 0 && !objectToMove.GetComponent<PlayerMovePos>().IsLeft)
|
||||
{
|
||||
objectToMove.GetComponent<PlayerMovePos>().IsLeft = true;
|
||||
Rotate();
|
||||
}
|
||||
rectTransform.DOAnchorPosX(rectTransform.anchoredPosition.x + range, 1f).SetEase(Ease.Linear).OnComplete(() => { objectToMove.GetComponent<PlayerMovePos>().PlayAni.SetInteger("State", 0); });
|
||||
|
||||
});
|
||||
|
||||
|
||||
//});
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void ReTurnStartPosMove()
|
||||
{
|
||||
|
||||
Debug.Log("启动其他蜗牛移动");
|
||||
// 提取路径中的所有点的位置
|
||||
Debug.Log("路径长度" + pathPoints.Length);
|
||||
for (int i = 0; i < pathPoints.Length; i++)
|
||||
{
|
||||
Debug.Log("其他蜗判断终点");
|
||||
if (objectToMove.GetComponent<PlayerMovePos>().StartPos == pathPoints[i])
|
||||
{
|
||||
startIndex = i;
|
||||
//Debug.Log("Startindex"+i);
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (EndPos == pathPoints[i])
|
||||
{
|
||||
endIndex = i;
|
||||
//Debug.Log("Endindex" + i);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (endIndex > startIndex)
|
||||
{
|
||||
Debug.Log("其他蜗牛分配路径");
|
||||
|
||||
duration = (endIndex - startIndex) / Speed;
|
||||
|
||||
|
||||
Vector3[] waypoints = new Vector3[endIndex - startIndex + 1];
|
||||
for (int i = startIndex, j = 0; j < pathPoints.Length && i <= endIndex; i++, j++)
|
||||
{
|
||||
if (!JudagePos1() && pathPoints[i] == JumpPos)
|
||||
{
|
||||
waypoints[j] = pathPoints[i - 1].position;
|
||||
continue;
|
||||
|
||||
}
|
||||
waypoints[j] = pathPoints[i].position;
|
||||
|
||||
}
|
||||
OnReMove(waypoints);
|
||||
}
|
||||
else if (endIndex < startIndex)
|
||||
{
|
||||
|
||||
duration = (startIndex - endIndex) / Speed;
|
||||
|
||||
//duration = (startIndex-endIndex) / Speed;
|
||||
Vector3[] waypoints = new Vector3[startIndex - endIndex + 1];
|
||||
for (int i = startIndex, j = 0; j < pathPoints.Length && i >= endIndex; i--, j++)
|
||||
{
|
||||
if (!JudagePos1() && pathPoints[i] == JumpPos)
|
||||
{
|
||||
waypoints[j] = pathPoints[i + 1].position;
|
||||
continue;
|
||||
|
||||
}
|
||||
|
||||
waypoints[j] = pathPoints[i].position;
|
||||
|
||||
}
|
||||
OnReMove(waypoints);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public void Rotate()
|
||||
{
|
||||
|
||||
@ -280,4 +384,44 @@ public class OtherMove : MonoBehaviour
|
||||
})
|
||||
.OnComplete(AfterMove);
|
||||
}
|
||||
|
||||
|
||||
public void OnReMove(Vector3[] waypoints)
|
||||
{
|
||||
Debug.Log("其他蜗牛开始移动");
|
||||
objectToMove.GetComponent<PlayerMovePos>().PlayAni.SetInteger("State", 1);
|
||||
|
||||
|
||||
|
||||
|
||||
MoveOutParent();
|
||||
Tween pathTween = objectToMove.DOPath(waypoints, duration, PathType.Linear)
|
||||
.SetEase(Ease.Linear) // 设置线性过渡效果
|
||||
.SetLoops(isLooping ? -1 : 0)
|
||||
.OnWaypointChange((index) =>
|
||||
{
|
||||
// 当物体到达某个路径点时回调
|
||||
if (index < waypoints.Length - 1)
|
||||
{
|
||||
Vector3 currentWaypoint = waypoints[index];
|
||||
Vector3 nextWaypoint = waypoints[index + 1];
|
||||
|
||||
// 判断物体是否需要旋转
|
||||
if (nextWaypoint.x < currentWaypoint.x && !objectToMove.GetComponent<PlayerMovePos>().IsLeft)
|
||||
{
|
||||
objectToMove.GetComponent<PlayerMovePos>().IsLeft = true;
|
||||
// 旋转物体使其面向左侧(绕Y轴旋转180度)
|
||||
Rotate();
|
||||
}
|
||||
else if (nextWaypoint.x > currentWaypoint.x && objectToMove.GetComponent<PlayerMovePos>().IsLeft)
|
||||
{
|
||||
objectToMove.GetComponent<PlayerMovePos>().IsLeft = false;
|
||||
Rotate();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
})
|
||||
.OnComplete(AfterReMove);
|
||||
}
|
||||
}
|
||||
|
@ -43,6 +43,8 @@ public class PlayerMove : MonoBehaviour
|
||||
public Transform SelfTextTrans;
|
||||
public Transform SelfImage;
|
||||
public bool IsOtherWoniu;
|
||||
|
||||
public PlayerMove player;//Íæ¼Ò
|
||||
private void Start()
|
||||
{
|
||||
Speed = 2f;
|
||||
@ -366,11 +368,31 @@ public class PlayerMove : MonoBehaviour
|
||||
GetComponent<BossContro>().BossAni.SetInteger("State", 2);
|
||||
yield return new WaitForSeconds(3f);
|
||||
GetComponent<BossContro>().BossAni.SetInteger("State", 0);
|
||||
foreach (int nos in allHouseContro.KillNos)
|
||||
if (allHouseContro.KillNos.Count>0)
|
||||
{
|
||||
GetComponent<BossContro>().allother.KilltheWoniu(nos);
|
||||
foreach (int nos in allHouseContro.KillNos)
|
||||
{
|
||||
GetComponent<BossContro>().allother.KilltheWoniu(nos);
|
||||
if (allHouseContro.roomNo==nos)
|
||||
{
|
||||
player.gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
}
|
||||
foreach (HouseBtn houseBtn in allHouseContro.HouseBtnList)
|
||||
{
|
||||
foreach (int nos in allHouseContro.KillNos)
|
||||
{
|
||||
if (houseBtn.roomNo!=nos)
|
||||
{
|
||||
StartCoroutine( GetComponent<BossContro>().allother.ReturnstartPos(houseBtn.roomNo));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
allHouseContro.KillNos.Clear();
|
||||
}
|
||||
allHouseContro.KillNos.Clear();
|
||||
|
||||
BettingBtn.instance.GiveMoney(room_id);
|
||||
yield return new WaitForSeconds(2f);
|
||||
//allHouseContro.BoosReturn();
|
||||
|
Loading…
Reference in New Issue
Block a user