public void InitPool() { //设置实例 if (poolInstance == null) { poolInstance = this; } else { Destroy(this); } // DontDestroyOnLoad(this); //设置载体 if (poolParent == null) { Debug.Log("需要设置poolParent"); return; } //初始化数据 poolAmount = 5; objectIndex = 0; lockPool = false; objects = new List <GameObject>(); for (int i = 0; i < poolAmount; i++) { objects.Add(Instantiate(objectPrefabs[Random.Range(0, objectPrefabs.Length - 1)], poolParent.transform)); objects[i].SetActive(false); } }
public GameMiningController(GameMiningView view, MiningSceneViewDescription miningViewDescription, GameManager gameManager) { _view = view; _gameManager = gameManager; _ballPool = new BallPool(64, view.Ball); _gamePoleController = new GamePoleController(_view.HintAnimation, _view.GamePoleView, _ballPool, _view.BallSpritesViewDescription, miningViewDescription, _view); _gamePoleController.GameOver += GameOver; _view.EndGame.onClick.AddListener(OnEndGame); }
public void Init(BallPool ballPool, PlayerShip ship, EnemyController enemyController) { this.ballPool = ballPool; this.ship = ship; this.enemyController = enemyController; gameController = GameController.Instance; gameController.OnGameStateChanged += RefreshUi; RefreshUi(); }
void Awake() { Singleton = this; for (int i = 0; i < this.transform.childCount; i++) { this.transform.GetChild(i).gameObject.SetActive(false); _ballPoolList.Add(this.transform.GetChild(i).gameObject); } }
public GenerateBalls(BallPoint sizePole, MiningSceneViewDescription miningViewDescription, BallPool ballPool) { _sizeGamePole = sizePole; _typeBallResource = miningViewDescription.TypeBallResource; _countColor = miningViewDescription.Balls.Count; _percentageResources = miningViewDescription.PercentageResources; _resources = new ResourcesCount(miningViewDescription.TypeResources, miningViewDescription.CountResource); _miningViewDescription = miningViewDescription; _ballPool = ballPool; }
private void Awake() { InitSingleton(); gameState = GameState.Menu; uiManager = GetComponent <UIManager>(); pool = GetComponent <BallPool>(); timer = GetComponent <GameTimer>(); timer.Init(uiManager, TimeUp); MusicPlayer.SetFilterActive(true); }
private void PushBall() { Ball ball = BallPool.Get(); ball.transform.SetParent(transform); ball.transform.localRotation = Quaternion.Euler(0, 0, angle); ball.transform.localScale = Vector3.one; ball.SetActive(true); ball.transform.localPosition = Vector2.zero; ball.Rigid.AddForce(-ball.transform.right * BallSpeed, ForceMode2D.Impulse); }
public GamePoleController(HintView hintView, GamePoleView gamePole, BallPool ballPool, BallSpritesViewDescription spritesViewDescription, MiningSceneViewDescription miningViewDescription, MonoBehaviour monoBehaviour) { _balls = new BallController[gamePole.CountHorCell, gamePole.CountVertCell]; var checkBall = new CheckBall(new BallPoint(gamePole.CountHorCell, gamePole.CountVertCell)); var movedController = new MovedController(_balls, gamePole, checkBall); var destroyControler = new DestroyControllerBall(_balls, movedController, ballPool); var checkChangedBallController = new CheckChangedBallController(_balls, checkBall); var fallBallContorller = new FallControllerBall(_balls, movedController); var generateBalls = new GenerateBalls(new BallPoint(gamePole.CountHorCell, gamePole.CountVertCell), miningViewDescription, ballPool); var newGenerateController = new NewGenerateController(generateBalls, gamePole, _balls, spritesViewDescription, movedController); var hintController = new HintControler(hintView, checkChangedBallController, monoBehaviour); _gamePoleStateControler = new GamePoleStateControler(destroyControler, fallBallContorller, movedController, newGenerateController, checkChangedBallController, _balls, hintController); _gamePoleStateControler.GameOver += CallGameOver; gamePole.Activate(); _gamePoleStateControler.StartGame(); }
public Ball CreateActiveBall() { Ball ball = BallPool.GetObject().OnInit(FuncManager.RandomBallType()); return(ball); }
private void Start() { ballPool = BallPool.poolInstance; setScore.SendMessage("Reset"); }
private void Start() { ballPool = GetComponentInChildren <BallPool>(); ballCount = 0; }
public void Restart() { BallPool.Reset(); SceneManager.LoadScene(0); }
public DestroyControllerBall(BallController[,] ballPole, MovedController movedController, BallPool ballPool) { _ballPole = ballPole; _movedController = movedController; _ballPool = ballPool; }