You've already forked taptap2024_GJ_chidouren
updat core
This commit is contained in:
@@ -173,7 +173,7 @@ namespace Game.Component
|
||||
)
|
||||
);
|
||||
|
||||
private void ResetState ()
|
||||
public void ResetState ()
|
||||
{
|
||||
this.AnimState.SetState (EnemyAnimStateType.Idle);
|
||||
this.UpdateSpeedState (false , false);
|
||||
@@ -269,16 +269,19 @@ namespace Game.Component
|
||||
isUpdate |= _fsmData.HasAttack != this.HasAttack;
|
||||
isUpdate |= _fsmData.HasSafeArea != this.HasSafeArea;
|
||||
isUpdate |= _fsmData.HasRunaway != this.HasRunaway;
|
||||
isUpdate |= _fsmData.HasActive != MapContent.Instance.IsActiveGame;
|
||||
|
||||
this._fsmData.HasAttack = HasAttack;
|
||||
this._fsmData.HasSafeArea = HasSafeArea;
|
||||
this._fsmData.HasRunaway = HasRunaway;
|
||||
this._fsmData.HasActive = MapContent.Instance.IsActiveGame;
|
||||
|
||||
if (isUpdate)
|
||||
{
|
||||
this._fsmController.SetBool ("hasAttack", this._fsmData.HasAttack);
|
||||
this._fsmController.SetBool ("hasSafeArea", this._fsmData.HasSafeArea);
|
||||
this._fsmController.SetBool ("hasRunaway", this._fsmData.HasRunaway);
|
||||
this._fsmController.SetBool ("hasActive", this._fsmData.HasActive);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,9 @@ namespace Game.Component
|
||||
[HideInInspector] public ScenePart ScenePart;
|
||||
public AstarPath Pathfinder;
|
||||
|
||||
|
||||
public bool IsActiveGame;
|
||||
|
||||
//玩家位置
|
||||
public Vector2 PlayerPosition { private set; get; }
|
||||
|
||||
@@ -51,16 +54,16 @@ namespace Game.Component
|
||||
}
|
||||
|
||||
this.ScenePart = scenePart;
|
||||
this.ScenePart.InitPart ();
|
||||
// this.Pathfinder.data.SetData (this.ScenePart.mapCacheData.bytes);
|
||||
// this.Pathfinder.FlushGraphUpdates ();
|
||||
this.Pathfinder.Scan ();
|
||||
CameraManager.Instance.SetBoxCollider (this.ScenePart.cameraCollider);
|
||||
ResetPlayer ();
|
||||
CameraManager.Instance.SetCameraState (CameraManager.CameraState.Player_Near);
|
||||
}
|
||||
|
||||
public void ResetPlayer ()
|
||||
public void ResetGame ()
|
||||
{
|
||||
this.ScenePart.RefreshInit ();
|
||||
this.PlayerEntity.transform.position = this.ScenePart.createPos.position;
|
||||
this.PlayerEntity.gameObject.SetActive (true);
|
||||
this.PlayerEntity.RefreshInit ();
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
using Framework.Timer;
|
||||
using System;
|
||||
using Framework.Timer;
|
||||
using Framework.Utils.Extend;
|
||||
using Game.EventDefine;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Game.Component
|
||||
@@ -24,6 +26,11 @@ namespace Game.Component
|
||||
|
||||
public void OnMove (Vector2 vector)
|
||||
{
|
||||
if (!MapContent.Instance.IsActiveGame)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var t = this.transform;
|
||||
// 获取前方方向的世界坐标
|
||||
Vector3 forward = (Vector3)vector;
|
||||
@@ -53,5 +60,14 @@ namespace Game.Component
|
||||
this.speedBuffOffset = 0;
|
||||
//主角出生初始化
|
||||
}
|
||||
|
||||
private void OnTriggerEnter2D (Collider2D other)
|
||||
{
|
||||
if (other.CompareTag ("Enemy"))
|
||||
{
|
||||
//死亡特效
|
||||
GameEventDefine.ChangeGameFsm.SendMessage (GameState.FieldGame);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using Sirenix.OdinInspector;
|
||||
using System.Collections.Generic;
|
||||
using Sirenix.OdinInspector;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Game.Component
|
||||
@@ -14,6 +15,8 @@ namespace Game.Component
|
||||
|
||||
[LabelText ("当前完成数:")] private int _currentConditionNumber = 0;
|
||||
|
||||
private List<EnemyEntity> _enemyEntities;
|
||||
|
||||
|
||||
public bool IsComplete => _currentConditionNumber >= completeConditionNumber;
|
||||
|
||||
@@ -22,5 +25,21 @@ namespace Game.Component
|
||||
this._currentConditionNumber += number;
|
||||
return _currentConditionNumber >= completeConditionNumber;
|
||||
}
|
||||
|
||||
public void RefreshInit ()
|
||||
{
|
||||
this._currentConditionNumber = 0;
|
||||
foreach (var enemyEntity in this._enemyEntities)
|
||||
{
|
||||
enemyEntity.ResetState ();
|
||||
}
|
||||
}
|
||||
|
||||
public void InitPart ()
|
||||
{
|
||||
this._enemyEntities = new List<EnemyEntity> ();
|
||||
this._enemyEntities = new List<EnemyEntity> (transform.GetComponentsInChildren<EnemyEntity> (true));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,16 +1,24 @@
|
||||
using System;
|
||||
using Cysharp.Threading.Tasks;
|
||||
using Framework.Audio;
|
||||
using Framework.FSMLite;
|
||||
using Framework.UI;
|
||||
using Game.Component;
|
||||
using UnityEngine;
|
||||
using Views;
|
||||
|
||||
namespace Game.FsmNode
|
||||
{
|
||||
public class GameField : StateMachine<GameState>
|
||||
{
|
||||
protected override void OnEnter (params object[] args)
|
||||
protected override async void OnEnter (params object[] args)
|
||||
{
|
||||
AudioManager.Instance.PlaySoundEffect(SeAudio.OverGame_Fail);
|
||||
CameraManager.Instance.SetCloseUpTarget (MapContent.Instance.PlayerEntity.transform , 2f);
|
||||
CameraImpulseUtils.Instance.ExplosionImpulseCamera (1 , 0.5f , 0.5f , 0.5f);
|
||||
CameraEffectUtils.Instance.SetAberration (1 , 0.5f);
|
||||
AudioManager.Instance.PlaySoundEffect (SeAudio.OverGame_Fail);
|
||||
await UniTask.Delay (2000);
|
||||
this.stateMachineRunner.OpenState (GameState.StartGame);
|
||||
}
|
||||
|
||||
protected override void OnExit ()
|
||||
|
||||
@@ -3,6 +3,7 @@ using System.Guide;
|
||||
using Framework.Audio;
|
||||
using Framework.FSMLite;
|
||||
using Framework.UI;
|
||||
using Game.Component;
|
||||
using Game.Data;
|
||||
|
||||
using UnityEngine;
|
||||
@@ -21,13 +22,16 @@ namespace Game.FsmNode
|
||||
public static string GroupName = typeof(GameFight).FullName;
|
||||
protected override async void OnEnter (params object[] args)
|
||||
{
|
||||
MapContent.Instance.IsActiveGame = true;
|
||||
// MapContent.Instance.Pathfinder.
|
||||
AudioManager.Instance.PlayBGM (BgmAudio.FightingBgm);
|
||||
var globalData = RoomManager.Instance.RoomGlobalData;
|
||||
}
|
||||
|
||||
protected override void OnExit ()
|
||||
{
|
||||
|
||||
MapContent.Instance.IsActiveGame = false;
|
||||
// MapContent.Instance.Pathfinder.PausePathfinding ();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
using Framework.Audio;
|
||||
using Framework.FSMLite;
|
||||
using Framework.UI;
|
||||
using Game.Component;
|
||||
using Game.Data;
|
||||
using Game.EventDefine;
|
||||
using Views;
|
||||
@@ -15,6 +16,8 @@ namespace Game.FsmNode
|
||||
AudioManager.Instance.PlayBGM(BgmAudio.NormalBgm , 0.65f);
|
||||
GameEventDefine.ChangeGameFsm.SendMessage (GameState.FightGame , true);
|
||||
UIManager.Instance.CloseLoading (null);
|
||||
MapContent.Instance.ResetGame ();
|
||||
CameraManager.Instance.SetCameraState (CameraManager.CameraState.Player_Near);
|
||||
}
|
||||
|
||||
protected override void OnExit ()
|
||||
|
||||
Reference in New Issue
Block a user