public void OnActivate() { rotateAnchor = transform.Find("Anchor"); BricksManager.AddDropEvent(DestroySelf); BricksManager.AddDropEvent((Transform) => { Controller = ControlState.player2; }); DropSpeed = Manager.Bricks.DropSpeed; curGameSpeed = DropSpeed; }
//生成器一但激活要做的事情 public void OnActivate() { //向游戏逻辑管理器添加一个回调函数,当方块不能再下落时就执行该回调函数 BricksManager.AddDropEvent(SpawnBricks); IsSpawn = true; Manager.Event.AddListener <GameOverRaws>(StopSpawn); SpawnBricks(Manager.Bricks.curBricks); }
/// <summary> /// Awake is called when the script instance is being loaded. /// </summary> void Awake() { _gameManager = GetComponent <GameManager>(); _uiManager = GetComponent <UIManager>(); _audioManager = GetComponent <AudioManager>(); _scoreManager = GetComponent <ScoreManager> (); _spawnManager = GetComponent <SpawnManager>(); _bricksManager = GetComponent <BricksManager>(); _eventManager = GetComponent <EventManager>(); _dataBaseManager = GetComponent <DataBaseManager>(); DontDestroyOnLoad(gameObject); Manager.Event.OnActivate(); Manager.Game.OnActivate(); }