コード例 #1
0
    void DestroyGem(GameObject gem, GameObject gemEffect, Sprite gemImg)
    {
        Destroy(gem);
        collectedGems++;
        if (collectedGems == totalGems)
        {
            door.SetActive(true);
        }
        Destroy(Instantiate(gemEffect, gem.transform.position, gem.transform.rotation), 5f);

        switch (collectedGems)
        {
        case 0:
            break;

        case 1:
            Gem1.SetActive(true);
            Gem1.GetComponent <Image>().sprite = gemImg;
            break;

        case 2:
            Gem2.SetActive(true);
            Gem2.GetComponent <Image>().sprite = gemImg;
            break;

        case 3:
            Gem3.SetActive(true);
            Gem3.GetComponent <Image>().sprite = gemImg;
            break;
        }
    }
コード例 #2
0
ファイル: Item.cs プロジェクト: say1981/Rawr
        public unsafe Stats GetTotalStats(Character character)
        {
            if (cachedTotalStats != null)
            {
                return(cachedTotalStats);
            }
            bool  volatileGem = false, volatileItem = false;
            Stats totalItemStats = new Stats();

            fixed(float *pRawAdditiveData = totalItemStats._rawAdditiveData, pRawMultiplicativeData = totalItemStats._rawMultiplicativeData, pRawNoStackData = totalItemStats._rawNoStackData)
            {
                totalItemStats.BeginUnsafe(pRawAdditiveData, pRawMultiplicativeData, pRawNoStackData);
                totalItemStats.AccumulateUnsafe(this.Stats);
                bool eligibleForSocketBonus = GemMatchesSlot(Gem1, Sockets.Color1) &&
                                              GemMatchesSlot(Gem2, Sockets.Color2) &&
                                              GemMatchesSlot(Gem3, Sockets.Color3);

                if (Gem1 != null && Gem1.MeetsRequirements(character, out volatileGem))
                {
                    totalItemStats.AccumulateUnsafe(Gem1.Stats);
                }
                volatileItem = volatileItem || volatileGem;
                if (Gem2 != null && Gem2.MeetsRequirements(character, out volatileGem))
                {
                    totalItemStats.AccumulateUnsafe(Gem2.Stats);
                }
                volatileItem = volatileItem || volatileGem;
                if (Gem3 != null && Gem3.MeetsRequirements(character, out volatileGem))
                {
                    totalItemStats.AccumulateUnsafe(Gem3.Stats);
                }
                volatileItem = volatileItem || volatileGem;
                if (eligibleForSocketBonus)
                {
                    totalItemStats.AccumulateUnsafe(Sockets.Stats);
                }
                if (!volatileItem)
                {
                    cachedTotalStats = totalItemStats;
                }
            }

            return(totalItemStats);
        }
コード例 #3
0
    void Awake()
    {
        // Set up references
        door          = GameObject.FindGameObjectWithTag("Door");
        groundCheck   = transform.Find("GroundCheck");
        firePoint     = transform.Find("FirePoint");
        body2D        = GetComponent <Rigidbody2D>();
        anim          = GetComponent <Animator>();
        healthManager = GetComponent <PlayerHealth>();
        totalGems     = GameObject.FindGameObjectsWithTag("Gem").Length;
        GemUI         = GameObject.Find("GemUI");
        Gem1          = GameObject.Find("Gem1");
        Gem2          = GameObject.Find("Gem2");
        Gem3          = GameObject.Find("Gem3");

        door.SetActive(false);
        Gem1.SetActive(false);
        Gem2.SetActive(false);
        Gem3.SetActive(false);
    }