示例#1
0
 void Start()
 {
     SoundsAction.BallSwing();
     rigidbody          = gameObject.GetComponent <Rigidbody2D>();
     transform.position = new Vector3(transform.position.x, transform.position.y + 0.4f, 0);
     rigidbody.AddForce(forceVec);
 }
示例#2
0
 public void Shoot(float power, Vector2 direction)
 {
     SoundsAction.Shoot();
     isMoving = true;
     RotationBarDisplay(false);
     rigid.AddForce(direction * power, ForceMode2D.Impulse);
 }
示例#3
0
 void OnCollisionEnter2D(Collision2D other)
 {
     if (other.GetType() != typeof(Hole) && other.GetType() != typeof(Ball))
     {
         SoundsAction.Bounce();
     }
 }
示例#4
0
 public void Setfoce()
 {
     SoundsAction.SetForce();
     foreach (var item in objectsToEnable)
     {
         item.SetActive(true);
     }
     OnChangeForce.Invoke();
     gameObject.SetActive(false);
 }
示例#5
0
 private void OnTriggerEnter2D(Collider2D other)
 {
     hitPoits -= 10;
     if (hitPoits <= 0)
     {
         OnDie.Invoke();
         SoundsAction.SetForce();
         Destroy(gameObject);
     }
     if (other.tag == "Player")
     {
         SceneManager.LoadScene(2);
     }
 }
示例#6
0
    public void ShowQuickGameMenu()
    {
        SoundsAction.ButtonClick();
        if (quickMenuObject.activeSelf)
        {
            quickMenuObject.SetActive(false);
        }
        else
        {
            quickMenuObject.SetActive(true);
        }

        OnShowQuickMenu.Invoke(0);
    }
示例#7
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);
     }
 }
示例#8
0
 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));
     }
 }
示例#9
0
    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++;
        }
    }
示例#10
0
    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);
        }
    }
示例#11
0
 public void SinglePlayerButtonClick()
 {
     SoundsAction.ButtonClick();
     PlayerProfile.gameMode = Gamemode.singlePlayer;
     HideButtons();
 }
示例#12
0
 public void LoadLevel()
 {
     SoundsAction.ButtonClick();
     PlayerProfile.levelIndex = levelIndex;
     StartCoroutine(LoadLvlWait());
 }
示例#13
0
 public void HideQuickGameMenu(float _)
 {
     SoundsAction.ButtonClick();
     quickMenuObject.SetActive(false);
     OnHideQuickMenu.Invoke();
 }
示例#14
0
 void ChangeSoundsSettings()
 {
     PlayerProfile.ChangeSounds();
     SoundsAction.ButtonClick();
     ChangeButtonImage();
 }
示例#15
0
 public void ChangeLvl()
 {
     SoundsAction.ButtonClick();
     OnLvlComplited.Invoke(lvlIndex);
     LoadLvl(LoadLevelType.nextLvl);
 }
示例#16
0
 public void Reloadlvl()
 {
     SoundsAction.ButtonClick();
     OnResetLvl.Invoke();
     LoadLvl(LoadLevelType.currentLvl);
 }
示例#17
0
 public void GoToHome()
 {
     SoundsAction.ButtonClick();
     StartCoroutine(LoadLvlWait());
 }
示例#18
0
 public void BotButtonClick()
 {
     SoundsAction.ButtonClick();
     PlayerProfile.gameMode = Gamemode.bot;
     HideButtons();
 }
示例#19
0
 public void HideList()
 {
     SoundsAction.ButtonClick();
     gameObject.SetActive(false);
     OnReturnToMenuButton.Invoke();
 }