private void initFlashSkill(BubbleController othetBubble) { if (collor.Equals(EnumsGame.BubbleCollors.RED) && othetBubble.collor.Equals(EnumsGame.BubbleCollors.YELLOW) || collor.Equals(EnumsGame.BubbleCollors.YELLOW) && othetBubble.collor.Equals(EnumsGame.BubbleCollors.RED)) { FlashSkillManager.instance.initFlash(new Color(1, 0.6f, 0, 1)); EnemiesManager.instance.initFlashEarthQuake(); othetBubble.useMe(); useMe(); PlayerController.instance.useOneBubble(); PlayerController.instance.useOneBubble(); } else if (collor.Equals(EnumsGame.BubbleCollors.BLUE) && othetBubble.collor.Equals(EnumsGame.BubbleCollors.YELLOW) || collor.Equals(EnumsGame.BubbleCollors.YELLOW) && othetBubble.collor.Equals(EnumsGame.BubbleCollors.BLUE)) { FlashSkillManager.instance.initFlash(Color.green); EnemiesManager.instance.initFlashPoison(); othetBubble.useMe(); useMe(); PlayerController.instance.useOneBubble(); PlayerController.instance.useOneBubble(); } else if (collor.Equals(EnumsGame.BubbleCollors.RED) && othetBubble.collor.Equals(EnumsGame.BubbleCollors.BLUE) || collor.Equals(EnumsGame.BubbleCollors.BLUE) && othetBubble.collor.Equals(EnumsGame.BubbleCollors.RED)) { FlashSkillManager.instance.initFlash(new Color(1, 0, 0.6f, 1)); EnemiesManager.instance.initFlashArkane(); othetBubble.useMe(); useMe(); PlayerController.instance.useOneBubble(); PlayerController.instance.useOneBubble(); } }
// Use this for initialization void Start() { initialSize = transform.localScale; mouseOverSize = initialSize * 1.15f; controller = GetComponent <BubbleController>(); rgdb = GetComponent <Rigidbody2D>(); }
void Start() { helpText.SetActive(false); skipButton.gameObject.SetActive(false); micModeButton.gameObject.SetActive(false); shuffleModeButton.gameObject.SetActive(false); Invoke("StartGame", splashDuration); // Subscribe to AudioController.StartShuffleModeFailed event // so we can hide the UI buttons and show the help message when // falling back to mic mode. audioController = GetComponent<AudioController>(); audioController.StartShuffleModeFailed += (s, e) => { skipButton.gameObject.SetActive(false); micModeButton.gameObject.SetActive(false); shuffleModeButton.gameObject.SetActive(false); Invoke("ShowHelp", helpDelay); Invoke("HideHelp", helpDelay + helpDuration); }; // Set up the BubbleController dependencies and create the BubbleController. ExplosionController explosionController = GetComponent<ExplosionController>(); GameObject spectrumObject = GameObject.FindGameObjectWithTag("Spectrum"); SpectrumVisualiser visualiser = spectrumObject.GetComponent<SpectrumVisualiser>(); bubbleController = new BubbleController(bubblePrefab, bubbleOptions, worldBoundary, explosionController, visualiser); }
/// <summary> 弹出左侧对话 </summary> public static void PopLeftChat(ChatManager cm) { // 左侧有对话 if (cm.m_leftChats.Count > 0) { // 隐藏选择面板 ChoicePanle.HideChoicePanel(cm.m_view); cm.m_timer += Time.deltaTime; // 若左侧对话不为空,且计时器时间到,继续下一句. while (cm.m_leftChats.Count > 0 && cm.m_timer >= 1.5f) { string leftChat = cm.m_leftChats.Peek(); if (leftChat.Equals("游戏结束")) { cm.m_isGameOver = true; } BubbleController.PopBubble(cm.m_view, leftChat, cm.m_view.m_SoundManager.m_leftAudio); cm.m_leftChats.Dequeue(); cm.m_timer = 0f; } } // 左侧没有对话 else { if (cm.m_view.m_HasRightChat) { ChoicePanle.HideChoicePanel(cm.m_view); // 右侧没有对话 } else { ChoicePanle.ShowChoicePanel(cm.m_view); // 右侧有对话 } } }
public BubbleController GenerateNewBubble(float _smallBubbleSpeed, float _bigBubbleSpeed) { bubbleNextId++; GameObject go = GameObject.CreatePrimitive(PrimitiveType.Quad); go.name = bubbleNextId.ToString(); go.layer = 8; go.transform.parent = bublesRoot.transform; GameObject.Destroy(go.GetComponent <MeshCollider>()); go.AddComponent <SphereCollider>(); Material newBubbleMat = new Material(baseMaterial); go.renderer.material = newBubbleMat; BubbleController controller = go.AddComponent <BubbleController>(); float newBubbleSize = GenerateSize(); float newBubbleSpeed = GenerateSpeed(newBubbleSize, _smallBubbleSpeed, _bigBubbleSpeed); go.transform.position = GenerateInitPosition(newBubbleSize); controller.Setup(bubbleNextId, newBubbleSize, newBubbleSpeed, ResourceManager.GetRandomTextureFromSet()); return(controller); }
public void clickOnBubble(BubbleController b) { //Pode selecionar um bubble, misturar, explodir ou errar mistura. //Debug.Log ("Bubble "+b.getColor()+" clicked."); if (b != null && mouseDownOnBubble == b) { if (selectedBubble == null || (selectedBubble != b)) { if (selectedBubble != null) { bool mixBubbles = verifyMix(selectedBubble.getColor(), b.getColor()); bool explodeBubbles = verifiExplode(selectedBubble, b); if (mixBubbles || explodeBubbles) { selectedBubble.goToPosition(new Vector2(b.transform.position.x, b.transform.position.y), b); } selectedBubble.removeSelect(); selectedBubble = null; } else { b.selectMe(); selectedBubble = b; } } else { b.removeSelect(); selectedBubble = null; } } }
private void verifyClick() { if (!GameSethings.isWindowOpen) { if (Input.GetMouseButtonDown(0)) { RaycastHit2D hit = Physics2D.Raycast(Camera.main.ScreenToWorldPoint(Input.mousePosition), Vector2.zero, Mathf.Infinity, 1 << 8); //The layer 8 is the Bubbles layer. if (hit.collider != null) { mouseDownOnBubble = hit.transform.gameObject.GetComponent <BubbleController> (); } } else if (Input.GetMouseButtonUp(0)) { RaycastHit2D hit = Physics2D.Raycast(Camera.main.ScreenToWorldPoint(Input.mousePosition), Vector2.zero, Mathf.Infinity, 1 << 8); //The layer 8 is the Bubbles layer. if (hit.collider != null && mouseDownOnBubble != null) { BubbleController bc_aux = hit.transform.gameObject.GetComponent <BubbleController> (); clickOnBubble(bc_aux); } else if (selectedBubble != null) { selectedBubble.removeSelect(); selectedBubble = null; } mouseDownOnBubble = null; } } }
private void MergeBubble(BubbleController gelembungController) { if (Mathf.Sqrt(Mathf.Pow(rigidbody2D.velocity.x, 2) + Mathf.Pow(rigidbody2D.velocity.y, 2)) > Mathf.Sqrt(Mathf.Pow(gelembungController.rigidbody2D.velocity.x, 2) + Mathf.Pow(gelembungController.rigidbody2D.velocity.y, 2))) { int newSize = bubble.SizeInInt + gelembungController.SizeInInt; if (newSize > 5) { newSize = 5; } bubble.SizeInInt = newSize; rigidbody2D.velocity = new Vector2(rigidbody2D.velocity.x * AfterMergingSpeed, rigidbody2D.velocity.y * AfterMergingSpeed); PlayManager.Score += BubbleController.SkillScore; PlayManager.SkillScore += BubbleController.SkillScore; } else if (Mathf.Sqrt(Mathf.Pow(rigidbody2D.velocity.x, 2) + Mathf.Pow(rigidbody2D.velocity.y, 2)) == Mathf.Sqrt(Mathf.Pow(gelembungController.rigidbody2D.velocity.x, 2) + Mathf.Pow(gelembungController.rigidbody2D.velocity.y, 2)) && transform.position.x < gelembungController.transform.position.x) { int newSize = bubble.SizeInInt + gelembungController.SizeInInt; if (newSize > 5) { newSize = 5; } bubble.SizeInInt = newSize; rigidbody2D.velocity = new Vector2(rigidbody2D.velocity.x * AfterMergingSpeed, rigidbody2D.velocity.y * AfterMergingSpeed); PlayManager.Score += BubbleController.SkillScore; PlayManager.SkillScore += BubbleController.SkillScore; } else { DestroyOnlyBubble(); } }
private void initFlashSkill(BubbleController otherBubble) { //For each skill disabled, test if the flash skill should actived //POISON -> Blue + YELLOW if (PlayerData.instance.getSkillLevel(EnumsGame.GameSkills.POISON) > 0) { if (controller.collor.Equals(EnumsGame.BubbleCollors.YELLOW) && otherBubble.collor.Equals(EnumsGame.BubbleCollors.BLUE) || controller.collor.Equals(EnumsGame.BubbleCollors.BLUE) && otherBubble.collor.Equals(EnumsGame.BubbleCollors.YELLOW)) { controller.goMix(otherBubble); } } //EARTQUAKE -> YELLOW + RED if (PlayerData.instance.getSkillLevel(EnumsGame.GameSkills.EARTHQUAKE) > 0) { if (controller.collor.Equals(EnumsGame.BubbleCollors.YELLOW) && otherBubble.collor.Equals(EnumsGame.BubbleCollors.RED) || controller.collor.Equals(EnumsGame.BubbleCollors.RED) && otherBubble.collor.Equals(EnumsGame.BubbleCollors.YELLOW)) { controller.goMix(otherBubble); } } //ARKANE -> RED + BLUE if (PlayerData.instance.getSkillLevel(EnumsGame.GameSkills.ARKANE) > 0) { if (controller.collor.Equals(EnumsGame.BubbleCollors.RED) && otherBubble.collor.Equals(EnumsGame.BubbleCollors.BLUE) || controller.collor.Equals(EnumsGame.BubbleCollors.BLUE) && otherBubble.collor.Equals(EnumsGame.BubbleCollors.RED)) { controller.goMix(otherBubble); } } }
private void clickOnBubble(BubbleController b) { if (b != null && mouseDownOnBubble == b) { if (selectedBubble == null || (selectedBubble != b)) { if (selectedBubble != null) { //OBS: Colocar um IF (bubble não é FIXA). selectedBubble.goToPosition(new Vector2(b.transform.position.x, b.transform.position.y), b); selectedBubble.removeSelect(); selectedBubble = null; } else { b.selectMe(); selectedBubble = b; } } else { b.removeSelect(); selectedBubble = null; } } }
private void useHotKeyBubble(BubbleController b) { if (b != null) { b.atackEnemy(EnemiesManager.instance._enemyOnTarget); } }
public static void CreateNetWatchBubble(NewBubbleProxy proxy) { if (singleton._curGameMode == GameMode.netView) { BubbleController newBubble = singleton.bubblesGenerator.GenerateNewNetWatchBubble(proxy, singleton.smallBubbleSpeed, singleton.bigBubbleSpeed); singleton.bubblesDict.Add(newBubble.id, newBubble); } }
/// <summary> 右侧对话,没有等待时间 </summary> public static void ReplayMessage(View view, string message) { // 弹出新对话 BubbleController.PopBubble(view, message, view.m_SoundManager.m_rightAudio); // 隐藏选择面板 ChoicePanle.HideChoicePanel(view); view.m_HasRightChat = true; }
public void ReplaceBubbleView(BubbleController newValue) { var index = GameComponentsLookup.BubbleView; var component = (BubbleViewComponent)CreateComponent(index, typeof(BubbleViewComponent)); component.Value = newValue; ReplaceComponent(index, component); }
private void Start() { isDead = false; m_photonView = gameObject.GetComponent <PhotonView>(); m_playerMovement = gameObject.GetComponent <PlayerMovement>(); m_bubble = gameObject.GetComponent <BubbleController>(); //m_targetSyst = GameObject.FindGameObjectWithTag("TargetSystem").GetComponent<TargetSystem>(); m_uIController = GameObject.FindGameObjectWithTag("UIController").GetComponent <UIController>(); }
void OnTriggerEnter2D(Collider2D other) { BubbleController bubble = other.GetComponent <BubbleController>(); if (bubble != null) { Destroy(bubble.gameObject); } }
private void changeColorTo(BubbleController b, string color) { if (color.Equals("R")) { b.changeColorTo("Red"); } else if (color.Equals("B")) { b.changeColorTo("Blue"); } else if (color.Equals("Y")) { b.changeColorTo("Yellow"); } else if (color.Equals("G")) { b.changeColorTo("Green"); } else if (color.Equals("P")) { b.changeColorTo("Purple"); } else if (color.Equals("O")) { b.changeColorTo("Orange"); } else if (color.Equals("RO")) { b.changeColorTo("RedOrange"); } else if (color.Equals("RP")) { b.changeColorTo("RedPurple"); } else if (color.Equals("BG")) { b.changeColorTo("BlueGreen"); } else if (color.Equals("BP")) { b.changeColorTo("BluePurple"); } else if (color.Equals("YG")) { b.changeColorTo("YellowGreen"); } else if (color.Equals("YO")) { b.changeColorTo("YellowOrange"); } else { //Se der algum erro fica mais fácil de ver b.transform.localScale = new Vector3(0.3f, 0.3f, 1); } }
/// <summary> 显示选择面板 </summary> public static void ShowChoicePanel(View view) { if (!view.m_choosePanle.activeSelf) { BubbleController.MovePanel(view, 100); } view.m_choosePanle.SetActive(true); view.m_isWaitingClick = true; }
public void Initialize() { InitializeEvents(); m_gamePlayViewController = new GamePlayViewController(); m_aimController = new AimController(); m_bubbleController = new BubbleController(); m_allowShootCRWait = new WaitForSeconds(m_allowShootCRDelay); }
/// <summary> /// Dels the column cluster. /// </summary> /// <returns> /// The column cluster. /// </returns> /// <param name='_from'> /// _from. /// </param> /// <param name='_to'> /// _to. /// </param> /// <param name='column'> /// Column. /// </param> /// <param name='_matrix'> /// _matrix. /// </param> GameObject[,] DelColumnCluster(int _from, int _to, int column, GameObject[,] _matrix) { int count = _to - _from + 1; //lenght of the cluster gameControllerScript.BubblesDestroyed(count); GameObject[] buffer = new GameObject[count]; int a = 0; for (int i = _from; i <= _to; i++) { buffer[a] = _matrix[column, i]; GameObject someBlast = (GameObject)Instantiate(bubbleBlast, buffer[a].transform.position, buffer[a].transform.rotation); //TODO: Make colors of blast same as bubbles //someBlast.particleSystem.renderer.material.color = buffer[a].renderer.material.color; //Don't work http://answers.unity3d.com/questions/347675/how-to-change-particle-systems-color-over-lifetime.html //someBlast.particleSystem.Play(); //Hide cluster of bubbles BubbleController bubbleScript = buffer[a].GetComponent <BubbleController>(); bubbleScript.Hide(bubbleFadeTime); a++; } for (int i = _to; i - count >= 0; i--) { _matrix[column, i] = _matrix[column, i - count]; Vector3 pos = new Vector3(column * (bubbleRadius * 2 + bubbleInterval), i * (bubbleRadius * 2 + bubbleInterval)); BubbleController bubbleScript = _matrix[column, i].GetComponent <BubbleController>(); //relocate the bubbles bubbleScript.targetPos = pos; bubbleScript.isMoving = true; bubbleScript.speedOfMoving = bubbleMovingSpeed; } for (int i = 0; i < count; i++) { _matrix[column, i] = buffer[i]; Vector3 pos = new Vector3(column * (bubbleRadius * 2 + bubbleInterval), i * (bubbleRadius * 2 + bubbleInterval)); //Position in the local space _matrix[column, i].transform.localPosition = pos; _matrix[column, i].renderer.material.color = RandColor(); BubbleController bubbleScript = _matrix[column, i].GetComponent <BubbleController>(); _matrix[column, i].transform.localScale = new Vector3(0.1f, 0.1f, 0.1f); bubbleScript.speedOfScaling = bubbleScalingSpeed; bubbleScript.targetRadius = bubbleRadius; bubbleScript.isScaling = true; a++; } return(_matrix); }
private bool verifiExplode(BubbleController bA, BubbleController bB) { if (bA.getColor().Equals(bB.getColor())) { if (bA.isSecondaryColor() || bA.isTertiaryColor()) { return(true); } } return(false); }
private void Awake() { if (instance == null) { instance = this; } else { Destroy(gameObject); } }
public void addBubble(BubbleController b) { if (!endLevel) { bubbles.Add(b); } if (maxBubbles > 0) { quantBubbles.fillAmount = (bubbles.Count) / (float)maxBubbles; } }
public void goToPosition(Vector2 pos, BubbleController b) { if (fixedBubble) { return; } anim.moveTo(new Vector3(pos.x, pos.y, 0), 0.5f); movingTo = true; timeToMovingTo = 0.5f; rigidbody.velocity = new Vector2(0, 0); bubble_b = b; }
private void verifyBubbles() { if (toExplode.activeSelf) { for (int i = bubblesExplode.Length - 1; i > 0; i--) { BubbleController b = bubblesExplode [i]; if (b.isExplodeMe()) { b.explode(); if (currentSituation == 7) { quantBubblesExplode--; } } else if (b.isRemoveMe()) { b.transform.position = new Vector3(-100, -100, 0); } if (selectedBubble != null && b == selectedBubble) { continue; } b.moveMe(); } } if (toMix.activeSelf) { for (int i = bubblesMix.Length - 1; i > 0; i--) { BubbleController b = bubblesMix [i]; if (b.isExplodeMe()) { b.explode(); if (currentSituation == 14) { quantBubblesMix--; } } else if (b.isRemoveMe()) { b.transform.position = new Vector3(-100, -100, 0); } if (selectedBubble != null && b == selectedBubble) { continue; } b.moveMe(); } } }
public GameObject SpawnRedBubble() { Vector3 pos = transform.position; pos.x = Random.Range(minPosX, maxPosX); GameObject bubble = Instantiate(redBubblePrefab, pos, Quaternion.identity); // bubble.GetComponent<BubbleController>().SetColor(redColor); BubbleController bubbleCtrlr = bubble.GetComponent <BubbleController>(); bubbleCtrlr.type = ElementType.Red; bubbleCtrlr.bubbleSoundCtrlr = bubbleSoundCtrlr; return(bubble); }
public void FixedUpdate() { remainingCooldown -= Time.fixedDeltaTime; if (Input.GetKeyUp(KeyCode.Space)) { if (remainingCooldown <= 0f) { GameObject bubbleObject = Instantiate(bubble, playerTransform); BubbleController bubbleController = bubbleObject.GetComponent <BubbleController>(); bubbleController.creater = playerTransform; remainingCooldown = cooldown; } } }
/// <summary> /// Bubbleses busy. /// </summary> /// <returns> /// True if bubbles are busy (moving or scaling) /// </returns> bool BubblesBusy() //Check bubbles. Moving or scaling { for (int i = 0; i < columns; i++) { for (int j = 0; j < rows; j++) { BubbleController bubbleScript = bubbleMatrix[i, j].GetComponent <BubbleController>(); if (bubbleScript.isMoving || bubbleScript.isScaling) { return(true); } } } return(false); }
void Update() { if (status["atScene"] != null) { //ParseText.AtScene(this, status["atScene"]); // set: status["atScene"] = null } else { if (m_isGameOver) { m_isGameOver = false; StartCoroutine(GameOver(0.3f)); } } BubbleController.PopLeftChat(this); }
public static void NewNetWatchLevel(NewLevelProxy proxy) { singleton._curLevel++; ResourceManager.GenerateNewTexturesSet(); singleton.smallBubbleSpeed += ConfigDictionary.Config.nextLevelIncreaseBubbleSpeed; singleton.bigBubbleSpeed += ConfigDictionary.Config.nextLevelIncreaseBubbleSpeed; singleton._levelTimer = ConfigDictionary.Config.levelTime; singleton.bubbleGenerationDelay -= ConfigDictionary.Config.nextLevelIncreaseBubbleGenerationDelay; singleton.bubbleGenerationDelay = Mathf.Clamp(singleton.bubbleGenerationDelay, 0.5f, 1000); singleton.DestroyAllBubblesInDict(); for (int i = 0; i < proxy.bubbles.Length; i++) { BubbleController newBubble = singleton.bubblesGenerator.GenerateNewNetWatchBubble(proxy.bubbles[i], singleton.smallBubbleSpeed, singleton.bigBubbleSpeed); singleton.bubblesDict.Add(newBubble.id, newBubble); } }
void updateCurrentSelection() { if (currentAbility == "magnet") { selectedImage.sprite = magnetSprite; selectedAbility.sprite = magnetSprite; ResetPlayerSpeed(70); } else if (currentAbility == "flower") { selectedImage.sprite = flowerSprite; selectedAbility.sprite = flowerSprite; ResetPlayerSpeed(70); } else if (currentAbility == "speed") { selectedImage.sprite = speedSprite; selectedAbility.sprite = speedSprite; } else if (currentAbility == "bubble") { selectedImage.sprite = bubbleSprite; selectedAbility.sprite = bubbleSprite; } else { selection.SetActive(false); ability.SetActive(false); return; } BubbleController bubbleController = GameObject.Find("obj_player").GetComponent <BubbleController>(); if (currentAbility == "bubble") { bubbleController.EnableBubble(true); } else { bubbleController.EnableBubble(false); } selection.SetActive(true); ability.SetActive(true); }