记录副本更新ui

This commit is contained in:
2026-02-09 10:44:38 +08:00
parent 3de1afe838
commit 5269bc7e6a
176 changed files with 615126 additions and 638503 deletions
@@ -15,18 +15,18 @@ public class MonsterContral : MonoBehaviour
public MonsterDataBase monsterData = new MonsterDataBase(new MonsterHealthBase());
public SkeletonAnimation skeleton;
public bool isSpine = true;
public Dictionary<CharacterAnimationType, string> dic_AnimKeyAnimName = new Dictionary<CharacterAnimationType, string>();
public CharacterStateType currState;
public GameObject effect_Hurt;//遮罩闪烁
public int HP = 5;
public GameObject effect_Die;//删除
GameObject hurt;
public FishTypeEnum fishType=FishTypeEnum.普通鱼;
public bool isMove = true;
//递归查找子物体
Transform FindDeepChild(Transform parent, string name)
{
foreach (Transform child in parent)
{
if (child.name == name)
@@ -37,29 +37,63 @@ public class MonsterContral : MonoBehaviour
}
return null;
}
public void Init(BezierCurveData bezierCurveData, float Time, bool isyuzhen = false)
public void Init(BezierCurveData bezierCurveData, float Time, bool isyuzhen = false, string yzID = "")
{
monsterData.moveLine.Init(bezierCurveData, 10);
monsterData.moveLine.Init(bezierCurveData, Time);
isyz = isyuzhen;
if (bezierCurveData.start.y>0)
this.yzID = yzID;
if (yzID != "")
switch (yzID.Substring(0, 3))
{
case "700":
if (bezierCurveData.start.y < 0)
{
//float z = transform.localEulerAngles.z; transform.localEulerAngles = new Vector3(0, 0, z + 180);
//transform.rotation= Quaternion.Euler(Vector3.forward*180+transform.eulerAngles);
var v = transform.localScale;
v.y *= -1;
transform.localScale = v;
}
break;
case "701":
break;
default:
break;
}
switch ((FishTypeEnum)monsterData.fishTypeConfig.fishType)
{
transform.Rotate(Vector3.forward * 180);
case FishTypeEnum.普通鱼:
Destroy(gameObject, Time);
break;
case FishTypeEnum.Boss鱼:
Destroy(gameObject, Time);
break;
case FishTypeEnum.黄金鱼:
Destroy(gameObject, Time);
break;
case FishTypeEnum.特殊鱼:
Destroy(gameObject, Time);
break;
default:
break;
}
}
private void Awake()
{
var t = FindDeepChild(transform,"HitEffect");
if (t!=null)
var t = FindDeepChild(transform, "HitEffect");
if (t != null)
{
hurt = t.gameObject;
hurt.SetActive(false);
}
}
public void OnHurt()
{
if (hurt!=null)
if (hurt != null)
{
StartCoroutine(Hurt());
}
@@ -97,18 +131,61 @@ public class MonsterContral : MonoBehaviour
}
float moveTime = 0;
public bool isyz = false;
public string yzID="";
public string yzID = "";
public virtual void OnMoveUpdata()
{
if (isyz)
{
switch (yzID)
switch (yzID.Substring(0, 3))
{
case "30001":
//向正前方移动
case "700":
moveTime += Time.deltaTime;
var movestart=monsterData.moveLine.bezierCurveData.start;
Vector2 v2 = movestart+(Vector2)(transform.up*moveTime* monsterData.moveLine.moveTime);
transform.position = v2;
//可优化
var movestart = monsterData.moveLine.bezierCurveData.start;
movestart = CoordinateTransformation.CanvasToWorld(movestart, UIManager.Instance.uiRoot.GetComponent<RectTransform>(), Camera.main);
//Debug.Log("movestart:"+movestart);
if (monsterData.moveLine.bezierCurveData.start.y > 0)
{
Vector2 v2 = movestart + (Vector2)(-1 * transform.up * moveTime * monsterData.moveLine.moveTime);
transform.position = v2;
}
else
{
Vector2 v2 = movestart + (Vector2)(transform.up * moveTime * monsterData.moveLine.moveTime);
transform.position = v2;
}
//Vector2 v2 = movestart+(Vector2)(-1*transform.up*moveTime* monsterData.moveLine.moveTime);
//transform.position = v2;
break;
case "701":
moveTime += Time.deltaTime;
//可优化
movestart = monsterData.moveLine.bezierCurveData.start;
movestart = CoordinateTransformation.CanvasToWorld(movestart, UIManager.Instance.uiRoot.GetComponent<RectTransform>(), Camera.main);
//Debug.Log("movestart:" + movestart);
{
Vector2 v2 = movestart + (Vector2)(-1 * transform.up * moveTime * monsterData.moveLine.moveTime);
transform.position = v2;
}
break;
case "702":
moveTime += Time.deltaTime;
{
Vector2 v2 = monsterData.moveLine.GetBezierPoint(moveTime);
if ( (FishTypeEnum)monsterData.fishTypeConfig.fishType != FishTypeEnum.Boss鱼)
{
transform.up = ((Vector2)transform.position - v2).normalized;
}
transform.position = v2;
}
break;
default:
break;
@@ -118,21 +195,21 @@ public class MonsterContral : MonoBehaviour
{
moveTime += Time.deltaTime;
Vector2 v2 = monsterData.moveLine.GetBezierPoint(moveTime);
if (fishType != FishTypeEnum.Boss鱼)
if ((FishTypeEnum)monsterData.fishTypeConfig.fishType != FishTypeEnum.Boss鱼)
{
transform.up = ((Vector2)transform.position - v2).normalized;
}
transform.position = v2;
}
}
public void PlayAnim(CharacterAnimationType animType, bool loop = true)
{
if (skeleton!=null)
skeleton.AnimationState.SetAnimation(0, dic_AnimKeyAnimName[animType], loop);
if (skeleton != null)
skeleton.AnimationState.SetAnimation(0, dic_AnimKeyAnimName[animType], loop);
}
public void OnEnter(CharacterStateType stateType)
{
@@ -149,6 +226,10 @@ public class MonsterContral : MonoBehaviour
}
public void OnUpdate(CharacterStateType stateType)
{
if (!isMove)
{
return;
}
switch (stateType)
{
case CharacterStateType.move: