fix:恢复以前sdk,调整每个boss在眼镜里的效果

This commit is contained in:
bzx
2026-01-28 11:10:59 +08:00
parent 395badc600
commit e9dc7cd79c
65 changed files with 70948 additions and 91970 deletions

View File

@@ -278,13 +278,18 @@ public class FrogIdleMove : Action
{
public float moveRadius = 4f; // 扇形半径
public float moveAngle = 90f; // 扇形角度
public float stayTime = 1.5f; // 到点后停留时间
public float stayTime = 3f; // 到点后停留时间
public float rotateSpeed = 360f;
private FrogBoss boss;
private Transform player;
private float stayTimer;
private Vector3 curTarget;
[Header("Distance To Player")]
public float minPlayerDistance = 10f; // 最近不能小于
public float maxPlayerDistance = 20f; // 最远不能超过
public override void OnStart()
{
@@ -348,20 +353,41 @@ public class FrogIdleMove : Action
{
stayTimer = 0f;
Vector3 forward = (player.position - transform.position).normalized;
forward.y = 0;
Vector3 bossPos = transform.position;
Vector3 toPlayer = player.position - bossPos;
toPlayer.y = 0;
float angle = Random.Range(-moveAngle * 0.5f, moveAngle * 0.5f);
Vector3 dir = Quaternion.Euler(0, angle, 0) * forward;
// 玩家正前方扇形
Vector3 forward = toPlayer.normalized;
float dist = Random.Range(moveRadius * 0.4f, moveRadius);
Vector3 rawTarget = player.position + dir * dist;
const int MAX_TRY = 10;
for (int i = 0; i < MAX_TRY; i++)
{
float angle = Random.Range(-moveAngle * 0.5f, moveAngle * 0.5f);
Vector3 dir = Quaternion.Euler(0, angle, 0) * forward;
// 用 A* 校正到可走点
NNInfo nn = AstarPath.active.GetNearest(rawTarget);
curTarget = nn.position;
float dist = Random.Range(moveRadius * 0.4f, moveRadius);
Vector3 candidate = bossPos + dir * dist;
// 👉 与玩家距离校验
float playerDist = Vector3.Distance(candidate, player.position);
if (playerDist < minPlayerDistance || playerDist > maxPlayerDistance)
continue;
// A* 校正
NNInfo nn = AstarPath.active.GetNearest(candidate);
if (nn.node != null && nn.node.Walkable)
{
curTarget = nn.position;
return;
}
}
// 🔥 兜底:保持原地
curTarget = bossPos;
}
#endregion
}

View File

@@ -223,7 +223,7 @@ public class OctopusSpikeAttack : Action
);
for (int i = 0; i < list.Count; i++)
{
GameManager.Ins.CreateEnemySkillTip(points[i].ReflectVectorXOZ(),2.5f);
GameManager.Ins.CreateEnemySkillTip(points[i].ReflectVectorXOZ()+new Vector3(0,0.01f,0),2.5f);
}
// TODO生成红圈提示
yield return new WaitForSeconds(3f);

View File

@@ -11,7 +11,7 @@ public class TortoiseSprintAttack : Action
[Header("Sprint")]
public float sprintDistance = 3f;
public float sprintSpeed = 6f;
public float sprintSpeed = 3f;
[Header("Angry Trample")]
public float angryDuration = 3f;

View File

@@ -180,7 +180,7 @@ public class DeathKnightBoss : Enemy
{
IsSwordSkillFinished = false;
Vector3 targetPos = GameManager.Ins.player.transform.position;
Vector3 targetPos = GameManager.Ins.player.transform.position.ReflectVectorXOZ();
swordPre.SetActive(false); // Boss 手上剑隐藏
swordEx.SetActive(false);
DeathSwordProjectile sword = Instantiate(
@@ -307,7 +307,12 @@ public class DeathKnightBoss : Enemy
if(behaviourTree != null)
behaviourTree.enabled = false;
GameManager.Ins.PlaySound3D("1.53",transform);
foreach (var item in bossCrystals)
{
if(item==null)
continue;
item.SetActive(false);
}
StartCoroutine(DeathDissolve());
}
@@ -321,7 +326,7 @@ public class DeathKnightBoss : Enemy
yield return new WaitForSeconds(3f);
clipQuadObj.transform.DOLocalMoveY(-5f, 5);
yield return new WaitForSeconds(8f);
Destroy(gameObject);
GameManager.Ins.WinEndGame();
}
}

View File

@@ -51,6 +51,7 @@ public class DeathSwordProjectile : MonoBehaviour
// 2⃣ 插入地面
transform.eulerAngles = Vector3.zero;
transform.position=transform.position.ReflectVectorXOZ();
// 3⃣ 生成雷电区域
GameObject area = Instantiate(

View File

@@ -1,3 +1,4 @@
using System;
using System.Collections;
using System.Collections.Generic;
using DG.Tweening;
@@ -68,7 +69,7 @@ public class FrogBoss : Enemy
bloodSlider.gameObject.SetActive(true);
foreach (var item in bossCrystals)
{
item.SetActive(false);
item.SetActive(true);
}
}, 2f);
});
@@ -140,7 +141,8 @@ public class FrogBoss : Enemy
bossAnim.SetInteger("State", 5);
}
public float tongueRange = 6f;
[NonSerialized]
public float tongueRange = 20f;
public float moveSpeed = 3.5f;
public bool IsPlayerInTongueRange()
@@ -199,6 +201,12 @@ public class FrogBoss : Enemy
if(behaviourTree != null)
behaviourTree.enabled = false;
GameManager.Ins.PlaySound3D("1.46",transform);
foreach (var item in bossCrystals)
{
if(item==null)
continue;
item.SetActive(false);
}
foreach (var item in GetAliveTentacles())
{
item.Dead();

View File

@@ -104,6 +104,12 @@ public class OctopusBoss : Enemy
{
item.Dead();
}
foreach (var item in bossCrystals)
{
if(item==null)
continue;
item.SetActive(false);
}
StartCoroutine(DeathDissolve());
}

View File

@@ -46,6 +46,7 @@ public class TortoiseBoss : Enemy
{
item.SetActive(false);
}
bloodSlider.gameObject.SetActive(false);
}
public override void Update()
@@ -77,6 +78,7 @@ public class TortoiseBoss : Enemy
{
item.SetActive(true);
}
bloodSlider.gameObject.SetActive(true);
}, 2f);
});
}
@@ -127,7 +129,7 @@ public class TortoiseBoss : Enemy
{
skill3Effect.SetActive(false);
skill3Collider.enabled = false;
mainCollider.enabled = false;
bossAnim.SetInteger("State", 8); // 钻出
yield return new WaitForSeconds(3f); // 钻出动画
@@ -136,7 +138,6 @@ public class TortoiseBoss : Enemy
yield return null;
aiPath.enabled = true;
mainCollider.enabled = true;
GameManager.Ins.PlaySound3D("1.27", transform, true);
Idle();
@@ -180,6 +181,12 @@ public class TortoiseBoss : Enemy
ColliderComponent.enabled = false;
if(behaviourTree != null)
behaviourTree.enabled = false;
foreach (var item in bossCrystals)
{
if(item==null)
continue;
item.SetActive(false);
}
GameManager.Ins.PlaySound3D("1.46",transform);
StartCoroutine(DeathDissolve());
}

View File

@@ -23,4 +23,9 @@ public class AudioManager : MonoBehaviour
bgmAudioScource.volume = 0.5f;
bgmAudioScource.Play();
}
public void StopLoop()
{
bgmAudioScource.loop = false;
}
}

View File

@@ -41,9 +41,7 @@ public class GameInit : MonoBehaviour
Ins = this;
Application.targetFrameRate = 60;
#if !UNITY_EDITOR && UNITY_ANDROID && PICO
PXR_Plugin.Render.UPxr_EnablePremultipliedAlpha(true);
PXR_MixedReality.EnableVideoSeeThroughEffect(true);
#endif
}

View File

@@ -5,7 +5,6 @@ using System.Collections;
using System.Collections.Generic;
using DarkTonic.MasterAudio;
using Unity.Mathematics;
using Unity.XR.PICO.TOBSupport;
using Unity.XR.PXR;
using UnityEngine;
using XPlugin.Data.JsonLiteDB;
@@ -482,6 +481,8 @@ public class GameManager : MonoBehaviour
public void CreateBoss(Vector3 startPos)
{
if(isGameEnd)
return;
AudioManager.Ins.SoundPlay(curLevel, true);
CreateEnemy(curLevel, startPos, Vector3.zero, true);
if (curLevel != 0)
@@ -491,8 +492,9 @@ public class GameManager : MonoBehaviour
public void WinEndGame()
{
isGameEnd = true;
ShowEndGameUI(true);
GameInit.Ins.PlayAudio("1.17", GameInit.Ins.self.transform, true);
AudioManager.Ins.SoundPlay(5, true);
////修改处销毁AI角色
if (aiCharacter != null)
@@ -503,24 +505,24 @@ public class GameManager : MonoBehaviour
{
aiController.OnIntroductionComplete -= StartGameAfterIntroduction;
}
Destroy(aiCharacter);
}
}
public void LoseEndGame()
public void LoseEndGame(bool isWin)
{
ShowEndGameUI(false);
ShowEndGameUI(isWin);
if (curBoss != null)
{
Destroy(curBoss.gameObject);
curBoss.Dead();
}
GameInit.Ins.self.IsAlive = false;
GameInit.Ins.self.End();
isGameEnd = true;
CurEnemyDie();
//CurEnemyDie();
AudioManager.Ins.SoundPlay(6, true);
AudioManager.Ins.StopLoop();
//修改处销毁AI角色
if (aiCharacter != null)
{

View File

@@ -241,8 +241,9 @@ public class Player : MonoBehaviour
public void UserZeroGun()
{
CurGunId = 0;
playerHands.PickUpAndSwitchTo(0, 10000);
CurGunId = 1;
playerHands.PickUpAndSwitchTo(1, 10000);
Debug.LogError("切换成初始枪");
}
#endregion

View File

@@ -59,7 +59,7 @@ public class PlayerBullet : MonoBehaviour
{
if(GameManager.Ins.PlayerBulletDataDic.Count>0)
_damages = GameManager.Ins.PlayerBulletDataDic[(int)bulletType].Damage;
int randomDamage = Random.Range(_damages[0], _damages[1]);
int randomDamage = Random.Range(_damages[0]*10, _damages[1]*10);
randomDamage += (Mathf.FloorToInt(GameManager.Ins.buffAtk * randomDamage));
isCriticalHit=randomDamage > (_damages[1] - (_damages[1] - _damages[0]) * 0.35f);
return randomDamage;

View File

@@ -15,7 +15,8 @@ public class PlayerUI : MonoBehaviour
public TMP_Text timeTxt;
public float second;
[NonSerialized]
public float second=60*15f;
public GameObject[] teachUIs;
@@ -186,7 +187,7 @@ public class PlayerUI : MonoBehaviour
else
{
GameManager.Ins.curTime = second;
GameManager.Ins.LoseEndGame();
GameManager.Ins.LoseEndGame(false);
timeTxt.text = "00:00";
}
}