2024-11-12 19:43:17 +08:00
|
|
|
|
using System.Collections;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
using UnityEngine.UI;
|
|
|
|
|
using DG.Tweening;
|
|
|
|
|
|
|
|
|
|
public class PlayerMove : MonoBehaviour
|
|
|
|
|
{
|
|
|
|
|
public Transform objectToMove; // Ҫ<>ƶ<EFBFBD><C6B6>Ķ<EFBFBD><C4B6><EFBFBD>
|
|
|
|
|
public Transform[] pathPoints; // ·<><C2B7><EFBFBD>ϵĵ<CFB5><C4B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
public float duration = 5f; // <20>ƶ<EFBFBD><C6B6>ij<EFBFBD><C4B3><EFBFBD>ʱ<EFBFBD><CAB1>
|
|
|
|
|
public bool isLooping = false; // <20>Ƿ<EFBFBD>ѭ<EFBFBD><D1AD>·<EFBFBD><C2B7>
|
|
|
|
|
int startIndex = 0;
|
2024-11-12 21:53:49 +08:00
|
|
|
|
int endIndex = 0;
|
2024-11-16 02:05:07 +08:00
|
|
|
|
public string room_id;
|
2024-11-13 02:03:11 +08:00
|
|
|
|
public float Speed;
|
2024-11-12 19:43:17 +08:00
|
|
|
|
public Transform EndPos;
|
|
|
|
|
|
2024-11-16 02:05:07 +08:00
|
|
|
|
public Transform TypeEndPos0;
|
2024-11-12 19:43:17 +08:00
|
|
|
|
public Transform TypeEndPos1;
|
|
|
|
|
public Transform TypeEndPos2;
|
|
|
|
|
public Transform TypeEndPos3;
|
|
|
|
|
public Transform TypeEndPos4;
|
|
|
|
|
public Transform TypeEndPos5;
|
|
|
|
|
public Transform TypeEndPos6;
|
|
|
|
|
|
2024-11-12 21:53:49 +08:00
|
|
|
|
public Transform JumpPos;
|
2024-11-13 02:03:11 +08:00
|
|
|
|
|
|
|
|
|
public Transform Pos1Parent;
|
|
|
|
|
public Transform Pos2Parent;
|
|
|
|
|
public Transform Pos3Parent;
|
|
|
|
|
public Transform Pos4Parent;
|
|
|
|
|
public Transform Pos5Parent;
|
|
|
|
|
public Transform Pos6Parent;
|
|
|
|
|
|
|
|
|
|
public Transform OutParent;
|
|
|
|
|
|
|
|
|
|
public Transform ReturnPos;//<2F><><EFBFBD>ص<EFBFBD>λ<EFBFBD><CEBB>
|
|
|
|
|
|
|
|
|
|
public bool IsBoos;
|
2024-11-14 18:11:08 +08:00
|
|
|
|
|
|
|
|
|
public AllHouseContro allHouseContro;
|
2024-11-18 16:53:39 +08:00
|
|
|
|
|
|
|
|
|
public Transform SelfTextTrans;
|
|
|
|
|
public Transform SelfImage;
|
|
|
|
|
public bool IsOtherWoniu;
|
2024-11-22 12:15:36 +08:00
|
|
|
|
|
|
|
|
|
public PlayerMove player;//<2F><><EFBFBD><EFBFBD>
|
2024-11-12 19:43:17 +08:00
|
|
|
|
private void Start()
|
|
|
|
|
{
|
2024-11-13 02:03:11 +08:00
|
|
|
|
Speed = 2f;
|
2024-11-12 19:43:17 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
2024-11-13 02:03:11 +08:00
|
|
|
|
public void MoveOutParent()
|
|
|
|
|
{
|
|
|
|
|
// <20><>¼ԭʼ<D4AD>ĸ<EFBFBD><C4B8><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// <20><> childObject <20><>Ϊ<EFBFBD>µ<EFBFBD> parentObject <20><><EFBFBD>ӽڵ㣬<DAB5><E3A3AC><EFBFBD>ŵ<EFBFBD><C5B5><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>λ<EFBFBD><CEBB>
|
|
|
|
|
objectToMove.SetParent(OutParent);
|
|
|
|
|
objectToMove.SetAsLastSibling();
|
2024-11-12 19:43:17 +08:00
|
|
|
|
|
2024-11-13 02:03:11 +08:00
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
public void MoveInParent(Transform Parent)
|
2024-11-12 19:43:17 +08:00
|
|
|
|
{
|
2024-11-13 02:03:11 +08:00
|
|
|
|
objectToMove.SetParent(Parent);
|
|
|
|
|
objectToMove.SetAsFirstSibling();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void JudgeEnd()
|
|
|
|
|
{
|
|
|
|
|
if (EndPos == TypeEndPos1)
|
2024-11-12 19:43:17 +08:00
|
|
|
|
{
|
2024-11-14 18:11:08 +08:00
|
|
|
|
|
2024-11-13 18:01:18 +08:00
|
|
|
|
if (!IsBoos)
|
|
|
|
|
{
|
2024-11-18 16:53:39 +08:00
|
|
|
|
objectToMove.GetComponent<PlayerMovePos>().HouseId = 1;
|
2024-11-13 18:01:18 +08:00
|
|
|
|
}
|
2024-11-13 21:45:48 +08:00
|
|
|
|
else
|
|
|
|
|
{
|
2024-11-16 02:05:07 +08:00
|
|
|
|
GetComponent<BossContro>().HouseId = 1;
|
2024-11-13 21:45:48 +08:00
|
|
|
|
}
|
2024-11-12 19:43:17 +08:00
|
|
|
|
}
|
2024-11-13 02:03:11 +08:00
|
|
|
|
else if (EndPos == TypeEndPos2)
|
|
|
|
|
{
|
2024-11-12 19:43:17 +08:00
|
|
|
|
|
2024-11-14 18:11:08 +08:00
|
|
|
|
|
2024-11-13 18:01:18 +08:00
|
|
|
|
if (!IsBoos)
|
|
|
|
|
{
|
2024-11-18 16:53:39 +08:00
|
|
|
|
objectToMove.GetComponent<PlayerMovePos>().HouseId = 2;
|
2024-11-13 18:01:18 +08:00
|
|
|
|
}
|
2024-11-13 21:45:48 +08:00
|
|
|
|
else
|
|
|
|
|
{
|
2024-11-16 02:05:07 +08:00
|
|
|
|
GetComponent<BossContro>().HouseId = 2;
|
2024-11-13 21:45:48 +08:00
|
|
|
|
}
|
2024-11-13 02:03:11 +08:00
|
|
|
|
}
|
|
|
|
|
else if(EndPos == TypeEndPos3)
|
|
|
|
|
{
|
2024-11-14 18:11:08 +08:00
|
|
|
|
|
2024-11-13 18:01:18 +08:00
|
|
|
|
if (!IsBoos)
|
|
|
|
|
{
|
2024-11-18 16:53:39 +08:00
|
|
|
|
objectToMove.GetComponent<PlayerMovePos>().HouseId = 3;
|
2024-11-13 18:01:18 +08:00
|
|
|
|
}
|
2024-11-13 21:45:48 +08:00
|
|
|
|
else
|
|
|
|
|
{
|
2024-11-16 02:05:07 +08:00
|
|
|
|
GetComponent<BossContro>().HouseId = 3;
|
2024-11-13 21:45:48 +08:00
|
|
|
|
}
|
2024-11-13 02:03:11 +08:00
|
|
|
|
}
|
|
|
|
|
else if (EndPos == TypeEndPos4)
|
|
|
|
|
{
|
2024-11-14 18:11:08 +08:00
|
|
|
|
|
2024-11-13 18:01:18 +08:00
|
|
|
|
if (!IsBoos)
|
|
|
|
|
{
|
2024-11-18 16:53:39 +08:00
|
|
|
|
objectToMove.GetComponent<PlayerMovePos>().HouseId = 4;
|
2024-11-13 18:01:18 +08:00
|
|
|
|
}
|
2024-11-13 21:45:48 +08:00
|
|
|
|
else
|
|
|
|
|
{
|
2024-11-16 02:05:07 +08:00
|
|
|
|
GetComponent<BossContro>().HouseId = 4;
|
2024-11-13 21:45:48 +08:00
|
|
|
|
}
|
2024-11-13 02:03:11 +08:00
|
|
|
|
}
|
|
|
|
|
else if (EndPos == TypeEndPos5)
|
|
|
|
|
{
|
2024-11-14 18:11:08 +08:00
|
|
|
|
|
2024-11-13 18:01:18 +08:00
|
|
|
|
if (!IsBoos)
|
|
|
|
|
{
|
2024-11-18 16:53:39 +08:00
|
|
|
|
objectToMove.GetComponent<PlayerMovePos>().HouseId = 5;
|
2024-11-13 18:01:18 +08:00
|
|
|
|
}
|
2024-11-13 21:45:48 +08:00
|
|
|
|
else
|
|
|
|
|
{
|
2024-11-16 02:05:07 +08:00
|
|
|
|
GetComponent<BossContro>().HouseId = 5;
|
2024-11-13 21:45:48 +08:00
|
|
|
|
}
|
2024-11-13 02:03:11 +08:00
|
|
|
|
}
|
|
|
|
|
else if (EndPos == TypeEndPos6)
|
|
|
|
|
{
|
2024-11-14 18:11:08 +08:00
|
|
|
|
|
2024-11-13 18:01:18 +08:00
|
|
|
|
if (!IsBoos)
|
|
|
|
|
{
|
2024-11-18 16:53:39 +08:00
|
|
|
|
objectToMove.GetComponent<PlayerMovePos>().HouseId = 6;
|
2024-11-13 18:01:18 +08:00
|
|
|
|
}
|
2024-11-13 21:45:48 +08:00
|
|
|
|
else
|
|
|
|
|
{
|
2024-11-16 02:05:07 +08:00
|
|
|
|
GetComponent<BossContro>().HouseId = 6;
|
2024-11-13 21:45:48 +08:00
|
|
|
|
}
|
2024-11-13 02:03:11 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2024-11-14 18:11:08 +08:00
|
|
|
|
|
|
|
|
|
public void SetParentToHouse()
|
|
|
|
|
{
|
|
|
|
|
if (EndPos == TypeEndPos1)
|
|
|
|
|
{
|
|
|
|
|
MoveInParent(Pos1Parent);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else if (EndPos == TypeEndPos2)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
MoveInParent(Pos2Parent);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else if (EndPos == TypeEndPos3)
|
|
|
|
|
{
|
|
|
|
|
MoveInParent(Pos3Parent);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else if (EndPos == TypeEndPos4)
|
|
|
|
|
{
|
|
|
|
|
MoveInParent(Pos4Parent);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else if (EndPos == TypeEndPos5)
|
|
|
|
|
{
|
|
|
|
|
MoveInParent(Pos5Parent);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else if (EndPos == TypeEndPos6)
|
|
|
|
|
{
|
|
|
|
|
MoveInParent(Pos6Parent);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2024-11-13 02:03:11 +08:00
|
|
|
|
public void ReturnStartPos()//<2F>ص<EFBFBD><D8B5><EFBFBD>ʼ<EFBFBD><CABC>
|
|
|
|
|
{
|
2024-11-22 17:48:26 +08:00
|
|
|
|
transform.GetComponent<PlayerMovePos>().ReplySize();//<2F>ָ<EFBFBD><D6B8><EFBFBD>С
|
2024-11-19 17:55:35 +08:00
|
|
|
|
transform.SetParent(transform.GetComponent<PlayerMovePos>().Parent);
|
|
|
|
|
transform.position=ReturnPos.position;
|
|
|
|
|
transform.GetComponent<PlayerMovePos>().StartPos = ReturnPos;
|
2024-11-12 19:43:17 +08:00
|
|
|
|
}
|
|
|
|
|
|
2024-11-13 02:03:11 +08:00
|
|
|
|
|
2024-11-12 21:53:49 +08:00
|
|
|
|
public bool JudagePos1()
|
|
|
|
|
{
|
|
|
|
|
if (EndPos==TypeEndPos1)
|
|
|
|
|
{
|
|
|
|
|
return true ;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2024-11-12 19:43:17 +08:00
|
|
|
|
public void StartMove()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// <20><>ȡ·<C8A1><C2B7><EFBFBD>е<EFBFBD><D0B5><EFBFBD><EFBFBD>е<EFBFBD><D0B5><EFBFBD>λ<EFBFBD><CEBB>
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < pathPoints.Length; i++)
|
|
|
|
|
{
|
2024-11-18 16:53:39 +08:00
|
|
|
|
if (!IsBoos&& objectToMove.GetComponent<PlayerMovePos>().StartPos == pathPoints[i])
|
2024-11-12 19:43:17 +08:00
|
|
|
|
{
|
|
|
|
|
startIndex = i;
|
2024-11-20 10:24:18 +08:00
|
|
|
|
//Debug.Log("Startindex"+i);
|
2024-11-13 02:03:11 +08:00
|
|
|
|
|
2024-11-12 21:53:49 +08:00
|
|
|
|
}
|
2024-11-16 02:05:07 +08:00
|
|
|
|
else if (IsBoos && GetComponent<BossContro>().BoosStartPos== pathPoints[i])
|
2024-11-13 02:03:11 +08:00
|
|
|
|
{
|
|
|
|
|
startIndex = i;
|
2024-11-20 10:24:18 +08:00
|
|
|
|
//Debug.Log("Startindex" + i);
|
2024-11-13 02:03:11 +08:00
|
|
|
|
}
|
|
|
|
|
|
2024-11-12 21:53:49 +08:00
|
|
|
|
if (EndPos == pathPoints[i])
|
|
|
|
|
{
|
|
|
|
|
endIndex = i;
|
2024-11-20 10:24:18 +08:00
|
|
|
|
//Debug.Log("Endindex" + i);
|
2024-11-12 19:43:17 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
2024-11-12 21:53:49 +08:00
|
|
|
|
|
2024-11-12 19:43:17 +08:00
|
|
|
|
|
2024-11-12 21:53:49 +08:00
|
|
|
|
|
|
|
|
|
if (endIndex>startIndex)
|
2024-11-12 19:43:17 +08:00
|
|
|
|
{
|
2024-11-19 17:55:35 +08:00
|
|
|
|
if (IsBoos)
|
|
|
|
|
{
|
|
|
|
|
duration = 2f;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
duration=(endIndex-startIndex)/Speed;
|
|
|
|
|
}
|
|
|
|
|
|
2024-11-12 21:53:49 +08:00
|
|
|
|
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;
|
2024-11-12 19:43:17 +08:00
|
|
|
|
|
2024-11-12 21:53:49 +08:00
|
|
|
|
}
|
|
|
|
|
OnMove(waypoints);
|
2024-11-12 19:43:17 +08:00
|
|
|
|
}
|
2024-11-12 21:53:49 +08:00
|
|
|
|
else if(endIndex < startIndex)
|
|
|
|
|
{
|
2024-11-19 17:55:35 +08:00
|
|
|
|
if (IsBoos)
|
|
|
|
|
{
|
|
|
|
|
duration = 3f;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
duration = (startIndex-endIndex) / Speed;
|
|
|
|
|
}
|
|
|
|
|
//duration = (startIndex-endIndex) / Speed;
|
2024-11-12 21:53:49 +08:00
|
|
|
|
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;
|
2024-11-12 19:43:17 +08:00
|
|
|
|
|
2024-11-12 21:53:49 +08:00
|
|
|
|
}
|
|
|
|
|
OnMove(waypoints);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-11-12 19:43:17 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void AfterMove()
|
|
|
|
|
{
|
2024-11-12 21:53:49 +08:00
|
|
|
|
|
2024-11-21 00:04:33 +08:00
|
|
|
|
RectTransform rectTransform = objectToMove.GetComponent<RectTransform>();
|
2024-11-18 16:53:39 +08:00
|
|
|
|
if (IsBoos||!objectToMove.GetComponent<PlayerMovePos>().IsReturn)
|
2024-11-13 02:03:11 +08:00
|
|
|
|
{
|
2024-11-14 18:11:08 +08:00
|
|
|
|
if (!IsBoos)
|
|
|
|
|
{
|
2024-11-21 00:04:33 +08:00
|
|
|
|
//objectToMove.DOMoveY(objectToMove.position.y + 100, 0.5f).OnComplete(() => {
|
2024-11-22 17:48:26 +08:00
|
|
|
|
objectToMove.GetComponent<PlayerMovePos>().Zoomout();//<2F><>С
|
2024-11-21 00:04:33 +08:00
|
|
|
|
rectTransform.DOAnchorPosY(rectTransform.anchoredPosition.y + 80f, 0.5f)
|
|
|
|
|
.OnComplete(() => {
|
|
|
|
|
|
|
|
|
|
|
2024-11-14 18:11:08 +08:00
|
|
|
|
JudgeEnd();
|
|
|
|
|
SetParentToHouse();
|
2024-11-19 17:55:35 +08:00
|
|
|
|
|
2024-11-21 00:04:33 +08:00
|
|
|
|
|
2024-11-18 16:53:39 +08:00
|
|
|
|
objectToMove.GetComponent<PlayerMovePos>().StartPos = EndPos;
|
2024-11-13 02:03:11 +08:00
|
|
|
|
|
2024-11-13 18:01:18 +08:00
|
|
|
|
|
2024-11-18 16:53:39 +08:00
|
|
|
|
objectToMove.GetComponent<PlayerMovePos>().PlayAni.SetInteger("State", 0);
|
|
|
|
|
if (!IsOtherWoniu)
|
|
|
|
|
{
|
|
|
|
|
MaskContro.instance.SetMask(false);
|
|
|
|
|
}
|
2024-11-19 17:55:35 +08:00
|
|
|
|
else
|
|
|
|
|
{
|
2024-11-21 00:04:33 +08:00
|
|
|
|
rectTransform.anchoredPosition = new Vector2(rectTransform.anchoredPosition.x + Random.Range(-50, 50), rectTransform.anchoredPosition.y);
|
2024-11-19 17:55:35 +08:00
|
|
|
|
}
|
2024-11-14 18:11:08 +08:00
|
|
|
|
|
|
|
|
|
});
|
2024-11-21 00:04:33 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//});
|
2024-11-14 18:11:08 +08:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2024-11-18 16:53:39 +08:00
|
|
|
|
Debug.Log("cscscscscscscscscscscs");
|
2024-11-14 18:11:08 +08:00
|
|
|
|
JudgeEnd();
|
2024-11-16 02:05:07 +08:00
|
|
|
|
GetComponent<BossContro>().BossAni.SetInteger("State", 0);//ֹͣ<CDA3>ƶ<EFBFBD>
|
2024-11-18 16:53:39 +08:00
|
|
|
|
Debug.Log("nnnnnnnn");
|
2024-11-16 02:05:07 +08:00
|
|
|
|
allHouseContro.ControOneDoorOpen(GetComponent<BossContro>().HouseId,() => {//<2F><><EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
GetComponent<BossContro>().BossAni.SetInteger("State", 1);
|
2024-11-22 17:48:26 +08:00
|
|
|
|
GetComponent<BossContro>().Zoomout();//<2F><>С
|
|
|
|
|
rectTransform.DOAnchorPosY(rectTransform.anchoredPosition.y + 80f, 0.5f).OnComplete(() => {//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2024-11-13 18:01:18 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-11-14 18:11:08 +08:00
|
|
|
|
SetParentToHouse();
|
2024-11-22 17:48:26 +08:00
|
|
|
|
|
|
|
|
|
StartCoroutine(BoosAttack());
|
2024-11-16 02:05:07 +08:00
|
|
|
|
GetComponent<BossContro>().BoosStartPos = EndPos;
|
2024-11-14 18:11:08 +08:00
|
|
|
|
|
|
|
|
|
//JudgeSuccOrFail();
|
2024-11-13 18:01:18 +08:00
|
|
|
|
});
|
2024-11-14 18:11:08 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2024-11-13 02:03:11 +08:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2024-11-18 16:53:39 +08:00
|
|
|
|
objectToMove.GetComponent<PlayerMovePos>().IsReturn = false;//<2F><><EFBFBD><EFBFBD>
|
2024-11-13 18:01:18 +08:00
|
|
|
|
MaskContro.instance.SetMask(false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
2024-11-13 02:03:11 +08:00
|
|
|
|
|
|
|
|
|
|
2024-11-13 18:01:18 +08:00
|
|
|
|
IEnumerator BoosAttack()
|
|
|
|
|
{
|
2024-11-16 02:05:07 +08:00
|
|
|
|
GetComponent<BossContro>().BossAni.SetInteger("State", 2);
|
2024-11-13 18:01:18 +08:00
|
|
|
|
yield return new WaitForSeconds(3f);
|
2024-11-16 02:05:07 +08:00
|
|
|
|
GetComponent<BossContro>().BossAni.SetInteger("State", 0);
|
2024-11-22 12:15:36 +08:00
|
|
|
|
if (allHouseContro.KillNos.Count>0)
|
2024-11-22 09:49:32 +08:00
|
|
|
|
{
|
2024-11-22 12:15:36 +08:00
|
|
|
|
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();
|
2024-11-22 09:49:32 +08:00
|
|
|
|
}
|
2024-11-22 12:15:36 +08:00
|
|
|
|
|
2024-11-16 02:05:07 +08:00
|
|
|
|
BettingBtn.instance.GiveMoney(room_id);
|
2024-11-13 21:45:48 +08:00
|
|
|
|
yield return new WaitForSeconds(2f);
|
2024-11-21 17:27:26 +08:00
|
|
|
|
//allHouseContro.BoosReturn();
|
2024-11-16 05:56:57 +08:00
|
|
|
|
//JudgeSuccOrFail();
|
2024-11-13 18:01:18 +08:00
|
|
|
|
}
|
|
|
|
|
|
2024-11-13 02:03:11 +08:00
|
|
|
|
|
2024-11-21 17:27:26 +08:00
|
|
|
|
//public void JudgeSuccOrFail()
|
|
|
|
|
//{
|
|
|
|
|
// Debug.Log("=000000000000000000000000000000000000000000000000");
|
|
|
|
|
// if (GetComponent<BossContro>().BoosStartPos == transform.GetComponent<PlayerMovePos>().StartPos && transform.GetComponent<PlayerMovePos>().HadChoise)
|
|
|
|
|
// {
|
|
|
|
|
// //BossContro.instance.BossAni.SetInteger("State", 2);//boos<6F><73><EFBFBD><EFBFBD>
|
|
|
|
|
// Debug.Log("ʧ<><CAA7>");//ʧ<><CAA7>
|
|
|
|
|
// FailPanel.instance.ShowPanel();
|
|
|
|
|
// }
|
|
|
|
|
// else if (GetComponent<BossContro>().BoosStartPos != transform.GetComponent<PlayerMovePos>().StartPos && transform.GetComponent<PlayerMovePos>().HadChoise)
|
|
|
|
|
// {
|
|
|
|
|
// Debug.Log("ʤ<><CAA4>");//ʤ<><CAA4>
|
|
|
|
|
// SucceePanel.instance.ShowPanel();
|
|
|
|
|
// }
|
|
|
|
|
// else
|
|
|
|
|
// {
|
|
|
|
|
// Debug.Log("û<><C3BB>ʧ<EFBFBD>ܺ<EFBFBD>ʤ<EFBFBD><CAA4>");//ʤ<><CAA4>
|
|
|
|
|
// foreach (GameObject item in allHouseContro.bossobj)
|
|
|
|
|
// {
|
|
|
|
|
// item.GetComponent<BossContro>().ReturnParent();
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// //HegemonTime.instance.StartCoroutine(HegemonTime.instance.StartGame());//<2F><><EFBFBD>¼<EFBFBD><C2BC><EFBFBD>ʱ<EFBFBD><CAB1>
|
|
|
|
|
//}
|
2024-11-13 18:01:18 +08:00
|
|
|
|
|
|
|
|
|
public void Rotate()
|
|
|
|
|
{
|
2024-11-18 16:53:39 +08:00
|
|
|
|
|
2024-11-13 18:01:18 +08:00
|
|
|
|
Vector3 currentRotation = objectToMove.localEulerAngles;
|
|
|
|
|
currentRotation.y += 180f;
|
|
|
|
|
objectToMove.localEulerAngles = currentRotation;
|
2024-11-18 16:53:39 +08:00
|
|
|
|
|
2024-11-12 21:53:49 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void OnMove(Vector3[] waypoints)
|
|
|
|
|
{
|
2024-11-13 18:01:18 +08:00
|
|
|
|
if (!IsBoos)
|
|
|
|
|
{
|
2024-11-18 16:53:39 +08:00
|
|
|
|
objectToMove.GetComponent<PlayerMovePos>().PlayAni.SetInteger("State", 1);
|
2024-11-22 17:48:26 +08:00
|
|
|
|
objectToMove.GetComponent<PlayerMovePos>().ReplySize();//<2F>ָ<EFBFBD><D6B8><EFBFBD>С
|
2024-11-18 16:53:39 +08:00
|
|
|
|
if (!IsOtherWoniu)
|
|
|
|
|
{
|
|
|
|
|
MaskContro.instance.SetMask(true);
|
|
|
|
|
}
|
|
|
|
|
|
2024-11-13 18:01:18 +08:00
|
|
|
|
}
|
|
|
|
|
|
2024-11-13 02:03:11 +08:00
|
|
|
|
MoveOutParent();
|
2024-11-22 17:48:26 +08:00
|
|
|
|
|
2024-11-12 21:53:49 +08:00
|
|
|
|
Tween pathTween = objectToMove.DOPath(waypoints, duration, PathType.Linear)
|
2024-11-13 18:01:18 +08:00
|
|
|
|
.SetEase(Ease.Linear) // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Թ<EFBFBD><D4B9><EFBFBD>Ч<EFBFBD><D0A7>
|
|
|
|
|
.SetLoops(isLooping ? -1 : 0)
|
|
|
|
|
.OnWaypointChange((index) =>
|
|
|
|
|
{
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD>嵽<EFBFBD><E5B5BD>ij<EFBFBD><C4B3>·<EFBFBD><C2B7><EFBFBD><EFBFBD>ʱ<EFBFBD>ص<EFBFBD>
|
|
|
|
|
if (index < waypoints.Length - 1)
|
|
|
|
|
{
|
|
|
|
|
Vector3 currentWaypoint = waypoints[index];
|
|
|
|
|
Vector3 nextWaypoint = waypoints[index + 1];
|
|
|
|
|
if (IsBoos)
|
|
|
|
|
{
|
2024-11-16 02:05:07 +08:00
|
|
|
|
if (nextWaypoint.x < currentWaypoint.x && !GetComponent<BossContro>().IsLeft)
|
2024-11-13 18:01:18 +08:00
|
|
|
|
{
|
2024-11-16 02:05:07 +08:00
|
|
|
|
GetComponent<BossContro>().IsLeft = true;
|
2024-11-13 18:01:18 +08:00
|
|
|
|
// <20><>ת<EFBFBD><D7AA><EFBFBD><EFBFBD>ʹ<EFBFBD><CAB9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ࣨ<EFBFBD><E0A3A8>Y<EFBFBD><59><EFBFBD><EFBFBD>ת180<38>ȣ<EFBFBD>
|
|
|
|
|
Rotate();
|
|
|
|
|
}
|
2024-11-16 02:05:07 +08:00
|
|
|
|
else if (nextWaypoint.x > currentWaypoint.x && GetComponent<BossContro>().IsLeft)
|
2024-11-13 18:01:18 +08:00
|
|
|
|
{
|
2024-11-16 02:05:07 +08:00
|
|
|
|
GetComponent<BossContro>().IsLeft = false;
|
2024-11-13 18:01:18 +08:00
|
|
|
|
Rotate();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
// <20>ж<EFBFBD><D0B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD>Ҫ<EFBFBD><D2AA>ת
|
2024-11-18 16:53:39 +08:00
|
|
|
|
if (nextWaypoint.x < currentWaypoint.x && !objectToMove.GetComponent<PlayerMovePos>().IsLeft)
|
2024-11-13 18:01:18 +08:00
|
|
|
|
{
|
2024-11-18 16:53:39 +08:00
|
|
|
|
objectToMove.GetComponent<PlayerMovePos>().IsLeft = true;
|
2024-11-13 18:01:18 +08:00
|
|
|
|
// <20><>ת<EFBFBD><D7AA><EFBFBD><EFBFBD>ʹ<EFBFBD><CAB9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ࣨ<EFBFBD><E0A3A8>Y<EFBFBD><59><EFBFBD><EFBFBD>ת180<38>ȣ<EFBFBD>
|
|
|
|
|
Rotate();
|
|
|
|
|
}
|
2024-11-18 16:53:39 +08:00
|
|
|
|
else if (nextWaypoint.x > currentWaypoint.x && objectToMove.GetComponent<PlayerMovePos>().IsLeft)
|
2024-11-13 18:01:18 +08:00
|
|
|
|
{
|
2024-11-18 16:53:39 +08:00
|
|
|
|
objectToMove.GetComponent<PlayerMovePos>().IsLeft = false;
|
2024-11-13 18:01:18 +08:00
|
|
|
|
Rotate();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
.OnComplete(AfterMove);
|
2024-11-12 19:43:17 +08:00
|
|
|
|
}
|
|
|
|
|
}
|