fix:调整鸡蛋攻击

This commit is contained in:
bzx
2025-07-25 14:30:55 +08:00
parent 63cb40609a
commit e41ca6923d
24 changed files with 40033 additions and 90 deletions

View File

@@ -76,10 +76,8 @@ public class GameManager : MonoBehaviour
HUDPanel.Show();
taskManager.bg.SetActive(true);
CreateEnemy(new Vector3(0,1,5), new Vector3(0,180,0));
// enemy.SetState(2);
// taskManager.curTaskId = 2;
// taskManager.StartTask();
// taskManager.curTaskId = 3;
// taskManager.StartTask();
@@ -196,9 +194,9 @@ public class GameManager : MonoBehaviour
public GameObject CreateGemKey(Vector3 pos,Vector3 eulerAngles,Transform box)
{
var key= Instantiate(gemKeyPre, pos,Quaternion.identity);
key.transform.eulerAngles = eulerAngles;
key.transform.parent = box;
var key= Instantiate(gemKeyPre, pos,Quaternion.identity,box);
key.transform.localEulerAngles = eulerAngles;
key.transform.localPosition = pos;
return key;
}
@@ -220,6 +218,8 @@ public class GameManager : MonoBehaviour
public void PlayerHit()
{
if(enemy.isDie)
return;
//玩家UI模糊
HUDPanel.Ins.ShowEgg();
Debug.Log("击中玩家");
@@ -228,6 +228,8 @@ public class GameManager : MonoBehaviour
public void EnemyHit(Vector3 pos)
{
if(enemy.isDie)
return;
enemy.Hit();
PlaySound3DRPC("1.49",enemy.transform,true);
CreateEggEx(pos);

View File

@@ -80,7 +80,7 @@ public class CarrotGem : MonoBehaviour
{
LaunchTowards(GameManager.Ins.playerRightHand.transform);
yield return !_isMove;
GameManager.Ins.PlaySound2DRPC("1.13");
GameManager.Ins.PlaySound2DRPC("1.51");
_isGet = true;
yield return new WaitForSeconds(4f);
GameManager.Ins.taskManager.CompleteTask();

View File

@@ -19,6 +19,8 @@ public class TaskBox : MonoBehaviour
public GameObject[] effectObjs;
public TaskBoxType taskBoxType;
public Transform lockPos;
[Header("References")]
public ParticleSystem explosionEffect; // 宝箱爆炸烟雾粒子
@@ -58,16 +60,9 @@ public class TaskBox : MonoBehaviour
transform.eulerAngles = new Vector3(0, 180, 0);
MonoSingleton<CoroutineTaskManager>.Instance.WaitSecondTodo(() =>
{
if (!isOpen)
{
GameManager.Ins.playerRightHand.ChangeHand();
var key = GameManager.Ins.playerRightHand.gemKey;
_gemKey= GameManager.Ins.CreateGemKey(key.transform.position,key.transform.eulerAngles,transform);
GameManager.Ins.PlaySound2DRPC("1.39");
StartCoroutine(CreatePuzzle());
isOpen = true;
}
},6f);
if(!isOpen)
GameManager.Ins.playerRightHand.MoveGemKey(lockPos,GetKey);
},12f);
}
}
@@ -215,17 +210,29 @@ public class TaskBox : MonoBehaviour
Destroy(gameObject);
}
private GameObject _gemKey;
private void OnTriggerEnter(Collider other)
private void Update()
{
if (other.tag == "GemKey")
if (taskBoxType == TaskBoxType.TaskEndBox&&GameManager.Ins.playerRightHand.gemKeyUp!=null)
{
GameManager.Ins.playerRightHand.ChangeHand();
var key = GameManager.Ins.playerRightHand.gemKey;
_gemKey= GameManager.Ins.CreateGemKey(key.transform.position,key.transform.eulerAngles,transform);
GameManager.Ins.PlaySound2DRPC("1.39");
StartCoroutine(CreatePuzzle());
isOpen = true;
var dir = Vector3.Distance(GameManager.Ins.playerRightHand.gemKeyUp.position, lockPos.position);
if (dir < 0.1f)
{
GetKey();
}
}
}
public void GetKey()
{
if(isOpen)
return;
GameManager.Ins.playerRightHand.ChangeHand();
var key = GameManager.Ins.playerRightHand.gemKey;
_gemKey= GameManager.Ins.CreateGemKey(new Vector3(0,0.2f,0.3f),new Vector3(0,90,90),transform);
GameManager.Ins.PlaySound2DRPC("1.39");
StartCoroutine(CreatePuzzle());
Destroy(key);
isOpen = true;
}
private GameObject _gemKey;
}

View File

@@ -25,6 +25,7 @@ public class RightHand : MonoBehaviour
public GameObject gemKeyHand;
public GameObject gemKey;
public Transform gemKeyUp;
public GameObject skillet;
public GameObject skilletEx;
@@ -161,8 +162,9 @@ public class RightHand : MonoBehaviour
item.SetActive(true);
}
yield return new WaitForSeconds(3f);
gems[0].transform.DOMove(gems[1].transform.position, 2f);
gems[2].transform.DOMove(gems[1].transform.position, 2f).OnComplete(()=>
Vector3 targetLocalPos = gems[1].transform.localPosition;
gems[0].transform.DOLocalMove(targetLocalPos, 2f);
gems[2].transform.DOLocalMove(targetLocalPos, 2f).OnComplete(()=>
{
GameManager.Ins.PlaySound2DRPC("1.37");
GameManager.Ins.PlaySound2DRPC("1.14");
@@ -175,6 +177,16 @@ public class RightHand : MonoBehaviour
});
}
public void MoveGemKey(Transform target,Action cb)
{
gemKey.transform.parent = null;
gemKey.transform.DOMove(target.position, 2f).OnComplete(() =>
{
cb();
});
gemKey.transform.DORotate(new Vector3(0, -90, 90), 2f);
}
public void ChangeHand()
{
hand.SetActive(true);

View File

@@ -31,7 +31,7 @@ public class EggBullet : MonoBehaviour
private float arrivalThreshold = 0.1f; // 到达目标的容差
[Header("Bouncing Mode Settings")]
private int bounceCount = 3; // 弹跳次数
private int bounceCount = 2; // 弹跳次数
private float bounceHeight = 1.5f; // 弹跳高度
[Header("Curved Mode Settings")]
@@ -49,7 +49,6 @@ public class EggBullet : MonoBehaviour
type = EggBulletType.EnemyType;
isDie = false;
int id = Random.Range(1, 4);
//id = 3;
flyMode = (FlyMode)id;
_enemyTran = GameManager.Ins.enemy.body;
_playerTran = GameLocal.Ins.self.transform;

View File

@@ -15,7 +15,6 @@ public class CarrotGemTask : Task
base.StartTask();
winTaskTime = Random.Range(40, 61);
endTaskTime = 60;
GameManager.Ins.playerRightHand._isOpenLine = false;
}

View File

@@ -45,11 +45,11 @@ public class HUDPanel : UIBehaviour
go.rectTransform.anchoredPosition=new Vector2(randomX,randomY);
MonoSingleton<CoroutineTaskManager>.Instance.WaitSecondTodo(() =>
{
go.GetComponent<CanvasGroup>().DOFade(0, 3).OnComplete(() =>
go.GetComponent<CanvasGroup>().DOFade(0, 2).OnComplete(() =>
{
Destroy(go.gameObject);
});
},3f);
},2f);
}