public void QuestSetFocus(int iter_in)
    {
        QuestTemplate tempActiveQuest = tempList[iter_in].GetComponent <QuestTemplate>();

        if (tempActiveQuest.questCategory == QuestCategory.Completed)
        {
            return;
        }

        QuestsHolder.QuestSetFocus(tempList[iter_in]);
        UpdateFocusUI(QuestsHolder.ReturnFocus());
    }
Esempio n. 2
0
    public void UpdateObjLoc()
    {
        foreach (Transform temp in ObjParent)
        {
            Destroy(temp.gameObject);
        }

        GameObject tempObj = quests.ReturnFocus();

        if (tempObj != null)
        {
            QuestTemplate tempScipt = tempObj.GetComponent <QuestTemplate>();
            Color         objColor;
            if (tempScipt.returnActiveLocs().Item1) //Forced
            {
                objColor = new Color(1, 0, 0, .5f);
            }
            else //Hint
            {
                objColor = new Color(0, 0, 1, .5f);
            }


            foreach ((Vector2, float)loc in tempScipt.returnActiveLocs().Item2)
            {
                Vector2 startingLoc = new Vector2(loc.Item1.x - MapCenter.x, loc.Item1.y - MapCenter.y);
                startingLoc *= (mapsize / (Worldmapsize));

                Vector2 rotatedObjloc;
                rotatedObjloc.x = (startingLoc.x - startingLoc.y) / 2;
                rotatedObjloc.y = (startingLoc.x + startingLoc.y) / 2;

                GameObject temp;
                if (loc.Item2 >= 100)
                {
                    temp = Instantiate(Circle, ObjParent);
                    float size = loc.Item2 * Mathf.Sqrt(2) * (mapsize / (Worldmapsize));
                    temp.GetComponent <RectTransform>().sizeDelta = new Vector2(size, size);
                }
                else
                {
                    objColor.a = 1f;
                    temp       = Instantiate(Point, ObjParent);
                }

                temp.GetComponent <Image>().color = objColor;
                temp.GetComponent <RectTransform>().localPosition = new Vector3(rotatedObjloc.x, rotatedObjloc.y, 0f);
            }
        }
    }
Esempio n. 3
0
    void ControlFocusLight()
    {
        GameObject tempObj = quests.ReturnFocus();

        if (tempObj)
        {
            QuestTemplate tempScipt = tempObj.GetComponent <QuestTemplate>();

            Vector2 min_distance_vec = new Vector2();
            bool    first            = true;

            foreach ((Vector2, float)loc in tempScipt.returnActiveLocs().Item2)
            {
                if (first)
                {
                    first            = false;
                    min_distance_vec = new Vector2(loc.Item1.x - transform.position.x, loc.Item1.y - transform.position.z);
                }
                else
                {
                    Vector2 tempVec = new Vector2(loc.Item1.x - transform.position.x, loc.Item1.y - transform.position.z);
                    if (tempVec.magnitude < min_distance_vec.magnitude)
                    {
                        min_distance_vec = tempVec;
                    }
                }
            }

            if (!first)
            {
                float angle     = Mathf.Atan2(min_distance_vec.x, min_distance_vec.y) * Mathf.Rad2Deg;
                float ver_angle = Mathf.Atan2(height, min_distance_vec.magnitude) * Mathf.Rad2Deg;
                float final_ver_angle;
                if (ver_angle > focusLightAngle)
                {
                    final_ver_angle = ver_angle;
                }
                else
                {
                    final_ver_angle = focusLightAngle;
                }
                focus_light.enabled           = true;
                focus_light_trans.eulerAngles = new Vector3(final_ver_angle, angle, focus_light_trans.localEulerAngles.z);
            }
        }
        else
        {
            focus_light.enabled = false;
        }
    }