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));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user