Пример #1
0
    private bool movementSFXplaying;    // controlamos si el sonido de movimiento esta sonadno


    // Use this for initialization
    void Start()
    {
        // referencias
        scManager        = gameManager.GetComponent <ScoreManager>();
        gManager         = gameManager.GetComponent <GameManager>();
        lfManager        = gameManager.GetComponent <LifesManager>();
        audioSource      = GetComponent <AudioSource>();
        audioSource.clip = movementSound;
        audioSource.loop = true;            // el sonido sera en bucle

        // maracamos al jugador como incapaz de moverse
        canMove = false;

        // guardmos el nodo en el que estamos
        currentNode = grid.GetNodeContainingPosition(transform.position);
        initialNode = currentNode;
        Debug.Log("The PacMan is on the node: " + currentNode.gridPosition_x + " :x  " + currentNode.gridPosition_y + " :y");

        // comporvamos si es transitable o no
        if (!currentNode.isTransitable)
        {
            Debug.LogError("ERROR DE POSICIONAMIENTO: PacMan no puede estar en este nodo intransitable", this.gameObject);
        }

        // snapeamos al nodo en el que estamos para que se coloque bien por si no esta bien puesto
        grid.AdjustPosition(this.gameObject, currentNode);

        // miramos si el sondio de movimiento esta sonando
        movementSFXplaying = GetComponent <AudioSource>().isPlaying;
    }
Пример #2
0
    void Start()
    {
        //TODO checar login a facebook
        fbLogin();
        //FBLoggin.GetInstance().onLoginComplete += fbLogin;

        setStartingPlaces();
        FriendsgridLayoutGroup.cellSize = new Vector2(Screen.width * 0.225f, Screen.height * 0.15f);

        inviteFriendsText.text = MultiLanguageTextManager.instance.getTextByID(MultiLanguageTextManager.AFTERGAME_POPUP_FACEBOOK);
        playText.text          = MultiLanguageTextManager.instance.getTextByID(MultiLanguageTextManager.AFTERGAME_POPUP_NEXT);
        PointsUpText.text      = MultiLanguageTextManager.instance.getTextByID(MultiLanguageTextManager.AFTERGAME_POPUP_POINTS_UPER);

        LevelText.text = MultiLanguageTextManager.instance.getTextByID(MultiLanguageTextManager.OBJECTIVES_NAME_TEXT_ID);

        feedback.text = MultiLanguageTextManager.instance.getTextByID(MultiLanguageTextManager.FEEDBACK_TEXT);

        LifesText.text = LifesManager.GetInstance().currentUser.playerLifes.ToString();

                #if UNITY_ANDROID
        shareImage.sprite = androidShare;
                #elif UNITY_IOS
        shareImage.sprite = iosShare;
                #endif
    }
Пример #3
0
 private void Start()
 {
     theScoreManager        = FindObjectOfType <ScoreManager>();
     theLifesManager        = FindObjectOfType <LifesManager>();
     theBridgeNumberManager = FindObjectOfType <BridgeNumberManager>();
     respawnPoint           = GameObject.Find("RespawnPoint");
     player         = GameObject.Find("Player");
     map_length     = 50.19;
     theFuelManager = FindObjectOfType <FuelManager>();
 }
Пример #4
0
 void Start()
 {
     rb2d = GetComponent <Rigidbody2D>();
     mapStartingPosition = new Vector3(0, 0, 0);
     theLifesManager     = FindObjectOfType <LifesManager>();
     theFuelManager      = FindObjectOfType <FuelManager>();
     respawnPoint        = GameObject.Find("RespawnPoint");
     mapDestructionPoint = GameObject.Find("MapDestructionPoint");
     startingPosition    = -24.5;
     destructionPointStartingPosition = 26.98;
 }
Пример #5
0
 protected void setFullLifesNotification()
 {
     if (LifesManager.GetInstance() != null)
     {
         if (LifesManager.GetInstance().getTimeToWait() > 5)
         {
             (LocalNotificationManager.GetInstance() as LocalNotificationManager).modifyAndScheduleNotificationByName(
                 villavanilla.Notifications.ERegisteredNotification.FULL_LIFES,
                 MultiLanguageTextManager.instance.getTextByID(MultiLanguageTextManager.NOTIFICATION_FULL_LIFES),
                 "Kubera", LifesManager.GetInstance().getTimeToWait());
         }
     }
 }
Пример #6
0
    protected void startAnimation()
    {
        float fullTime = 0.5f;
        float quarter  = fullTime * 0.25f;
        float tenth    = fullTime * 0.1f;

        leftDoor.DOAnchorPos(Vector2.zero, quarter);
        rightDoor.DOAnchorPos(Vector2.zero, quarter).OnComplete(() =>
        {
            topLevel.DOAnchorPos(Vector2.zero, quarter);
            facebookInvite.DOAnchorPos(Vector2.zero, quarter);

            this.transform.DOScale(new Vector2(1, 1), quarter).OnComplete(() =>
            {
                closeButton.DOScale(new Vector2(1, 1), tenth);
                icon.DOScale(new Vector2(1, 1), tenth).OnComplete(() =>
                {
                    ContentRT.DOScale(new Vector2(1, 1), tenth).OnComplete(() =>
                    {
                        retry.DOScale(new Vector2(1, 1), tenth).OnComplete(() =>
                        {
                            facebookFriends.DOScale(new Vector2(1, 1), tenth).OnComplete(() =>
                            {
                                /*LevelLeaderboard leaderboard = leaderboardManager.getLeaderboard(PersistentData.GetInstance().lastLevelPlayedName,slotParent);
                                 * leaderboard.showSlots(true);
                                 *
                                 * scrollRect.horizontalNormalizedPosition = 0;*/

                                facebookInvite.DOScale(new Vector2(1, 1), tenth);

                                leftHeart.DORotate(new Vector3(0, 0, 5), 0.2f).SetEase(heartAnimation);
                                rightHeart.DORotate(new Vector3(0, 0, -5), 0.2f).SetEase(heartAnimation).OnComplete(() =>
                                {
                                    numberNegative.DOColor(new Color(1, 1, 1, 1), quarter).OnComplete(() =>
                                    {
                                        numberNegative.DOColor(new Color(1, 1, 1, 0), 1f);
                                        numberNegativeShadow.DOColor(new Color(1, 1, 1, 0), 1f);
                                        numberNegative.rectTransform.DOLocalMoveY(numberNegative.rectTransform.localPosition.y * 3, 1f);

                                        textHeart.DOText(LifesManager.GetInstance().currentUser.playerLifes.ToString(), 0.4f);
                                        textHeartShadow.DOText(LifesManager.GetInstance().currentUser.playerLifes.ToString(), 0.4f);
                                        askFriendsButtonAnimation();
                                    });
                                });
                            });
                        });
                    });
                });
            });
        });
    }
Пример #7
0
    public void OnLifesPressed()
    {
        KuberaUser currentUser = (DataManagerKubera.GetInstance() as DataManagerKubera).currentUser;

        if (currentUser.playerLifes == LifesManager.GetInstance().maximumLifes)
        {
            openPopUp(fullLifes_PopUp);
        }
        else if (currentUser.playerLifes == 0)
        {
            openPopUp(noLifes_PopUp);
        }
        else
        {
            openPopUp(missingLifes_PopUp);
        }
    }
Пример #8
0
    public void rechargeLifes()
    {
        if (ShopikaManager.GetCastedInstance <ShopikaManager>().isPossibleToConsumeGems(price))
        {
            ShopikaManager.GetCastedInstance <ShopikaManager>().tryToConsumeGems(price);
            LifesManager.GetInstance().giveLifesToUser(LifesManager.GetInstance().maximumLifes);

            KuberaAnalytics.GetInstance().registerGemsUsedOnLifes(PersistentData.GetInstance().lastLevelReachedName);

            popUp.SetActive(false);
            OnComplete();
        }
        else
        {
            OnComplete("notMoney", false);
        }
    }
Пример #9
0
    public override void activate()
    {
        popUp.SetActive(true);

        PersistentData.GetInstance().startLevel--;
        char[] lvl;

        switch (PersistentData.GetInstance().lastLevelPlayedName.Length)
        {
        case 1:
            LevelNumberUnit.text = PersistentData.GetInstance().lastLevelPlayedName;
            LevelNumberDecimal.gameObject.SetActive(false);
            LevelNumberHundred.gameObject.SetActive(false);
            break;

        case 2:
            lvl = PersistentData.GetInstance().lastLevelPlayedName.ToCharArray();
            LevelNumberUnit.text    = lvl[1].ToString();
            LevelNumberDecimal.text = lvl[0].ToString();
            LevelNumberHundred.gameObject.SetActive(false);
            break;

        case 3:
            lvl = PersistentData.GetInstance().lastLevelPlayedName.ToCharArray();
            LevelNumberUnit.text    = lvl[2].ToString();
            LevelNumberDecimal.text = lvl[1].ToString();
            LevelNumberHundred.text = lvl[0].ToString();
            break;
        }

        if ((DataManagerKubera.GetInstance() as DataManagerKubera).currentUser.playerLifes == 0)
        {
            playText.text = MultiLanguageTextManager.instance.getTextByID(MultiLanguageTextManager.LOOSEGAME_POPUP_RETRY_NOLIFES);
        }
        else
        {
            playText.text = MultiLanguageTextManager.instance.getTextByID(MultiLanguageTextManager.LOOSEGAME_POPUP_NEXT);
        }

        int currentLifes = LifesManager.GetInstance().currentUser.playerLifes + 1;

        textHeart.text = textHeartShadow.text = currentLifes.ToString();

        Invoke("startAnimation", 0.25f);
    }
Пример #10
0
 public void acceptGift(bool life, int giftCount, GameObject requestToDelete, List <string> requestId, string bossReached = "0")
 {
     //TODO:
     if (life)
     {
         //print("recibi " + giftCount + ": vidas");
         LifesManager.GetInstance().giveALife(giftCount);
     }
     else
     {
         //print("recibi " + giftCount + ": llaves");
         mapManager.unlockBoss(bossReached);
     }
     for (int i = 0; i < requestId.Count; i++)
     {
         deleteAppRequest(requestId [i]);
     }
     DestroyImmediate(requestToDelete);
 }
Пример #11
0
    protected void setParalaxManager()
    {
        if (currentLevel == null)
        {
            currentLevel = mapLevels [0];
            PersistentData.GetInstance().lastLevelReachedName = currentLevel.fullLvlName;
        }

        if (first)
        {
            paralaxManager.setPosLastOrFirst(true);
            first = false;
        }
        else if (last)
        {
            paralaxManager.setPosLastOrFirst(false);
            last = false;
        }
        else if (fromGame)
        {
            if (PersistentData.GetInstance().fromLoose)
            {
                popUpManager.activatePopUp("retryPopUp");
                stopInput(true);

                (DataManagerKubera.GetInstance() as DataManagerKubera).incrementLevelAttemp(PersistentData.GetInstance().currentLevel.name);

                if (LifesManager.GetInstance().currentUser.playerLifes == 0)
                {
                    KuberaAnalytics.GetInstance().registerLevelWhereReached0Lifes(PersistentData.GetInstance().currentLevel.name);
                }
            }
            else
            {
                int starsReached = PersistentData.GetInstance().lastPlayedLevelStars;                //;(DataManagerKubera.GetInstance () as DataManagerKubera).getLevelStars (PersistentData.GetInstance ().currentLevel.name);
                int pointsMade   = PersistentData.GetInstance().lastPlayedLevelPoints;               //(DataManagerKubera.GetInstance () as DataManagerKubera).getLevelPoints (PersistentData.GetInstance ().currentLevel.name);

                goalManager.initializeFromString(PersistentData.GetInstance().currentLevel.goal);

                string levelName = PersistentData.GetInstance().currentLevel.name;
                for (int i = 0; i < levelName.Length; i++)
                {
                    if (levelName [i] == '0')
                    {
                        levelName = levelName.Remove(i, 1);
                        i--;
                    }
                    else
                    {
                        break;
                    }
                }


                goalAfterGame.setGoalPopUpInfo(starsReached, levelName, pointsMade.ToString(), PersistentData.GetInstance().currentWorld);
                popUpManager.activatePopUp("goalAfterGame");
                stopInput(true);
            }

            if (toStairs)
            {
                paralaxManager.setPosByCurrentLevel(paralaxManager.getPosByLevel(mapLevels[mapLevels.Count - 1]));
            }
            else
            {
                paralaxManager.setPosByCurrentLevel(paralaxManager.getPosByLevel(lastLevelPlayed));
            }
        }
        else
        {
            //print ("currentLevel " + currentLevel);
            //paralaxManager.setPosByCurrentLevel (paralaxManager.getPosByLevel( mapLevels [0]));
            paralaxManager.setPosByCurrentLevel(paralaxManager.getPosByLevel(currentLevel));
        }
    }