public override void Load(BrickManager newManager, GameSave.GameItem saveItem) { base.Load(newManager, saveItem); manager.game.OnStateEnded += DisableAfterShooting; coinEffectController.ResetActivationEffect(); }
private void Start() { gc = this; cc = GameObject.Find("CameraParentObject").GetComponent <CameraController>(); pc = GameObject.Find("Player").GetComponent <PlayerController>(); uc = GameObject.Find("Canvas").GetComponent <UIController>(); gv = GetComponent <GameVibrator>(); sc = GetComponent <SceneController>(); cg = GameObject.Find("Canvas").GetComponent <ClaimGems>(); scc = GameObject.Find("Canvas").GetComponent <SecondChanceController>(); fc = GameObject.Find("Canvas").GetComponent <FeverController>(); bm = GetComponent <BrickManager>(); ads = GameObject.Find("Canvas").GetComponent <AdSimulation>(); scorec = GameObject.Find("Canvas").GetComponent <ScoreController>(); gemc = GameObject.Find("Canvas").GetComponent <GemController>(); oc = GameObject.Find("OptionsButton").GetComponent <OptionsController>(); am = GameObject.Find("CameraParentObject").GetComponent <AudioManager>(); DontDestroyOnLoad(gameObject); DontDestroyOnLoad(uc.gameObject); DontDestroyOnLoad(pc.gameObject); DontDestroyOnLoad(cc.gameObject); DontDestroyOnLoad(GameObject.Find("EventSystem")); DontDestroyOnLoad(GameObject.Find("Directional Light")); DontDestroyOnLoad(GameObject.Find("LiteFPSCounter")); pc.enabled = false; sc.LoadScene("LevelScene"); storing = GetComponent <Storing>(); LoadAllData(); pc.SelectedBrick = bm.GetCurrentBrick(); }
private void OnCollisionEnter2D(Collision2D other) { if (!GameManager.player.isObsessed) { BrickManager.DestroyBrick(this); } }
IEnumerator IEShoot(int _index) { //创建飞弹 float launchY = zyf.GetWorldScreenSize().y / 2 * -1 - 1; Vector2 launchPos = new Vector2(BrickManager.Instance().generateX[_index], launchY); GameObject missile = ObjectPoolManager.Instance().SpawnObject("Missile", launchPos, Quaternion.identity); //发射飞弹 float targetY = GameManager.Instance().bottomY - BrickManager.Instance().brickSize.y / 2; while (missile.transform.position.y < targetY) { missile.transform.Translate(speed * Vector2.up * Time.deltaTime); targetY += BrickManager.Instance().fallingSpeed *Time.deltaTime; yield return(null); } //命中后 SoundManager.Instance().Play("Boom"); ParticleManager.Instance().InstantiateParticle("Impact_Missile", missile.transform.position); //回收 missile.SetActive(false); //命中空缺 if (BrickManager.Instance().rows.Peek().types[_index] == 0) { BrickManager.Instance().ClearFirstRow(); } }
IEnumerator Up() { if (selectedBrick != null) { bool isDestroy = false; // check position var brick = BrickManager.GetInstance().At(selectedBrick.transform.position); if (brick != null && brick.dirs[0] == Brick.Direction.none) { Debug.Log("selectedBrick:" + brick.x + "," + brick.y); brick.dirs = selectedBrick.dirs; var parent = selectedBrick.transform.parent; if (parent != null) { var queue = parent.GetComponent <BrickQueue>(); queue.gen = null; isDestroy = true; Destroy(selectedBrick.gameObject); } } selectedBrick.transform.position = selectedOriginalPosition; selectedBrick = null; } yield break; }
void Update() { if (Input.GetKeyDown(KeyCode.Z)) { SoundManager.Instance().Play("Shoot"); } if (!gaming) { //游戏没开始 if (Input.GetMouseButtonDown(0) && readyToStart) { readyToStart = false; GameStart(); } } else { //游戏进行中 if (bottomY > zyf.GetWorldScreenSize().y / 2 * -1) { //降低底线 bottomY -= BrickManager.Instance().fallingSpeed *Time.deltaTime; redLine.transform.position = new Vector2(0, bottomY + BrickManager.Instance().brickSize.y / 11); //redLine.GetComponent<RectTransform>().position = Camera.main.WorldToScreenPoint(new Vector2(0, bottomY + BrickManager.Instance().brickSize.y / 11)); } else { //失败 GameOver(); } } }
public void ClearRow() { bottomY += BrickManager.Instance().brickSize.y; score++; text_score.text = score.ToString(); }
private void Start() { AudioManager = transform.Find("AudioManager").gameObject.GetComponent <AudioManager>(); BallManager = transform.Find("BallManager").gameObject.GetComponent <BallManager>(); BrickManager = transform.Find("BrickManager").gameObject.GetComponent <BrickManager>(); LevelManager = transform.Find("LevelManager").gameObject.GetComponent <LevelManager>(); LivesManager = transform.Find("LivesManager").gameObject.GetComponent <LivesManager>(); ScoreManager = transform.Find("ScoreManager").gameObject.GetComponent <ScoreManager>(); }
void Awake() { if (instance != null) { Debug.LogWarning("instance!=null"); return; } instance = this; }
private void Start() { paddle = GameObject.FindWithTag("Paddle").transform; brickManager = GameObject.FindWithTag("BrickManager").GetComponent <BrickManager>(); laserHit = brickManager.GetClosestBrick(paddle); lr = GetComponent <LineRenderer>(); posGrown = transform.position; fadeTime = .09f; }
void Start () { brickManager = GameObject.FindObjectOfType<BrickManager> (); turnManager = GameObject.FindObjectOfType<TurnManager> (); spriteRenderer = GetComponentInChildren<SpriteRenderer> (); health = turnManager.getTurn (); MeshRenderer meshRenderer = GetComponentInChildren<MeshRenderer>(); meshRenderer.sortingLayerID = spriteRenderer.sortingLayerID; meshRenderer.sortingOrder = spriteRenderer.sortingOrder + 1; refreshBrick (); }
public virtual void Init(Vector2 value, int hitPoints) { this.hitPoints = hitPoints; coords = value; light = GetComponentInChildren <Light2D>(); tmp = GetComponentInChildren <TextMeshPro>(); tmp.text = hitPoints.ToString(); brickManager = GetComponentInParent <BrickManager>(); ChangeColor(); }
void Awake () { // instance = this; bM = this.gameObject.GetComponentInChildren<BrickManager> (); pC = this.gameObject.GetComponentInChildren<PlayerController_old> (); pC.gameObject.SetActive (false); m_BlockMgr=this.gameObject.GetComponentInChildren<BlockManager> (); PlayGameInstance_old.INSTANCE=new PlayGameInstance_old(this); }
private void Update() { var json = BrickManager.GetJSON(); if (json.Equals(_json)) { return; } _json = json; BrickManager.InitBlocks(_json, transform, !Application.isPlaying); }
void Awake() { if (current == null) { current = this; } else { Destroy(this.gameObject); } }
private void Awake() { if (instance != null) { Destroy(gameObject); } else { instance = this; } }
void Awake() { // instance = this; bM = this.gameObject.GetComponentInChildren <BrickManager> (); pC = this.gameObject.GetComponentInChildren <PlayerController_old> (); pC.gameObject.SetActive(false); m_BlockMgr = this.gameObject.GetComponentInChildren <BlockManager> (); PlayGameInstance_old.INSTANCE = new PlayGameInstance_old(this); }
void Awake() { if (_instance != null) { Destroy(gameObject); } else { _instance = this; } }
protected override void Initialize() { wreckingBall = new WreckingBall(this, new Vector2(500, 0), Color.White, 0.5f); mouse = new MouseHandler(this); brickManager = new BrickManager(this, new Vector2(600, 0)); _turn = 1; HighScoreManager hsm = new HighScoreManager(this); highScore = hsm.ReadData(); base.Initialize(); }
public static void Reset() { SoundManager.Play(SoundManager.Clip.RESET); BrickManager.Reset(); DeprimusManager.Reset(); ball.Reset(); player.Reset(); crizatusCanvas.SetActive(false); nervosusCanvas.SetActive(false); }
IEnumerator Starting() { var b = broad; var brick = BrickManager.GetInstance().At(0, 0); yield return(new WaitForSeconds(5.0f)); brick.speed = waterSpeed; brick.SetIncomingDir(Brick.Direction.top); yield return(new WaitForSeconds(10.0f)); b.isStart = true; }
// Use this for initialization void Start () { brickManager = GameObject.FindObjectOfType<BrickManager> (); scoreBoardManager = GameObject.FindObjectOfType<ScoreBoardManager> (); GameObject[] popupObjects = GameObject.FindGameObjectsWithTag ("Popup"); foreach (GameObject popupObject in popupObjects) { if (popupObject.name == "GameOverPopup") { gameOverPopup = popupObject; gameOverPopup.SetActive (false); } else if (popupObject.name == "StartPopup") { startPopup = popupObject; } } bonusBallPrefab = Resources.Load("Prefab/BonusBall", typeof(BonusBall)) as BonusBall; }
// Use this for initialization void Awake() { if (instance == null) { instance = this; } else { if (instance != this) { Destroy(gameObject); } } //ResetLevel(); }
// Use this for initialization void Start() { bombManager = GameObject.Find("BombManager"); brickManager = GameObject.Find("BrickManager").GetComponent <BrickManager>(); //Find the world size mainCamera = Camera.main; orthographicSize = mainCamera.orthographicSize; aspectRatio = mainCamera.aspect; float halfPlayerWidth = transform.localScale.x / 2f; screenHalfWidth = aspectRatio * orthographicSize; screenHalfWidthInWorldUnits = screenHalfWidth + halfPlayerWidth; //set the touch location to the shield location as it should not move up and down touchLocation.y = transform.position.y; //determine the appropriate touchscreen controls controlSchema = PlayerPrefs.GetInt("control", 2); }
public void ChangeColor(BrickManager target) { var targetSpriteRenderer = target.GetComponent <SpriteRenderer>(); if (targetSpriteRenderer == null) { return; } var color = colors.Find(c => c.type == target.type); if (color != null && color.sprite != null) { targetSpriteRenderer.sprite = color.sprite; targetSpriteRenderer.color = Color.white; } }
public override void Load(BrickManager newManager, GameSave.GameItem saveItem) { base.Load(newManager, saveItem); baseHP = saveItem.baseHP; if (countText) { SetHPTextPosition(); countText.text = hitCounter.ToString(); } if (cubeEffectController) { cubeEffectController.isPoisoned = false; cubeEffectController.ResetEffect(); cubeEffectController.PlayAppearEffect(this); cubeEffectController.OnInit(this); } manager.game.OnStateEnded += OnStateEnded; }
void Start() { _internalPrefab = prefab; effects = new List <EffectInfo>(); deprimuses = new List <Deprimus>(); prefabRenderer = _internalPrefab.GetComponent <Renderer>(); clock = 0f; Player player = FindObjectOfType <Player>(); Camera camera = FindObjectOfType <Camera>(); spawnLimits = new Limits(); spawnLimits.left = -camera.orthographicSize * camera.aspect + prefabRenderer.bounds.size.x / 2f; spawnLimits.right = camera.orthographicSize * camera.aspect - prefabRenderer.bounds.size.x / 2f; spawnLimits.top = BrickManager.GetTopLimit() - prefabRenderer.bounds.size.y / 2f; spawnLimits.bottom = player.transform.position.y + player.GetComponent <Renderer>().bounds.size.y / 2f + prefabRenderer.bounds.size.y / 2f; actualSpawnProb = SPAWN_PROB_PER_SEC; }
protected override void LoadContent() { base.LoadContent(); ContentManager content = GameRef.Content; walls = new Walls(content.Load <Texture2D>("breakout"), game); paddleManager = new PaddleManager(content.Load <Texture2D>("breakout_pieces_1"), GameRef); mainBall = new Ball(content.Load <Texture2D>("sphere-00"), new Vector2((GameRef.ScreenRectangle.Width / 2) - 16, (paddleManager[paddleManager.activePaddle].position.Y - 16))); brickManager = new BrickManager(content.Load <Texture2D>("breakout_pieces_1")); scoreLabel = new Label(); scoreLabel.Name = "Score"; scoreLabel.Position = new Vector2(GameRef.ScreenRectangle.Width - 100, GameRef.ScreenRectangle.Height - 25); scoreLabel.Text = score.ToString(); controlManager.Add(scoreLabel); }
public virtual void Load(BrickManager newManager, GameSave.GameItem saveItem) { manager = newManager; gameObject.SetActive(true); level = saveItem.level; index = saveItem.index; hitCounter = saveItem.hitCounter; starterHitCounter = hitCounter; orientation = saveItem.orientation; shiftDelay = saveItem.shiftDelay; var pos = BrickManager.startRow; pos.x += index; pos.y -= manager.TurnCount - (saveItem.level + shiftDelay); transform.localPosition = pos; manager.game.OnLevelChanged += OnMoveDownEnded; manager.game.OnElementAppearedOnScreen(this); }
void Update() { if (Input.GetKeyDown(KeyCode.S) && !isSave) { isSave = true; saveData = ""; foreach (Bricks _brick in BrickManager.brickList) { saveData += _brick.location.x + "_" + _brick.location.y + "_" + _brick.location.z + ":" + _brick.rotation.x + "_" + _brick.rotation.y + "_" + _brick.rotation.z + "_" + _brick.rotation.w + ":" + _brick.color + ":" + _brick.type + "&"; Destroy(_brick.gameObject); } // saveData format = x_y_z:x_y_z_w:color:type&.... saveData = saveData.Substring(0, saveData.Length - 1); BrickManager.brickList.Clear(); print("...Saved!"); } if (Input.GetKeyDown(KeyCode.L) && isSave) { isSave = false; string[] loadData = saveData.Split('&'); for (int i = 0; i < loadData.Length; i++) { string[] property = loadData[i].Split(':'); // 0 : Location / 1 : Rotation / 2 : Color / 3 : Type string[] savedLocation = property[0].Split('_'); Vector3 location = new Vector3(float.Parse(savedLocation[0]), float.Parse(savedLocation[1]), float.Parse(savedLocation[2])); string[] savedRocation = property[1].Split('_'); Quaternion rotation = new Quaternion(float.Parse(savedRocation[0]), float.Parse(savedRocation[1]), float.Parse(savedRocation[2]), float.Parse(savedRocation[3])); int type = int.Parse(property[3]); GameObject bricks = Instantiate(BrickManager.getBrick(type), location, rotation); bricks.GetComponent <Renderer>().material = BrickManager.getColor(property[2]); } print("...Loaded!"); } }
private void Awake() { _brickManager = Bricks.GetComponent <BrickManager>(); foreach (Transform drone in Drones) { var droneScript = drone.gameObject.GetComponent <Drone>(); droneScript.manager = this; _drones.Add(droneScript); } Debug.Log($"Initialized {_drones.Count} drone(s)"); foreach (Transform supplyTrans in Supplies) { var t = (from Transform supplyChild in supplyTrans where _brickManager.GetTags().Contains(supplyChild.tag) select supplyChild.tag).FirstOrDefault(); if (t == null) { Debug.LogWarning($"There is no corresponding brick tag in Supply: {supplyTrans.name}"); continue; } var supply = supplyTrans.GetComponent <Supply>(); supply.type = t; if (!supplyTags.ContainsKey(t)) { supplyTags.Add(t, new List <Supply>()); } supplyTags[t].Add(supply); Debug.Log($"Initialized {supply.name}, type: {supply.type}"); } if (supplyTags.Any(kvp => kvp.Value.Count == 0)) { throw new Exception("No supply for certain brick type"); } }
public override void Load(BrickManager newManager, GameSave.GameItem saveItem) { base.Load(newManager, saveItem); manager.game.OnStateEnded += Jump; manager.game.OnStateEnded += ChooseNewIndex; }
void Start() { _paddle = player.GetComponent <Paddle>(); _paddle.hasControl = false; _brickManager = brickManager.GetComponent <BrickManager>(); }