Esempio n. 1
0
    void onUIUpdate(Gun gun, PlayerController._GameState state, GameObject clicked, EnemyStats stats)
    {
        // Make sure to change only on proper event, clicked == null checks so we don't duplicate onReloadStart
        if (clicked == null)
        {
            switch (name)
            {
            case "Count0":
                thisLabel.text = "INF";
                break;

            case "Count1":
                thisLabel.text = gun.compatibleAmmo[1].amountOwned.ToString();
                break;

            case "Count2":
                thisLabel.text = gun.compatibleAmmo[2].amountOwned.ToString();
                break;

            case "Count3":
                thisLabel.text = gun.compatibleAmmo[3].amountOwned.ToString();
                break;

            default:
                break;
            }
        }
    }
Esempio n. 2
0
 void onUIUpdate(Gun gun, PlayerController._GameState state, GameObject clicked, EnemyStats stats)
 {
     if (state == PlayerController._GameState.Dead)
     {
         StopAllCoroutines();
     }
 }
Esempio n. 3
0
    void onUIUpdate(Gun gun, PlayerController._GameState state, GameObject clicked, EnemyStats stats)
    {
        if (clicked == gameObject)
        {
            if (onPause != null)
            {
                onPause();
            }
        }

        /*if( state == PlayerController._GameState.Reload )
         * {
         *      iTween.MoveTo( PARENT, iTween.Hash(
         *              "y", TWEEN_POS,
         *              "islocal", true,
         *              "time", 0.4f,
         *              "easetype", iTween.EaseType.easeOutBack
         *              )
         *      );
         * }
         * if( state == PlayerController._GameState.Active || state == PlayerController._GameState.IsReloading )
         * {
         *      iTween.MoveTo( PARENT, iTween.Hash(
         *              "y", RESET_POS,
         *              "islocal", true,
         *              "time", 0.4f,
         *              "easetype", iTween.EaseType.easeInBack
         *              )
         *      );
         * }*/
    }
Esempio n. 4
0
    void onUIUpdate(Gun gun, PlayerController._GameState gameState, GameObject clicked, EnemyStats stats)
    {
        if (gameState == PlayerController._GameState.Reload)
        {
            iTween.MoveTo(gameObject, iTween.Hash(
                              axis, firstPos,
                              "islocal", true,
                              "time", 0.4f,
                              "easetype", iTween.EaseType.easeOutBack
                              )
                          );

            if (name == "Health Meter")
            {
                iTween.MoveTo(gameObject, iTween.Hash(
                                  "y", 300f,
                                  "islocal", true,
                                  "time", 0.4f,
                                  "easetype", iTween.EaseType.easeOutBack
                                  )
                              );
            }
        }
        if (gameState == PlayerController._GameState.Active || gameState == PlayerController._GameState.IsReloading)
        {
            iTween.MoveTo(gameObject, iTween.Hash(
                              "y", secondPos,
                              "islocal", true,
                              "time", 0.4f,
                              "easetype", iTween.EaseType.easeInBack
                              )
                          );

            if (gameState == PlayerController._GameState.Active)
            {
                if (name == "Health Meter")
                {
                    iTween.MoveTo(gameObject, iTween.Hash(
                                      "y", 0,
                                      "islocal", true,
                                      "time", 0.4f,
                                      "easetype", iTween.EaseType.easeOutBack
                                      )
                                  );
                }
                else
                {
                    iTween.MoveTo(gameObject, iTween.Hash(
                                      axis, secondPos,
                                      "islocal", true,
                                      "time", 0.4f,
                                      "easetype", iTween.EaseType.easeOutBack
                                      )
                                  );
                }
            }
        }
    }
Esempio n. 5
0
    void onUIUpdate(Gun gun, PlayerController._GameState state, GameObject clicked, EnemyStats stats)
    {
        scaleToBulletCapacity   = originalScale;
        scaleToBulletCapacity.x = originalScale.x * ((float)gun.capacity / (float)gun.loadedAmmo.magSize);

        if (scaleToBulletCapacity.x == 0)
        {
            scaleToBulletCapacity.x = 0.1f;
        }

        transform.localScale = scaleToBulletCapacity;
    }
Esempio n. 6
0
    void onUIUpdate(Gun gun, PlayerController._GameState gameState, GameObject clicked, EnemyStats stats)
    {
        thisLabel.text  = gun.capacity.ToString();
        thisLabel.color = ORIGINAL_COLOR;

        if (gun.capacity > 0)
        {
            isPanic = false;

            iTween.ScaleTo(gameObject, iTween.Hash(
                               "scale", SCALE_TO,
                               "islocal", true,
                               "time", 0.05f,
                               "easetype", iTween.EaseType.easeOutQuad
                               )
                           );
            iTween.ScaleTo(gameObject, iTween.Hash(
                               "scale", CACHED_SCALE,
                               "islocal", true,
                               "time", 0.05f,
                               "delay", 0.05f,
                               "easetype", iTween.EaseType.easeInQuad
                               )
                           );
        }
        else
        {
            thisLabel.color = PANIC_COLOR;

            if (!isPanic)
            {
                iTween.Stop(gameObject);
                transform.localScale = CACHED_SCALE;

                isPanic = true;
            }

            iTween.ScaleTo(gameObject, iTween.Hash(
                               "scale", SCALE_TO,
                               "islocal", true,
                               "time", 0.1f,
                               "looptype", iTween.LoopType.pingPong,
                               "easetype", iTween.EaseType.easeInQuad
                               )
                           );
        }
    }
Esempio n. 7
0
    void onUIUpdate(Gun gun, PlayerController._GameState state, GameObject clicked, EnemyStats stats)
    {
        if (clicked == gameObject && state != PlayerController._GameState.None)
        {
            if (Application.platform == RuntimePlatform.IPhonePlayer)
            {
                ChartBoostBinding.trackEvent("Health Pack Use");
            }

            switch (name)
            {
            case "HPackTiny":
                DBAccess.instance.userPrefs.useHealthPack(0);
                tweenScale();
                break;

            case "HPackSmall":
                DBAccess.instance.userPrefs.useHealthPack(1);
                tweenScale();
                break;

            case "HPackMedium":
                DBAccess.instance.userPrefs.useHealthPack(2);
                tweenScale();
                break;

            case "HPackLarge":
                DBAccess.instance.userPrefs.useHealthPack(3);
                tweenScale();
                break;

            case "HPackHuge":
                DBAccess.instance.userPrefs.useHealthPack(4);
                tweenScale();
                break;

            default:
                break;
            }
        }
    }
Esempio n. 8
0
    void onUIUpdate(Gun gun, PlayerController._GameState state, GameObject clicked, EnemyStats stats)
    {
        if (clicked == gameObject)
        {
            if (Application.platform == RuntimePlatform.IPhonePlayer)
            {
                ChartBoostBinding.trackEvent("Quit Button Event");
                UnityEngine.Debug.Log("QuitSprite.cs: onUIUpdate: Quit Button Event");
            }

            DBAccess.instance.userPrefs.playCount++;

            if (onQuit != null)
            {
                onQuit();
            }
        }

        /*if( state == PlayerController._GameState.Reload )
         * {
         *      iTween.MoveTo( PARENT, iTween.Hash(
         *              "y", TWEEN_POS,
         *              "islocal", true,
         *              "time", 0.4f,
         *              "easetype", iTween.EaseType.easeOutBack
         *              )
         *      );
         * }
         * if( state == PlayerController._GameState.Active || state == PlayerController._GameState.IsReloading )
         * {
         *      iTween.MoveTo( PARENT, iTween.Hash(
         *              "y", RESET_POS,
         *              "islocal", true,
         *              "time", 0.4f,
         *              "easetype", iTween.EaseType.easeInBack
         *              )
         *      );
         * }*/
    }
Esempio n. 9
0
    void onUIUpdate(Gun gun, PlayerController._GameState state, GameObject clicked, EnemyStats stats)
    {
        if (state == PlayerController._GameState.Results && stats != null && canPress)
        {
            canPress = false;

            expLabel.text  = "0";
            goldLabel.text = DBAccess.instance.userPrefs.Gold.ToString();

            iTween.MoveTo(windowPanel.gameObject, iTween.Hash(
                              "position", RESET_POS,
                              "islocal", true,
                              "time", 0.4f,
                              "delay", 2f,
                              "easetype", iTween.EaseType.easeOutExpo
                              )
                          );

            float expEarned  = (((float)stats.level / (float)DBAccess.instance.userPrefs.Level) * (float)DBAccess.instance.userPrefs.Level) * 3;
            float goldEarned = expEarned / 2f;



            iTween.ValueTo(gameObject, iTween.Hash(
                               "from", 0,
                               "to", expEarned,
                               "delay", 3f,
                               "time", 1f,
                               "onupdatetarget", gameObject,
                               "onupdate", "expValueTo",
                               "easetype", iTween.EaseType.easeOutExpo
                               )
                           );

            iTween.ValueTo(gameObject, iTween.Hash(
                               "from", DBAccess.instance.userPrefs.Gold,
                               "to", goldEarned,
                               "delay", 3f,
                               "time", 1f,
                               "onupdatetarget", gameObject,
                               "onupdate", "goldValueTo",
                               "oncompletetarget", gameObject,
                               "oncomplete", "setExpAndGold",
                               "oncompleteparams", expEarned,
                               "easetype", iTween.EaseType.easeOutExpo
                               )
                           );
        }
        else if (state == PlayerController._GameState.Dead)
        {
            StartCoroutine(deathRoutine(stats));
        }

        if (clicked != null && state != PlayerController._GameState.Dead)
        {
            if (clicked == gameObject)
            {
                moveGridTo(curPos + 1);
            }
        }
    }
Esempio n. 10
0
    void onUIUpdate(Gun gun, PlayerController._GameState state, GameObject clicked, EnemyStats stats)
    {
        if (clicked == gameObject && !gun.isReloading && state != PlayerController._GameState.None)
        {
            if (Application.platform == RuntimePlatform.IPhonePlayer)
            {
                ChartBoostBinding.trackEvent("Secondary Ammo Reload Use");
            }

            switch (name)
            {
            case "Ammo_L0":
                gun.Reload(gun.compatibleAmmo[0]);
                tweenScale();
                break;

            case "Ammo_L1":
                if (gun.compatibleAmmo[1].amountOwned > 0)
                {
                    gun.Reload(gun.compatibleAmmo[1]);
                }
                else
                {
                    thisSprite.collider.enabled = false;
                    thisSprite.alpha            = 0.5f;
                }
                tweenScale();
                break;

            case "Ammo_L2":
                if (gun.compatibleAmmo[2].amountOwned > 0)
                {
                    gun.Reload(gun.compatibleAmmo[2]);
                }
                else
                {
                    thisSprite.collider.enabled = false;
                    thisSprite.alpha            = 0.5f;
                }
                tweenScale();
                break;

            case "Ammo_L3":
                if (gun.compatibleAmmo[3].amountOwned > 0)
                {
                    gun.Reload(gun.compatibleAmmo[3]);
                }
                else
                {
                    thisSprite.collider.enabled = false;
                    thisSprite.alpha            = 0.5f;
                }
                tweenScale();
                break;

            default:
                switch (thisSprite.spriteName)
                {
                case "Ammo_L0":
                    gun.Reload(gun.compatibleAmmo[0]);
                    tweenScale();
                    break;

                case "Ammo_L1":
                    if (gun.compatibleAmmo[1].amountOwned > 0)
                    {
                        gun.Reload(gun.compatibleAmmo[1]);
                    }
                    else
                    {
                        thisSprite.collider.enabled = false;
                        thisSprite.alpha            = 0.5f;
                    }
                    tweenScale();
                    break;

                case "Ammo_L2":
                    if (gun.compatibleAmmo[2].amountOwned > 0)
                    {
                        gun.Reload(gun.compatibleAmmo[2]);
                    }
                    else
                    {
                        thisSprite.collider.enabled = false;
                        thisSprite.alpha            = 0.5f;
                    }
                    tweenScale();
                    break;

                case "Ammo_L3":
                    if (gun.compatibleAmmo[3].amountOwned > 0)
                    {
                        gun.Reload(gun.compatibleAmmo[3]);
                    }
                    else
                    {
                        thisSprite.collider.enabled = false;
                        thisSprite.alpha            = 0.5f;
                    }
                    tweenScale();
                    break;
                }
                break;
            }
        }
    }