private GameObject GetGolemObj(int slot)
    {
        if (!GameManager.Instance.InTutorial)
        {
            GameObject   obj;
            ItemInstance item;
            Debug.Log("Slot is " + slot);
            PenSlot pSlot = shonkyInv.shonkySlots[slot];
            if (pSlot.GetPrefabInstance(out obj))
            {
                Debug.Log("Found gameobject");
                return(obj);
            }

            Debug.Log("No gameobject");
            return(null);
        }
        else
        {
            GameObject   obj;
            ItemInstance item;
            Debug.Log("Slot is " + slot);
            PenSlot pSlot = tutShonkyInv.shonkySlots[slot];
            if (pSlot.GetPrefabInstance(out obj))
            {
                Debug.Log("Found gameobject");
                return(obj);
            }

            Debug.Log("No gameobject");
            return(null);
        }
    }
示例#2
0
    public void MoveToPen(int index)
    {
        PenSlot    slot = GetSlotAtIndex(index);
        GameObject itemObj;

        if (slot.GetPrefabInstance(out itemObj))
        {
            Transform t = itemObj.transform;
            t.DOMove(slot.transform.position + (Vector3.up), 0.7f).SetEase(Ease.OutBack).OnComplete(() =>
                                                                                                    t.DOMove(spawnPos, 5f).SetEase(Ease.OutBack).OnComplete(() => itemObj.GetComponent <ShonkyWander>().enableNavmesh = true));
        }
    }
示例#3
0
    private IEnumerator ShowText(string gemType, Quality.QualityGrade grade, PenSlot slot, GameObject golemObj)
    {
        golemText.enabled       = true;
        golemBottomText.enabled = true;
        golemText.text          = string.Format("New {0} {1} Golem!", grade, gemType);
        golemText.color         = Quality.GradeToColor(grade);
        golemBottomText.color   = Quality.GradeToColor(grade);
        yield return(new WaitForSeconds(3f));

        golemObj.transform.DOMove(slot.transform.position, 1f, false).OnComplete(() => RestartGolem(golemObj));
        //Need to show golem schematic
        TutorialProgressChecker.Instance.UpdateItemStatus("Golem", TutorialProgressChecker.ImageStatus.JustAchieved);
        TutorialProgressChecker.Instance.ShowCanvas(true);
    }
示例#4
0
    private IEnumerator ShowText(string gemType, Quality.QualityGrade grade, PenSlot slot, GameObject golemObj)
    {
        golemText.enabled       = true;
        golemBottomText.enabled = true;
        golemText.text          = string.Format("New {0} {1} Golem!", grade, gemType);
        golemText.color         = Quality.GradeToColor(grade);
        golemBottomText.color   = Quality.GradeToColor(grade);
        yield return(new WaitForSeconds(3f));

        if (golemObj != null)
        {
            golemObj.transform.DOMove(slot.transform.position, 1f, false).OnComplete(() => RestartGolem(golemObj));
        }
        else
        {
            RestartGolem(null);
        }
    }
    private int GetGolemSlot()
    {
        if (!GameManager.Instance.InTutorial)
        {
            for (int i = 0; i < shonkyInv.amountOfSlots; i++)
            {
                Debug.Log("Checking slot " + i + " of " + shonkyInv.amountOfSlots);
                PenSlot    slot = shonkyInv.shonkySlots[i];
                GameObject obj;
                if (slot.GetPrefabInstance(out obj))
                {
                    Debug.Log("obj name is " + obj.name);
                    if (obj == pickedupGolem)
                    {
                        return(slot.index);
                    }
                }
            }
            return(-1);
        }
        else
        {
            for (int i = 0; i < tutShonkyInv.amountOfSlots; i++)
            {
                PenSlot    slot = tutShonkyInv.shonkySlots[i];
                GameObject obj;
                if (slot.GetPrefabInstance(out obj))
                {
                    if (obj == pickedupGolem)
                    {
                        return(slot.index);
                    }
                }
                else
                {
                    return(-1);
                }
            }

            return(-1);
        }
    }
    private int GetGolemSlot()
    {
        for (int i = 0; i < shonkyInv.amountOfSlots; i++)
        {
            PenSlot    slot = shonkyInv.shonkySlots[i];
            GameObject obj;
            if (slot.GetPrefabInstance(out obj))
            {
                if (obj == pickedupGolem)
                {
                    return(slot.index);
                }
            }
            else
            {
                return(-1);
            }
        }

        return(-1);
    }
示例#7
0
    private void FinaliseCombination(Slot current, Slot slot)
    {
        StopAllCoroutines();
        string gemType = toolbox.FindGemType(current, slot);

        int index1, index2;

        index1 = current.index;
        index2 = slot.index;
        //SFX.Play("golem_created");
        Debug.Log("Created Golem");
        //Get the average quality of the shell and charged gem, assign to new golem.
        Quality.QualityGrade item1    = current.itemInstance.Quality;
        Quality.QualityGrade item2    = slot.itemInstance.Quality;
        Quality.QualityGrade avg      = Quality.CalculateCombinedQuality(item1, item2);
        ItemInstance         newGolem = new ItemInstance(gemType, 1, avg, true);
        string gem   = (newGolem.item as Shonky).type.ToString();
        int    index = ShonkyInventory.Instance.InsertItem(newGolem);

        if (index != -1)
        {
            Quaternion rot   = Quaternion.Euler(obj1Rotation);
            PenSlot    pSlot = physicalShonkyInventory.GetSlotAtIndex(index);
            GameObject clone = Instantiate(newGolem.item.physicalRepresentation, desiredPosition.transform.position,
                                           rot);
            clone.GetComponent <ShonkyWander>().enabled = false;
            clone.GetComponent <NavMeshAgent>().enabled = false;
            clone.GetComponent <Rigidbody>().useGravity = false;
            Inventory.Instance.RemoveItem(index1);
            Inventory.Instance.RemoveItem(index2);
            //Move new golem to pen
            pSlot.SetItemInstantiated(newGolem, clone);
            toolbox.ClearGolemCreation(slot);
            StartCoroutine(ShowText(gem, avg, pSlot, clone));
        }
    }
示例#8
0
    private void FinaliseCombination(Slot current, Slot slot)
    {
        StopAllCoroutines();
        gemType = toolbox.FindGemType(current, slot);

        int index1, index2;

        index1 = current.index;
        index2 = slot.index;
        //SFX.Play("golem_created");
        Debug.Log("Created Golem");
        //Get the average quality of the shell and charged gem, assign to new golem.
        Quality.QualityGrade item1    = current.itemInstance.Quality;
        Quality.QualityGrade item2    = slot.itemInstance.Quality;
        Quality.QualityGrade avg      = Quality.CalculateCombinedQuality(item1, item2);
        ItemInstance         newGolem = new ItemInstance(gemType, 1, avg, true);
        string gem = (newGolem.item as Shonky).type.ToString();

        int index = ShonkyInventory.Instance.InsertItem(newGolem);

        if (index != -1)
        {
            Quaternion rot   = Quaternion.Euler(obj1Rotation);
            PenSlot    pSlot = physicalShonkyInventory.GetSlotAtIndex(index);
            GameObject clone = Instantiate(newGolem.item.physicalRepresentation, desiredPosition.transform.position,
                                           rot);
            clone.GetComponent <ShonkyWander>().enabled = false;
            clone.GetComponent <NavMeshAgent>().enabled = false;
            clone.GetComponent <Rigidbody>().useGravity = false;
            Inventory.Instance.RemoveItem(index1);
            Inventory.Instance.RemoveItem(index2);
            //Reset Variables in toolbox and remove held references to deleted objects
            pSlot.SetItemInstantiated(newGolem, clone);
            toolbox.ClearGolemCreation(slot);

            //If a true golem, do narrative handling
            if (newGolem.Quality == Quality.QualityGrade.Mystic)
            {
                Debug.Log("gem type is " + gemType);
                // NOTE: gemType == "RubyGolem1", but GemStringToGolem checks for "ruby"?
                if (TrueGolems.PotentialUnlockTrueGolem(TrueGolems.GemStringToGolem(gemType)))
                {
                    //Show relevant dialogue based on amount of true golems previously made
                    List <TrueGolems.TrueGolem> golemsUnlocked = Inventory.Instance.GetUnlockedTrueGolems();
                    //Need to get boolean to handle if the narrative is not necessary.
                    bool gizmo;
                    switch (golemsUnlocked.Count)
                    {
                    case 0:
                        gizmo = NarrativeManager.Read("true_golem_01");
                        break;

                    case 1:
                        gizmo = NarrativeManager.Read("true_golem_02");
                        break;

                    case 2:
                        gizmo = NarrativeManager.Read("true_golem_03");
                        break;

                    case 3:
                        gizmo = NarrativeManager.Read("true_golem_04");
                        break;

                    default:
                        gizmo = false;
                        break;
                    }

                    Debug.Log("Gizmo is " + gizmo);
                    if (!gizmo)
                    {
                        PopupTextManager.onClose += () => TransitionToHall();

                        //Instantiate glow on golem and make it dance
                        glowObject = Instantiate(glowParticle, clone.transform);
                        glowObject.transform.localPosition = new Vector3(0f, 0f, 0f);
                        glowObject.transform.localScale    = new Vector3(1f, 1f, 1f);
                        clone.GetComponent <Animator>().Play("Dance");

                        //Remove golem from golem inventory as the player does not receive one when first creating a true golem
                        ShonkyInventory.Instance.RemoveItem(index);
                    }
                    else
                    {
                        Inventory.Instance.UnlockTrueGolem(TrueGolems.GemStringToGolem(gemType));
                        StartCoroutine(ShowText(gem, avg, pSlot, clone));
                    }
                }
                else
                {
                    StartCoroutine(ShowText(gem, avg, pSlot, clone));
                }
            }
            else
            {
                StartCoroutine(ShowText(gem, avg, pSlot, clone));
            }
        }
    }