void OnEnable()
    {
        if (GlobalVariableManager.Instance.EquippedAbilityPins[0] != PIN.NONE)
        {
            pinData = PinManager.Instance.GetPin(GlobalVariableManager.Instance.EquippedAbilityPins[0]);
            equippedAbilityPins[0].SetActive(true);
            equippedAbilityPins[0].GetComponent <tk2dSprite>().SetSprite(pinData.sprite);
        }
        else
        {
            equippedAbilityPins[0].SetActive(false);
        }


        if (GlobalVariableManager.Instance.EquippedAbilityPins[1] != PIN.NONE)
        {
            pinData = PinManager.Instance.GetPin(GlobalVariableManager.Instance.EquippedAbilityPins[1]);
            equippedAbilityPins[1].SetActive(true);
            equippedAbilityPins[1].GetComponent <tk2dSprite>().SetSprite(pinData.sprite);
        }
        else
        {
            equippedAbilityPins[1].SetActive(false);
        }

        GameStateManager.Instance.PushState(typeof(MovieState));
    }
Exemple #2
0
    void SetupPins()
    {
        // Set up all the pin pages.
        var pinsPerPage  = PinManager.Instance.PinRow * PinManager.Instance.PinCol;
        var pinPageCount = PinManager.Instance.pinConfig.pinList.Count / pinsPerPage;

        pinPageList = new List <GameObject>();

        // add a page for any remaining pins.
        if (PinManager.Instance.pinConfig.pinList.Count % pinsPerPage > 0)
        {
            pinPageCount += 1;
        }

        for (int i = 0; i < pinPageCount; ++i)
        {
            GameObject pinPage = ObjectPool.Instance.GetPooledObject("PinPage");
            pinPage.transform.SetParent(PinManager.Instance.PageRoot.transform);
            pinPage.transform.position = PinManager.Instance.PageRoot.transform.position;
            pinPage.name = "Pin Page " + i;
            pinPage.SetActive(true);
            pinPageList.Add(pinPage);
        }

        for (int i = 0; i < PinManager.Instance.pinConfig.pinList.Count; i++)
        {
            PinDefinition pinDefinition = PinManager.Instance.pinConfig.pinList[i];
            int           pageNum       = i / pinsPerPage;
            Vector3       pagePos       = pinPageList[pageNum].transform.position;
            var           pin           = ObjectPool.Instance.GetPooledObject("Pin").GetComponent <Ev_PinBehavior>();
            pin.transform.SetParent(pinPageList[pageNum].transform);

            // populate the pin data
            pin.name = pinDefinition.displayName;

            pin.sprite.SetSprite(pinDefinition.sprite);
            pin.SetPinData(pinDefinition);
            pin.gameObject.SetActive(true);

            var pinSize = pin.sprite.GetComponent <BoxCollider2D>().bounds.size;
            // x, at the page origin, per column, spaced with an offset
            // y, at the page origin, per row, per page, projected downward.
            pin.transform.position = new Vector3(pagePos.x + i % PinManager.Instance.PinCol * (pinSize.x + PinManager.Instance.PinOffsetX),
                                                 pagePos.y + -i / PinManager.Instance.PinCol % PinManager.Instance.PinRow * (pinSize.y + PinManager.Instance.PinOffsetY),
                                                 pagePos.z);
            Debug.Log("Got Here Pin Spawn");
        }

        for (int i = 0; i < pinPageList.Count; ++i)
        {
            // deactivate all but the first page.
            if (i != 0)
            {
                pinPageList[i].SetActive(false);
            }
        }

        arrowPos = 0;
        MoveArrow();
    }
Exemple #3
0
    public override void OnInspectorGUI()
    {
        // Unity inspector is dumb. It doesn't like 64 bit enums.  It can't seem to serialize them either.
        // Well I don't like Unity's face.
        // This kanoodles it so the inspector properly displays an enum dropdown while serializing a 64 bit number (long).
        PinDefinition pinDefinition = (PinDefinition)target;

        pinDefinition.Type     = (PIN)EditorGUILayout.EnumPopup(pinDefinition.Type);
        pinDefinition.pinValue = (long)pinDefinition.Type;

        base.OnInspectorGUI();
        EditorUtility.SetDirty(target);
    }
Exemple #4
0
 public void ShowThings(PinDefinition pindata)
 {
     //Debug.Log("Shop is showing things...");
     harry.GetComponent <tk2dSpriteAnimator>().Play("talk");
     priceDisplayText.text   = pindata.price.ToString();
     pinDescriptionText.text = pindata.description;
     pinTitleText.text       = pindata.displayName;
     priceDisplay.SetActive(true);
     pinInfoDisplay.SetActive(true);
     for (int i = 0; i < pindata.ppValue; i++)
     {
         ppDisplay.transform.GetChild(i).gameObject.SetActive(true);
     }
 }
Exemple #5
0
    void SpawnPins()
    {
        PinDefinition currentPin = null;

        tk2dSprite pinsSprite;
        GameObject spawnedPin;
        Vector2    spawnPos = new Vector2();

        for (int i = 0; i < 3; i++)
        {
            Debug.Log("**PIN SPAWN** - Got here - Pin Spawn for shop x*x*x*x*x*x*x*x*" + GlobalVariableManager.Instance.shopPins.Count);
            if (i == 0)
            {
                currentPin = upgrade1;
                spawnPos   = pedestalSpawnPoints[0].transform.position;
            }
            else if (i == 1)
            {
                currentPin = upgrade2;
                spawnPos   = pedestalSpawnPoints[1].transform.position;
            }
            else if (i == 2)
            {
                currentPin = upgrade3;
                spawnPos   = pedestalSpawnPoints[2].transform.position;
            }

            spawnedPin = ObjectPool.Instance.GetPooledObject("ShopPin", spawnPos);

            // populate the pin data
            spawnedPin.name = currentPin.displayName;
            Debug.Log("**PIN SPAWN** - spawned pin with name:" + spawnedPin.name + currentPin.sprite);
            //  var sprite = spawnedPin.GetComponent<tk2dSprite>();
            // sprite.SetSprite(currentPin.sprite);

            var behavior = spawnedPin.GetComponent <Ev_PinBehavior>();
            behavior.SetPinData(currentPin);
            behavior.SetSprite(currentPin.sprite);

            spawnedPin.SetActive(true);
            todaysPins.Add(spawnedPin);
            //spawnedPin.GetComponent<Ev_PinBehavior>().SetPinData(currentUpgradeCheck);
            //behavior.SetMySpot(i+1);
        }
    }
    // Update is called once per frame
    void Update()
    {
        if (ControllerManager.Instance.GetKeyDown(INPUTACTION.MOVELEFT) && arrowPos > 0)
        {
            arrowPos--;
        }
        else if (ControllerManager.Instance.GetKeyDown(INPUTACTION.MOVERIGHT) && arrowPos < 1)
        {
            arrowPos++;
        }
        else if (ControllerManager.Instance.GetKeyDown(INPUTACTION.INTERACT))
        {
            //TODO: check if slot is filled already

            /*if(GlobalVariableManager.Instance.EquippedAbilityPins[arrowPos] != null){
             *      GlobalVariableManager.Instance.PP_STAT -= GlobalVariableManager.Instance.EquippedAbilityPins[arrowPos].GetData().ppValue; //give back pp from previously equipped pin
             * }*/
            pinData = PinManager.Instance.GetPin(selectedPin);
            StartCoroutine("EquipSequence");
        }
        selectionArrow.transform.position = arrowPositions[arrowPos].transform.position;
    }
    // Use this for initialization

    void Awake()
    {
        for (int i = 0; i < pinConfig.pinList.Count; ++i)
        {
            PINLOOKUP[pinConfig.pinList[i].Type] = pinConfig.pinList[i];
        }



        if (GlobalVariableManager.Instance.EquippedAbilityPins[0] != PIN.NONE)
        {
            pinData = PINLOOKUP[GlobalVariableManager.Instance.EquippedAbilityPins[0]];
            equippedAbilityPins[0].SetActive(true);
            equippedAbilityPins[0].GetComponent <tk2dSprite>().SetSprite(pinData.sprite);
        }
        if (GlobalVariableManager.Instance.EquippedAbilityPins[1] != PIN.NONE)
        {
            pinData = PINLOOKUP[GlobalVariableManager.Instance.EquippedAbilityPins[1]];
            equippedAbilityPins[1].SetActive(true);
            equippedAbilityPins[1].GetComponent <tk2dSprite>().SetSprite(pinData.sprite);
        }
    }
Exemple #8
0
    //bool enteredShop; //just used for shop outside visual changes


    void Start()
    {
        /*if(GlobalVariableManager.Instance.WORLD_SIGNS_READ[0][9] != 'o'){
         *              if(GlobalVariableManager.Instance.TUT_POPUP_ON){
         *                      Instantiate(tutorialPopup,transform.position,Quaternion.identity);
         *                      tutorialPopup.GetComponent<SpriteRenderer>().sprite = tutPopupSprite;
         *              }
         *              GlobalVariableManager.Instance.WORLD_SIGNS_READ[0].Replace(GlobalVariableManager.Instance.WORLD_SIGNS_READ[0][9],'o');
         *      }*/

        manager = GameObject.Find("Manager");

        // TODO: Maybe move this to a configuration in the PinManager?
        //-----------cant spawn any pins that can be found in world ----------------//
        PIN NOT_FOR_SALE_PINS = PIN.FAITHFULWEAPON
                                | PIN.MYLEGACY
                                | PIN.SHARING
                                | PIN.MOGARBAGEMOPROBLEMS
                                | PIN.HAULINHERO
                                // | PIN.PRETTYLUCKY  - pretty lucky = can be bought in shop currently
                                | PIN.POINTYPIN
                                | PIN.LUCKYDAY
                                | PIN.THEPINTHATCANKILLTHEPAST
                                | PIN.WASTEWARRIOR
                                | PIN.STAYBACK
                                | PIN.TALKYTIME
                                | PIN.VITALITYVISION
                                | PIN.CLAWPIN
                                | PIN.WAIFUWANTED
                                | PIN.PIERCINGPIN
                                | PIN.SCRAPPYSHINOBI
                                | PIN.NICEGUY
                                | PIN.HARDLYWORKIN;

        GlobalVariableManager.Instance.shopPins = new List <PinDefinition> {
            null, null, null
        };



        //---------------------------------------set pins in today's shop------------------------------------------//

        //Uses shopPins list to place values for today's pins
        //Reset when activate "Continue" truck at hub.
        upgrade1 = null;
        upgrade2 = null;
        upgrade3 = null;

        // TODO: Maybe define this in the PinManager so it can be tweaked?
        int pinMin = 0;
        int pinMax = 39;

        // Get 3 random pins unless there aren't anymore to be found.
        upgrade1 = PinManager.Instance.GetRandomPin((x) => GlobalVariableManager.Instance.IsPinDiscovered(x.Type) &&
                                                    (NOT_FOR_SALE_PINS & x.Type) != x.Type,
                                                    pinMin, pinMax);

        // first upgrade found
        if (upgrade1 != null)
        {
            GlobalVariableManager.Instance.shopPins[0] = upgrade1;
            upgrade2 = PinManager.Instance.GetRandomPin((x) => GlobalVariableManager.Instance.IsPinDiscovered(x.Type) &&
                                                        (NOT_FOR_SALE_PINS & x.Type) != x.Type &&
                                                        x.Type != upgrade1.Type, pinMin, pinMax);

            // second upgrade found
            if (upgrade2 != null)
            {
                GlobalVariableManager.Instance.shopPins[1] = upgrade2;
                upgrade3 = PinManager.Instance.GetRandomPin((x) => GlobalVariableManager.Instance.IsPinDiscovered(x.Type) &&
                                                            (NOT_FOR_SALE_PINS & x.Type) != x.Type &&
                                                            x.Type != upgrade1.Type && x.Type != upgrade2.Type, pinMin, pinMax);

                if (upgrade3 != null)
                {
                    GlobalVariableManager.Instance.shopPins[2] = upgrade3;
                }
            }
        }



        SpawnPins();

        // Register Events
        purchasePopup.RegisterCloseEvent(OnCloseEvent);
        purchasePopup.RegisterOptionEvent(OnOptionsEvent);
    }
Exemple #9
0
 public void SetPinData(PinDefinition data, GameObject unlockHUD, Sprite pinsprite)
 {
     pinData      = data;
     pinUnlockHud = unlockHUD;
     mySprite     = pinsprite;
 }    //end of pin data set
 public void SetPinData(PinDefinition data)
 {
     pinData = data;
 }    //end of pin data set