void Start() { SoundsAction.BallSwing(); rigidbody = gameObject.GetComponent <Rigidbody2D>(); transform.position = new Vector3(transform.position.x, transform.position.y + 0.4f, 0); rigidbody.AddForce(forceVec); }
public void Shoot(float power, Vector2 direction) { SoundsAction.Shoot(); isMoving = true; RotationBarDisplay(false); rigid.AddForce(direction * power, ForceMode2D.Impulse); }
void OnCollisionEnter2D(Collision2D other) { if (other.GetType() != typeof(Hole) && other.GetType() != typeof(Ball)) { SoundsAction.Bounce(); } }
public void Setfoce() { SoundsAction.SetForce(); foreach (var item in objectsToEnable) { item.SetActive(true); } OnChangeForce.Invoke(); gameObject.SetActive(false); }
private void OnTriggerEnter2D(Collider2D other) { hitPoits -= 10; if (hitPoits <= 0) { OnDie.Invoke(); SoundsAction.SetForce(); Destroy(gameObject); } if (other.tag == "Player") { SceneManager.LoadScene(2); } }
public void ShowQuickGameMenu() { SoundsAction.ButtonClick(); if (quickMenuObject.activeSelf) { quickMenuObject.SetActive(false); } else { quickMenuObject.SetActive(true); } OnShowQuickMenu.Invoke(0); }
void lvlComplited(bool isBot, bool scoreLimit) { if (isBot) { TextMeshProUGUI tmp = lvlLostObject.GetComponentInChildren <TextMeshProUGUI>(); tmp.text = "Bot won !"; SoundsAction.Lost(); lvlLostObject.SetActive(true); } else if (scoreLimit && PlayerProfile.gameMode == Gamemode.singlePlayer) { TextMeshProUGUI tmp = lvlLostObject.GetComponentInChildren <TextMeshProUGUI>(); tmp.text = "You have reached shoots limit !"; SoundsAction.Lost(); lvlLostObject.SetActive(true); } else { SoundsAction.Win(); lvlComplitedObject.SetActive(true); } }
private void OnTriggerEnter2D(Collider2D other) { if (other.tag == "Ball") { Ball ball = other.gameObject.GetComponent <Ball>(); if (ball == null) { return; } if (ball.velocity > 1500) { SoundsAction.BallSwing(); animSlowDown.SetTrigger("Slow"); ball.SmallChangeDirection(); return; } ball.gameObject.SetActive(false); ChageHollImage(); SoundsAction.BallInHole(); StartCoroutine(Wait(ball)); } }
void OnBallStoped() { int index = 0; foreach (var item in players) { if (item == currentPlayer) { if (players.Length == (index + 1)) { currentPlayer = players[0]; } else { currentPlayer = players[index + 1]; } foreach (var oneBall in balls) { oneBall.ActivateBall(false); } SoundsAction.ChangePlayer(); OnChangePlayer.Invoke(currentPlayer); if (currentPlayer.GetType() == typeof(AiPlayer)) { StartCoroutine(BotWait(currentPlayer)); } else { currentPlayer.StartTurn(); } return; } index++; } }
public void ShowHideMenu() { SoundsAction.ButtonClick(); Transform tmp = transform.GetChild(0); TextMeshProUGUI txt = tmp.GetComponent <TextMeshProUGUI>(); if (tutorial.activeSelf) { tutorial.SetActive(false); return; } if (gameObject.activeSelf) { OnHitButton.Invoke("SETTINGS"); gameObject.SetActive(false); } else { OnHitButton.Invoke("BACK"); gameObject.SetActive(true); } }
public void SinglePlayerButtonClick() { SoundsAction.ButtonClick(); PlayerProfile.gameMode = Gamemode.singlePlayer; HideButtons(); }
public void LoadLevel() { SoundsAction.ButtonClick(); PlayerProfile.levelIndex = levelIndex; StartCoroutine(LoadLvlWait()); }
public void HideQuickGameMenu(float _) { SoundsAction.ButtonClick(); quickMenuObject.SetActive(false); OnHideQuickMenu.Invoke(); }
void ChangeSoundsSettings() { PlayerProfile.ChangeSounds(); SoundsAction.ButtonClick(); ChangeButtonImage(); }
public void ChangeLvl() { SoundsAction.ButtonClick(); OnLvlComplited.Invoke(lvlIndex); LoadLvl(LoadLevelType.nextLvl); }
public void Reloadlvl() { SoundsAction.ButtonClick(); OnResetLvl.Invoke(); LoadLvl(LoadLevelType.currentLvl); }
public void GoToHome() { SoundsAction.ButtonClick(); StartCoroutine(LoadLvlWait()); }
public void BotButtonClick() { SoundsAction.ButtonClick(); PlayerProfile.gameMode = Gamemode.bot; HideButtons(); }
public void HideList() { SoundsAction.ButtonClick(); gameObject.SetActive(false); OnReturnToMenuButton.Invoke(); }