Exemplo n.º 1
0
    public void OnClick()
    {
        EndAnim();

        SelectedSnake.energy -= EnergyCost;

        switch (weaponType)
        {
        case "Speed":
            SelectedSnake.ActivateSpeed();
            break;

        case "Shield":
            SelectedSnake.ActivateShield();
            break;

        case "Health":
            SelectedSnake.UseHealth();
            break;

        case "Heatseeker":
            SelectedSnake.ActivateMissile();
            break;

        case "3Shots":
            SelectedSnake.ActivateBlasters();
            break;

        case "Freeze":
            SelectedSnake.FireFreeze();
            break;

        case "Mine":
            SelectedSnake.DropMine();
            break;
        }

        CoolDownImage.gameObject.SetActive(true);
        CoolDownImage.fillAmount = 1;

        CoolDownImage.DOFillAmount(0, cooldownTime).SetEase(Ease.Linear).OnComplete(() =>
        {
            CoolDownImage.gameObject.SetActive(false);
        });
        useTime = Time.time;
    }