// Update is called once per frame void Update() { if (Input.GetMouseButtonDown(0) && timeToWait > 0 && t.localScale.Equals(new Vector3(1, 1, 1))) { timeToWait = 0; } blendAnimation(); if (timeToWait > 0) { timeToWait -= Time.deltaTime; } if (timeToWait <= 0) { if (t.localScale.x == 1) { timeToWait = 0.5f; anim.scaleTo(new Vector3(0, 0, 0), 0.5f); } else { gameObject.SetActive(false); } } }
private void initBright() { float timeAnim = 0; float initialFade = 0; float toScale = 0; if (!isSecondaryColor() && !isTertiaryColor()) { return; } if (isSecondaryColor()) { timeAnim = 1; initialFade = 0.5f; toScale = 1.2f; timeToNewBright = 1.2f; //Debug.Log("Secondary Bright"); } else if (isTertiaryColor()) { timeAnim = 0.5f; //initialFade = 1; initialFade = 0.5f; toScale = 1.5f; timeToNewBright = 0.8f; //Debug.Log("Tertiary Bright"); } anim_bright.gameObject.transform.localScale = new Vector3(1.06f, 1.06f, 1); sr_bright.color = new Color(sr_bright.color.r, sr_bright.color.g, sr_bright.color.b, initialFade); anim_bright.scaleTo(new Vector3(toScale, toScale, 1), timeAnim); anim_bright.fadeTo(0, timeAnim); }
/*Recebe o pedido (resultado) e aceita-o se estiver na hora certa. Se não, retorna false*/ public bool addResultOrder(Order order) { if (waitingForResult) { gameManager.playAudioCoinClap(); resultValue = order; order.goToOperation(new Vector3(2.2f, 0, 0)); waitingForResult = false; bu_accept.transform.position = new Vector3(0, 0, 0); bu_accept.transform.localScale = new Vector3(0, 0, 0); AuxiliarAnim bu_a = bu_accept.GetComponent <AuxiliarAnim>(); bu_a.moveTo(new Vector3(1.5f, -2.5f, 0), 0.5f); bu_a.scaleTo(new Vector3(1, 1, 1), 0.5f); return(true); } if (order == resultValue) { order.backToInit(); waitingForResult = true; bu_accept.transform.position = new Vector3(0, -10, 0); } return(false); }
public void goToCounter(Vector3 posCounter) { initialPosition = transform.position; initialScale = transform.localScale; anim.moveTo(posCounter, 0.5f); anim.scaleTo(new Vector3(0.4f, 0.4f, 0.4f), 0.5f); timeToReload = 0.8f; }
public void animaOnLose() { if (hp() > 0 || bossLose == true) { return; } bossLose = true; if (transform.localScale.x > 0) { anim.scaleTo(new Vector3(2, 2, 1), 0.5f); } else { anim.scaleTo(new Vector3(-2, 2, 1), 0.5f); } anim.fadeTo(0, 0.5f); timeToDestroyMe = 0.6f; }
private void animOnReceive() { if (!onReceiveCoin && t.localScale.x == 1 && t.localScale.y == 1) { onReceiveCoin = true; anim.scaleTo(new Vector3(1.2f, 1.2f, 1), 0.1f); timeToAnimOnReceive = 0.15f; } else if (onReceiveCoin && t.localScale.x == 1.2f && t.localScale.y == 1.2f) { anim.scaleTo(new Vector3(1, 1, 1), 0.1f); timeToAnimOnReceive = 0.15f; } else if (onReceiveCoin && t.localScale.x == 1 && t.localScale.y == 1) { onReceiveCoin = false; timeToAnimOnReceive = -10; } }
public void explode() { if (timeToRemoveMe != -10 || !explodeMe) { return; } GameObject bubbleBright = transform.GetChild(0).gameObject; bubbleBright.GetComponent <SpriteRenderer> ().color = new Color(1, 1, 1, 0); CircleCollider2D col = GetComponent <CircleCollider2D> (); col.enabled = false; anim.scaleTo(new Vector3(1.8f, 1.8f, 1), 0.3f); anim.fadeTo(0, 0.3f); timeToRemoveMe = 0.5f; explodeMe = false; }
private void inToBlender() { anim.scaleTo(new Vector3(0, 0, 0), 0.5f); timeToDestroy = 0.8f; }
// Update is called once per frame void Update() { if (onOperation) { if (bu_cancel.transform.position.y == -10) { bu_cancel.transform.position = new Vector3(0, 0, 0); bu_cancel.transform.localScale = new Vector3(0, 0, 0); AuxiliarAnim bu_a = bu_cancel.GetComponent <AuxiliarAnim>(); bu_a.moveTo(new Vector3(-1.5f, -2.5f, 0), 0.5f); bu_a.scaleTo(new Vector3(1, 1, 1), 0.5f); } if (!onOperators && ((Mathf.Abs(cardB.transform.position.x - (t.localPosition.x + 2)) < 0.05f && cardB.transform.position.y == t.localPosition.y) || totalOperators == 1)) { initOperators(); onOperators = true; } if (((Input.GetMouseButtonUp(0)) || totalOperators == 1) && !GameSettings.panelOpened && !GameSettings.cardOnZoom) { RaycastHit2D hit = Physics2D.Raycast(Camera.main.ScreenToWorldPoint(Input.mousePosition), Vector2.zero, Mathf.Infinity, 1 << 9); if ((hit.collider != null) || totalOperators == 1 && !operationChoosed) { operationChoosed = true; Operator[] ops; if (totalOperators == 1) { ops = getAllOperators(); for (int i = 0; i < ops.Length; i++) { if (ops[i].isUseThis()) { op = ops[i]; } } } else { op = hit.collider.gameObject.GetComponent <Operator>(); op.animOnChoose(new Vector3(-0.9f, 0, 0)); } ops = getAllOperators(); for (int i = 0; i < ops.Length; i++) { if (!ops[i].gameObject.name.Equals(op.gameObject.name)) { ops[i].removeMeFromScene(); } } if (op == sub && cardA.getCardValue() < cardB.getCardValue()) { CardController c_aux = cardA; cardA = cardB; cardB = c_aux; cardA.moveCardTo(cardB.transform.position); } if (totalOperators > 1) { cardB.moveCardTo(new Vector3(0.2f, 0, 0)); } cardA.toScale(1f, 0.25f); cardB.toScale(1f, 0.25f); waitingForResult = true; equals.fadeTo(1, 0.5f); int value = -99999; int a = cardA.getCardValue(); int b = cardB.getCardValue(); if (op == sum) { value = a + b; } else if (op == sub) { value = a - b; } else if (op == mul) { value = a * b; } else { value = a / b; } if (totalOperators > 1) { gameManager.playAudioBu_press(); } gameManager.initOrders(value); } if (Input.GetMouseButtonUp(0)) { hit = Physics2D.Raycast(Camera.main.ScreenToWorldPoint(Input.mousePosition), Vector2.zero, Mathf.Infinity, 1 << 5); //9 is the UI Layer if (hit.collider != null && !buttonPressed) { if (hit.collider.gameObject.name.Equals("bu_cancel")) { AuxiliarAnim bu_an = hit.collider.gameObject.GetComponent <AuxiliarAnim>(); if (!bu_an.isOnMove() && !bu_an.isOnScale()) { gameManager.playAudioBu_press(); Debug.Log("BU PRESSED DE CANCEL OPERATION!"); cancelOperation(); buttonPressed = true; } } else if (hit.collider.gameObject.name.Equals("bu_verify")) { AuxiliarAnim bu_an = hit.collider.gameObject.GetComponent <AuxiliarAnim>(); if (!bu_an.isOnMove() && !bu_an.isOnScale()) { cardA.setEnableClick(false); cardB.setEnableClick(false); verifyOperation(); buttonPressed = true; } } } } } } }
public void backToInit() { anim.moveTo(initialPosition, 0.5f); anim.scaleTo(initialScale, 0.5f); }