// Use this for initialization void Awake() { TilePool = new Dictionary <TileType, Queue <TileBase> >(); TilePool.Add(TileType.SimpleTile, new Queue <TileBase>()); TilePool.Add(TileType.NormalTile, new Queue <TileBase>()); TilePool.Add(TileType.HardTile, new Queue <TileBase>()); instance = this; }
private void OnTriggerExit2D(Collider2D collision) { Debug.Log("离开"); if (collision.gameObject.layer == LayerMask.NameToLayer("Ground")) { Debug.Log("回收" + collision.gameObject.name); TerranManager.GetInstance().CollectTerranToPool(collision.GetComponent <TileBase>()); } }
// Use this for initialization private void OnTriggerEnter2D(Collider2D collision) { Debug.Log("进入"); if (collision.gameObject.layer == LayerMask.NameToLayer("Ground")) { Debug.Log(collision.gameObject.name + "进入触发区,准备生成新地形"); TerranManager.GetInstance().SpawnTerranFromPool(TerranManager.GetInstance().RandomGenerateTile()); } }
public void RestartGame() { StopAllCoroutines(); UIManager.GetInstance().InvokeLoadingPanel(() => { UIManager.GetInstance().ClosePanel("GameOverPanel", UITweenType.Scale); UIManager.GetInstance().ClosePanel("PausePanel", UITweenType.Scale); UIManager.GetInstance().ClosePanel("GamingPanel", UITweenType.Fade); curState = GameState.GameStart; SetRay(false); SetShield(false); UIManager.GetInstance().RefreshUI("GamingPanel"); TerranManager.GetInstance().Init(); ResetPlayer(); Time.timeScale = 1; StartCoroutine(GameRestartProcess()); }); }
private void BeginMovement() { SetState(PlayerState.Run); rb2d.DOMoveX(startX + 5f, 2f).SetEase(Ease.Linear).SetUpdate(false).onComplete = TerranManager.GetInstance().StartRollingTerran; Debug.Log("DoTween"); }