Пример #1
0
    private void OnMouseDown()
    {
        if (GameManager.gameState == GameState.MainMenu)
        {
            if (GameManager.CurrentConfig.Vibration)
            {
                Taptic.Light();
            }
            GetComponent <AudioSource>().Play();

            switch (Type)
            {
            case MainMenuButtonType.PlayButton:
                EventManager.instance.Fire(new CallLoadLevel(LoadLevelType.FromMainMenu, GameManager.CurrentSaveInfo.CurrentLevel));
                break;

            case MainMenuButtonType.SelectLevelButton:
                EventManager.instance.Fire(new CallGoToSelectLevel());
                break;

            case MainMenuButtonType.InfoButton:
                EventManager.instance.Fire(new CallGoToInfo());
                break;

            case MainMenuButtonType.SettingButton:
                EventManager.instance.Fire(new CallGoToSetting());
                break;
            }
        }
    }
Пример #2
0
 public void Toggle()
 {
     Taptic.tapticOn   = !Taptic.tapticOn;
     text.text         = Taptic.tapticOn ? "TURN OFF" : "TURN ON";
     tapticImage.color = Taptic.tapticOn ? on : off;
     Taptic.Selection();
 }
Пример #3
0
 private void EnableAction()
 {
     Taptic.tapticOn = true;
     Taptic.Selection();
     Taptic.Heavy();
     PlayerPrefsManager.SetVibration("vibrationOn");
 }
Пример #4
0
    private void OnMouseDown()
    {
        GetComponent <AudioSource>().Play();

        if (GameManager.CurrentConfig.Vibration)
        {
            Taptic.Light();
        }
        switch (GameManager.gameState)
        {
        case GameState.Level:
            EventManager.instance.Fire(new CallBackToSelectLevel());
            break;

        case GameState.SelectLevelMenu:
            EventManager.instance.Fire(new CallBackToMainMenu());
            break;

        case GameState.Info:
            EventManager.instance.Fire(new CallBackToMainMenu());
            break;

        case GameState.Setting:
            EventManager.instance.Fire(new CallBackToMainMenu());
            break;
        }
    }
Пример #5
0
    private void DisableAction()
    {
        //Nothing :(
        Taptic.tapticOn = false;
        Taptic.Selection();

        PlayerPrefsManager.SetVibration("vibrationOff");
    }
Пример #6
0
 public static void Heavy(bool isVibration = true)
 {
     if (isVibration)
     {
         Taptic.Heavy();
         //Debug.Log("Vibro: Medium");
     }
 }
Пример #7
0
 public static void Light(bool isVibration = true)
 {
     if (isVibration)
     {
         Taptic.Light();
         //Debug.Log("Vibro: light");
     }
 }
Пример #8
0
 public void Win()
 {
     GameManager.Instance.LevelPassed = true;
     UIManager.Instance.SetLevelEndPanelVisibility(true);
     DataManager.Instance.Level++;
     GameManager.Instance.CurrentState = GameStates.LevelEnd;
     AdjustTimeScale(true);
     if (DataManager.Instance.Vibration == 1)
     {
         Taptic.Success();
     }
 }
Пример #9
0
 public void SetVibrationToggleStatus()
 {
     if (DataManager.Instance.Vibration == 0)
     {
         DataManager.Instance.Vibration = 1;
         vibrationImage.SetActive(true);
         Taptic.Vibrate();
     }
     else
     {
         DataManager.Instance.Vibration = 0;
         vibrationImage.SetActive(false);
     }
 }
Пример #10
0
 private void OnMouseDown()
 {
     if (GameManager.CurrentConfig.Vibration)
     {
         GameManager.CurrentConfig.Vibration = false;
         CheckMark.SetActive(false);
     }
     else
     {
         GameManager.CurrentConfig.Vibration = true;
         CheckMark.SetActive(true);
         Taptic.Light();
     }
 }
Пример #11
0
    private void OnMouseDown()
    {
        if (!Swtiching && GameManager.gameState == GameState.SelectLevelMenu)
        {
            if (GameManager.CurrentConfig.Vibration)
            {
                Taptic.Light();
            }
            GetComponent <AudioSource>().Play();

            ResetButton();
            SelectedEffect.GetComponent <Image>().enabled = true;
            EventManager.instance.Fire(new CallLoadLevel(LoadLevelType.FromSelectionMenu, LevelIndex, gameObject));
        }
    }
Пример #12
0
 private void OnCollisionEnter(Collision collision)
 { // TODO: Collision Mechanic
     if (collision.gameObject.CompareTag("AICars"))
     {
         _rb          = transform.GetComponent <Rigidbody>();
         impulseForce = collision.impactForceSum;
         collision.rigidbody.AddForce(-impulseForce * collision.rigidbody.mass, ForceMode.Impulse);
         _rb.constraints = RigidbodyConstraints.FreezePositionY;
         Taptic.Heavy();
         bloodEffect.SetActive(true);
         Run.After(blobEffectActiveSecond, async() => {
             bloodEffect.SetActive(false);
         });
     }
 }
Пример #13
0
    public static void ChangeVibrationSelection(Image vibrationButtonImage, Sprite vibrationOnSprite, Sprite vibrationOffSprite)
    {
        Taptic.tapticOn = !Taptic.tapticOn;
        Taptic.Selection();

        if (Taptic.tapticOn)
        {
            PlayerPrefsManager.SetVibration("vibrationOn");
            Taptic.Heavy();
            vibrationButtonImage.sprite = vibrationOnSprite;
        }
        else
        {
            PlayerPrefsManager.SetVibration("vibrationOff");
            vibrationButtonImage.sprite = vibrationOffSprite;
        }
    }
Пример #14
0
    public void Eat(float val)
    {
        Taptic.Light();
        float firstExpirience = CurrentExpireance;
        int   StartLenth      = scoreHandler.Lenth;

        CurrentExpireance += val;

        while (CurrentExpireance > ExpireanceToLevelUp)
        {
            LeveLUp();
        }

        //float LastPart = CurrentExpireance / ExpireanceToLevelUp;
        //Debug.Log("LastP" + LastPart + " cur exp" + CurrentExpireance +" exp to lvl up" + ExpireanceToLevelUp);

        ScoreManager.instance.ExpirianceEarned?.Invoke(firstExpirience, CurrentExpireance, ExpireanceToLevelUp);
    }
Пример #15
0
    private void OnMouseDown()
    {
        if (!Shaking && GameManager.gameState == GameState.SelectLevelMenu)
        {
            Taptic.Light();
            GetComponent <AudioSource>().Play();

            StartCoroutine(ClickedShake());
            if (Right)
            {
                transform.root.GetComponent <SelectLevelMenuManager>().IncreaseLevel();
            }
            else
            {
                transform.root.GetComponent <SelectLevelMenuManager>().DecreaseLevel();
            }
        }
    }
Пример #16
0
    private IEnumerator Flip()
    {
        CollectionManager.Instance.flip();
        _currentRot = Player.Instance.transform.eulerAngles.z;
        canFlip     = false;
        GameManager.Instance.combo += 1;
        Taptic.Medium();
        yield return(new WaitForSeconds(0.1f));

        _afterRot = Player.Instance.transform.eulerAngles.z;
        result    = _currentRot - _afterRot;
        if (result <= 30)
        {
            canFlip = false;
        }
        else
        {
            canFlip = true;
        }
    }
Пример #17
0
    public override void OnDie()
    {
        //foreach (var d in OnMoved?.GetInvocationList())
        //{
        //	OnMoved -= (Action<float>)d;
        //}

        if (Advertisement.IsReady())
        {
            //Debug.Log ("ADS");
            //Advertisement.Show ();
        }

        Taptic.Heavy();
        //Debug.Log("OnDie");
        ResetAnimation(SoldierAnims.reset);
        PlayAnimation(SoldierAnims.death);
        IsDead = true;
        GameManager.instanse.GameOver?.Invoke(this);
        scoreHandler.CleanUp();
    }
Пример #18
0
 public void TriggerTaptic(string type)
 {
     if (type == "warning")
     {
         Taptic.Warning();
     }
     else if (type == "failure")
     {
         Taptic.Failure();
     }
     else if (type == "success")
     {
         Taptic.Success();
     }
     else if (type == "light")
     {
         Taptic.Light();
     }
     else if (type == "medium")
     {
         Taptic.Medium();
     }
     else if (type == "heavy")
     {
         Taptic.Heavy();
     }
     else if (type == "default")
     {
         Taptic.Default();
     }
     else if (type == "vibrate")
     {
         Taptic.Vibrate();
     }
     else if (type == "selection")
     {
         Taptic.Selection();
     }
 }
Пример #19
0
    private void CheckLevelState()
    {
        for (int i = 0; i < Map.Count; i++)
        {
            for (int j = 0; j < Map[i].Count; j++)
            {
                if (Map[i][j] != null && Map[i][j].slotType == SlotType.Target)
                {
                    if (Map[i][j].InsideBubbleType == BubbleType.Null)
                    {
                        return;
                    }
                }
            }
        }

        if (GameManager.CurrentConfig.Vibration)
        {
            Taptic.Light();
        }

        EventManager.instance.Fire(new CallLoadLevel(LoadLevelType.LevelFinish, LevelIndex + 1));
    }
Пример #20
0
    void OnTriggerEnter(Collider other)
    {
        if (this.gameObject == top.topCart && other.gameObject.tag == "stack" && stackFlag == 0)
        {
            other.gameObject.transform.parent.gameObject.GetComponent <stack>().stacked = 1;
            Taptic.Medium();
            speedPS.SetActive(true);
            //other.gameObject.transform.parent.gameObject.GetComponent<movement>().enabled = true;
            foreach (BoxCollider col in GetComponents <BoxCollider>())
            {
                // if(col.isTrigger == false)
                // col.enabled = false;
            }
            foreach (BoxCollider col in other.gameObject.transform.parent.gameObject.GetComponents <BoxCollider>())
            {
                // if(col.isTrigger == false)
                // col.enabled = true;
            }
            stackFlag = 1;
            top.cartNumber++;
            top.topCart       = other.gameObject.transform.parent.gameObject;
            displacement      = top.displacement;
            top.displacement += 0.95f;
            frontCart         = other.gameObject.transform.parent.gameObject;
            top.topCart.transform.GetChild(1).GetComponent <BoxCollider>().enabled = false;
            splashInstance = Instantiate(splash, this.transform.position + splashOffset, Quaternion.identity);
            splashInstance.transform.SetParent(this.gameObject.transform, true);

            followCam.fov    += 1.5f;
            followCam.temp.x += 0.7f;
            followCam.offset += new Vector3(0f, 0.2f, 0.2f);
        }
        if (other.gameObject.tag == "Finish")
        {
            mov.finishFlag = 1;
        }
    }
Пример #21
0
    public static void Vibrate(VibrationType vibrationType)
    {
        switch (vibrationType)
        {
        case VibrationType.Light:
            if (PlayerDataController.data.isVibrationOpen)
            {
                Taptic.Light();
            }
            break;

        case VibrationType.Medium:
            if (PlayerDataController.data.isVibrationOpen)
            {
                Taptic.Medium();
            }
            break;

        case VibrationType.Success:
            if (PlayerDataController.data.isVibrationOpen)
            {
                Taptic.Success();
            }
            break;

        case VibrationType.Failure:
            if (PlayerDataController.data.isVibrationOpen)
            {
                Taptic.Failure();
            }
            break;

        default:
            break;
        }
    }
Пример #22
0
    public void Die()
    {
        AdjustTimeScale(true);

        visualRenderers[0].enabled = false;
        GetComponent <SphereCollider>().enabled = false;
        trail.enabled = false;

        foreach (GameObject part in parts)
        {
            part.SetActive(true);
            part.GetComponent <Rigidbody>().velocity = currentVelocity;
        }

        rb.velocity = Vector3.zero;
        GameManager.Instance.CurrentState = GameStates.LevelEnd;

        UIManager.Instance.SetLevelEndPanelVisibility(true);

        if (DataManager.Instance.Vibration == 1)
        {
            Taptic.Failure();
        }
    }
Пример #23
0
    void OnTriggerEnter(Collider other)
    {
        if (other.gameObject == follow.target.gameObject)
        {
            cart               = other.gameObject.transform.parent.gameObject;
            follow.target      = other.gameObject.transform.parent.transform.GetChild(5).transform;
            follow.smoothSpeed = 0.02f;
        }
        if (other.gameObject == follow.target.transform.parent.GetChild(5).transform.gameObject)
        {
            //this.gameObject.GetComponent<MeshRenderer>().enabled = false;
            this.gameObject.SetActive(false);

            if (SceneManager.GetActiveScene().buildIndex == 2 || SceneManager.GetActiveScene().buildIndex == 5 || SceneManager.GetActiveScene().buildIndex == 6)
            {
                other.gameObject.transform.parent.transform.GetChild(3).transform.gameObject.GetComponent <Weight>().weight += 2.6f;
            }
            else
            {
                other.gameObject.transform.parent.transform.GetChild(3).transform.gameObject.GetComponent <Weight>().weight++;
            }
            top.multiple++;
            if (top.multiple % 15 == 0)
            {
                instance = Instantiate(scorePrefab, new Vector3(cart.transform.position.x, cart.transform.position.y, center.z), Quaternion.identity);

                instance.transform.SetParent(canvas.transform, false);
            }
            if (SceneManager.GetActiveScene().buildIndex == 2 || SceneManager.GetActiveScene().buildIndex == 5 || SceneManager.GetActiveScene().buildIndex == 6)
            {
                if (this.gameObject.transform.parent.gameObject.name == "original")
                {
                    if (top.multiple % 12 == 0)
                    {
                        Taptic.Light();
                    }
                }
                if (this.gameObject.transform.parent.gameObject.name == "cubestraight")
                {
                    if (top.multiple % 7 == 0)
                    {
                        Taptic.Light();
                    }
                }
                if (this.gameObject.transform.parent.gameObject.name == "tiltedvertical")
                {
                    if (top.multiple % 4 == 0)
                    {
                        Taptic.Light();
                    }
                }
            }
            else
            {
                if (this.gameObject.transform.parent.gameObject.name == "original")
                {
                    if (top.multiple % 17 == 0)
                    {
                        Taptic.Light();
                    }
                }
                if (this.gameObject.transform.parent.gameObject.name == "cubestraight")
                {
                    if (top.multiple % 12 == 0)
                    {
                        Taptic.Light();
                    }
                }
                if (this.gameObject.transform.parent.gameObject.name == "tiltedvertical")
                {
                    if (top.multiple % 7 == 0)
                    {
                        Taptic.Light();
                    }
                }
            }
        }
    }
Пример #24
0
    private void CheckSlotSelection()
    {
        if (GameManager.gameState == GameState.Level)
        {
            if (Selected)//Hold
            {
                foreach (Transform child in AllSlot.transform)
                {
                    if (child.GetComponent <SlotObject>().Inside(transform.position))
                    {
                        NearByInfo PreviousNearByInfo = CurrentNearByInfo;

                        CurrentNearByInfo = child.GetComponent <SlotObject>().GetNearByInfo();
                        if (CurrentNearByInfo.Available())
                        {
                            if (child.gameObject != SelectedSlot) //Select a new available slot
                            {
                                if (GameManager.CurrentConfig.Vibration)
                                {
                                    Taptic.Light();
                                }

                                ResetNearByBubble(PreviousNearByInfo);

                                if (SelectedSlot != null)
                                {
                                    SelectedSlot.GetComponent <SlotObject>().Selected = false;
                                    ResetOffsetInfo();
                                }
                                child.GetComponent <SlotObject>().Selected = true;
                                SelectedSlot = child.gameObject;


                                if (SelectedSlot.GetComponent <SlotObject>().Type != SlotType.Teleport || !GameManager.ActivatedLevel.GetComponent <LevelManager>().TeleportAvailable(SelectedSlot.GetComponent <SlotObject>().ConnectedSlotInfo))
                                {
                                    ActivatedEffect.GetComponent <ParticleSystem>().Stop();
                                    if (CurrentNearByInfo.RightBubble)
                                    {
                                        CurrentNearByInfo.RightBubble.GetComponent <NormalBubble>().IntendMoveDir = Direction.Right;
                                        ReleaseEffect.transform.Find("Right").GetComponent <ParticleSystem>().Play();
                                    }
                                    else
                                    {
                                        ReleaseEffect.transform.Find("Right").GetComponent <ParticleSystem>().Stop();
                                    }
                                    if (CurrentNearByInfo.LeftBubble)
                                    {
                                        CurrentNearByInfo.LeftBubble.GetComponent <NormalBubble>().IntendMoveDir = Direction.Left;
                                        ReleaseEffect.transform.Find("Left").GetComponent <ParticleSystem>().Play();
                                    }
                                    else
                                    {
                                        ReleaseEffect.transform.Find("Left").GetComponent <ParticleSystem>().Stop();
                                    }
                                    if (CurrentNearByInfo.TopBubble)
                                    {
                                        CurrentNearByInfo.TopBubble.GetComponent <NormalBubble>().IntendMoveDir = Direction.Up;
                                        ReleaseEffect.transform.Find("Up").GetComponent <ParticleSystem>().Play();
                                    }
                                    else
                                    {
                                        ReleaseEffect.transform.Find("Up").GetComponent <ParticleSystem>().Stop();
                                    }
                                    if (CurrentNearByInfo.DownBubble)
                                    {
                                        CurrentNearByInfo.DownBubble.GetComponent <NormalBubble>().IntendMoveDir = Direction.Down;
                                        ReleaseEffect.transform.Find("Down").GetComponent <ParticleSystem>().Play();
                                    }
                                    else
                                    {
                                        ReleaseEffect.transform.Find("Down").GetComponent <ParticleSystem>().Stop();
                                    }
                                }
                                else
                                {
                                    ResetNearByBubble(CurrentNearByInfo);
                                }
                            }
                            return;
                        }
                    }
                }
                if (SelectedSlot != null) // Not in available slot
                {
                    SelectedSlot.GetComponent <SlotObject>().Selected = false;
                    SelectedSlot = null;
                    ResetOffsetInfo();

                    ActivatedEffect.GetComponent <ParticleSystem>().Play();
                    foreach (Transform Effect in ReleaseEffect.transform)
                    {
                        Effect.GetComponent <ParticleSystem>().Stop();
                    }

                    ResetNearByBubble(CurrentNearByInfo);
                    CurrentNearByInfo = null;
                }
            }
            else
            {
                if (SelectedSlot != null)//Release
                {
                    SelectedSlot.GetComponent <SlotObject>().Selected = false;
                    SelectedSlot = null;
                    ResetOffsetInfo();

                    foreach (Transform Effect in ReleaseEffect.transform)
                    {
                        Effect.GetComponent <ParticleSystem>().Stop();
                    }

                    ResetNearByBubble(CurrentNearByInfo);
                    CurrentNearByInfo = null;
                }
            }
        }
    }
    // Update is called once per frame
    void Update()
    {
        if (SceneManager.GetActiveScene().buildIndex < 6)
        {
            if (attackFlag == 0 && checkScript.remainCount != 0)
            {
                unit.transform.Translate(0f, 0f, unitForwardSpeed * Time.timeScale * Time.deltaTime);
            }
        }
        else if (SceneManager.GetActiveScene().buildIndex >= 6)
        {
            if (attackFlag == 0 && DeadCheck.remainCount != 0)
            {
                unit.transform.Translate(0f, 0f, unitForwardSpeed * Time.timeScale * Time.deltaTime);
            }
        }

        if (attackFlag == 1)
        {
            enemiesRemaining = enemies.Count;
            playersRemaining = players.Count;

            for (int i = 0; i < enemies.Count; i++)
            {
                if (enemies[i].activeInHierarchy == false)
                {
                    if (enemiesDeathFlag[i] == 0)
                    {
                        Instantiate(DeathRed, enemies[i].transform.position + new Vector3(0f, 0.4f, 0f), Quaternion.identity);
                        Taptic.Medium();
                        enemiesDeathFlag[i] = 1;
                    }
                    enemiesRemaining -= 1;
                }
            }
            for (int i = 0; i < players.Count; i++)
            {
                if (players[i].activeInHierarchy == false)
                {
                    if (playersDeathFlag[i] == 0)
                    {
                        Instantiate(DeathBlue, players[i].transform.position + new Vector3(0f, 0.4f, 0f), Quaternion.identity);
                        Taptic.Medium();
                        playersDeathFlag[i] = 1;
                    }

                    playersRemaining -= 1;
                }
            }
        }

        //GAME OVER
        if (gameOver == 1)
        {
            foreach (GameObject player in players)
            {
                player.GetComponent <Animator>().SetBool("isRunning", false);
                player.GetComponent <Animator>().SetBool("isHitting", false);
                //  player.GetComponent<Individual>().trail.SetActive(false);
            }
            foreach (GameObject enemy in enemies)
            {
                enemy.GetComponent <Animator>().SetBool("isRunning", false);
                enemy.GetComponent <Animator>().SetBool("isHitting", false);
                // enemy.GetComponent<IndividualEnemy>().trail.SetActive(false);
            }
            if (playersRemaining == 0 && endFlag == 0)
            {
                gameOverDisplay.SetActive(true);
                Debug.Log("Level " + "Failed , " + PlayerPrefs.GetInt("LevelNumber"));
                //Time.timeScale = 0.6f;
                endFlag = 1;
            }
            else if (enemiesRemaining == 0 && endFlag == 0)
            {
                levelCompleteDisplay.SetActive(true);
                Debug.Log("Level " + "Complete , " + PlayerPrefs.GetInt("LevelNumber"));
                //Time.timeScale = 0.6f;
                endFlag = 1;
            }
        }
    }
Пример #26
0
    private void OnTriggerEnter(Collider other)
    {
        if (other.gameObject.tag == "Ground" && startBuilding && !isDead)
        {
            riskyJump = false;
            ComboController.Instance.canFlip = true;
            rotationPowerTime = 0f;
            isJump            = false;
            canJump           = false;
            Taptic.Heavy();
            if (transform.eulerAngles.z > 45 && transform.eulerAngles.z < 315)
            {
                isDead = true;
            }
            else if (transform.eulerAngles.z >= 45 && transform.eulerAngles.z <= 315 || transform.eulerAngles.z >= 30 && transform.eulerAngles.z <= 330 &&
                     GameManager.Instance.combo != 0)
            {
                GameManager.Instance.combo = 0;
                StartCoroutine(UIManager.Instance.ShowNearMissText());
            }
            else if ((transform.eulerAngles.z >= 30 && transform.eulerAngles.z <= 330) || (transform.eulerAngles.z > 15 && transform.eulerAngles.z < 345) &&
                     GameManager.Instance.combo != 0)
            {
                StartCoroutine(UIManager.Instance.ShowNormalText());
            }
            else if ((transform.eulerAngles.z < 15 || transform.eulerAngles.z > 345) && GameManager.Instance.combo != 0)
            {
                GameManager.Instance.combo = GameManager.Instance.combo + 1;
                CollectionManager.Instance.perfect();
                StartCoroutine(UIManager.Instance.ShowPerfectText());
                StartCoroutine(ParticleManager.Instance.StarEffects(star));
            }

            if (!isDead)
            {
                StartCoroutine(ParticleManager.Instance.LandingEffects(landingEffects));
                CameraShake.Instance.isAnimationPlaying = true;
            }
        }

        if (other.gameObject.tag == "RiskyJump")
        {
            riskyJump = true;
        }

        if (other.gameObject.tag == "Jump")
        {
            canJump = true;
        }

        if (other.gameObject.tag == "Death")
        {
            isDead = true;
        }

        if (other.gameObject.tag == "ObstacleBig")
        {
            isBigObstacle = true;
        }

        if (other.gameObject.tag == "ObstacleNormal")
        {
            isNormalObstacle = true;
        }

        if (other.gameObject.tag == "ObstacleSmall")
        {
            isSmallObstacle = true;
        }
    }