_TheStrongestSnail/TheStrongestSnail/Assets/Scripts/Battle_Royale/BossContro.cs

127 lines
3.7 KiB
C#
Raw Normal View History

using DG.Tweening;
2024-11-13 02:03:11 +08:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
2024-11-13 02:03:11 +08:00
public class BossContro : MonoBehaviour
{
public Transform Parent;
public Transform originalParent;
public Transform BoosStartPos;
2024-11-16 02:05:07 +08:00
//public static BossContro instance;
2024-11-13 02:03:11 +08:00
public Transform StartPos;
2024-11-13 18:01:18 +08:00
public Animator BossAni;//boos<6F><73><EFBFBD><EFBFBD>
public bool IsLeft;
2024-11-13 21:45:48 +08:00
public int HouseId;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
2024-11-14 18:11:08 +08:00
public Transform BoosHouse;//boos<6F><73><EFBFBD><EFBFBD>
2024-11-15 12:09:52 +08:00
public AllHouseContro allHouseContro;
2024-11-16 02:05:07 +08:00
public GameObject bg;
2024-11-16 05:56:57 +08:00
public Vector2 OrPos;
2024-11-22 09:49:32 +08:00
public Allother allother;
private Vector3 originalScale; // <20><><EFBFBD><EFBFBD>ԭʼ<D4AD><CABC>С
2024-11-13 02:03:11 +08:00
// Start is called before the first frame update
void Start()
{
2024-11-16 02:05:07 +08:00
//instance = this;
2024-11-13 02:03:11 +08:00
originalParent = transform.parent;
2024-11-21 12:03:01 +08:00
OrPos = transform.GetComponent<RectTransform>().anchoredPosition;
originalScale=transform.localScale;
}
public void Zoomout()//<2F><>С
{
Image image = GetComponent<Image>();
image.rectTransform.DOScale(0.9f, 0.5f).SetEase(Ease.Linear);
}
public void ReplySize()//<2F>ָ<EFBFBD><D6B8><EFBFBD>С
{
Image image = GetComponent<Image>();
image.rectTransform.DOScale(originalScale, 0.5f).SetEase(Ease.Linear);
2024-11-13 02:03:11 +08:00
}
public void MoveParent()
{
// <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>
transform.SetParent(Parent);
transform.SetAsLastSibling();
}
2024-11-13 02:03:11 +08:00
public void ReturnParent()
{
ReplySize();
2024-11-13 02:03:11 +08:00
// <20><>Ҫʱ<D2AA><CAB1> childObject <20>ƻ<EFBFBD>ԭʼ<D4AD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E5A3AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>һ<EFBFBD><D2BB><EFBFBD>ӽڵ<D3BD>
transform.SetParent(originalParent);
transform.SetAsFirstSibling(); // <20><><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>һ<EFBFBD><D2BB><EFBFBD>ӽڵ<D3BD>
2024-11-16 05:56:57 +08:00
Vector3 RePos = StartPos.position;
2024-11-21 12:03:01 +08:00
transform.GetComponent<RectTransform>().anchoredPosition = OrPos;
2024-11-16 05:56:57 +08:00
2024-11-13 02:03:11 +08:00
BoosStartPos=StartPos;
2024-11-16 05:56:57 +08:00
//allHouseContro.CloseBoosDoor(BoosHouse.GetComponent<HouseBtn>());
//Tools.MoveUpOrDwon(transform.parent.GetComponent<HouseBtn>().door, -270);//<2F><><EFBFBD><EFBFBD>
2024-11-14 18:11:08 +08:00
2024-11-13 02:03:11 +08:00
}
2024-11-14 18:11:08 +08:00
2024-11-16 02:05:07 +08:00
public void BossMove(int Index)
2024-11-13 02:03:11 +08:00
{
2024-11-16 02:05:07 +08:00
Debug.Log("===========--------------");
foreach (HouseBtn item in allHouseContro.HouseBtnList)
{
Debug.Log(item.roomNo.ToString() + "|" + Index.ToString());
if (item.roomNo == Index)
{
GetComponent<PlayerMove>().EndPos = item.post.transform;
}
2024-11-13 02:03:11 +08:00
}
2024-11-16 02:05:07 +08:00
//GetComponent<PlayerMove>().TypeEndPos1
//switch (Index)
//{
// case 1:
// GetComponent<PlayerMove>().EndPos = GetComponent<PlayerMove>().TypeEndPos1;
// break;
// case 2:
// GetComponent<PlayerMove>().EndPos = GetComponent<PlayerMove>().TypeEndPos2;
// break;
// case 3:
// GetComponent<PlayerMove>().EndPos = GetComponent<PlayerMove>().TypeEndPos3;
// break;
// case 4:
// GetComponent<PlayerMove>().EndPos = GetComponent<PlayerMove>().TypeEndPos4;
// break;
// case 5:
// GetComponent<PlayerMove>().EndPos = GetComponent<PlayerMove>().TypeEndPos5;
// break;
// case 6:
// GetComponent<PlayerMove>().EndPos = GetComponent<PlayerMove>().TypeEndPos6;
// break;
// case 0:
// GetComponent<PlayerMove>().EndPos = GetComponent<PlayerMove>().TypeEndPos0;
// break;
//}
2024-11-13 02:03:11 +08:00
//MoveParent();
2024-11-15 12:09:52 +08:00
BossAni.SetInteger("State", 1); // <20><><EFBFBD><EFBFBD>תΪ<D7AA>ƶ<EFBFBD>
2024-11-14 18:11:08 +08:00
GetComponent<PlayerMove>().StartMove(); // <20><>ʼ<EFBFBD>ƶ<EFBFBD>
2024-11-15 12:09:52 +08:00
//Tools.MoveUpOrDwon(transform.parent.GetComponent<HouseBtn>().door, 270, () => {
//});
2024-11-13 02:03:11 +08:00
}
}