示例#1
0
//	void OnEnable(){
//		_ic = GameObject.FindWithTag ("Item_Canvas").GetComponent<Item_Controller> ();
//		itemlist = _ic.GetComponentInChildren<TurnOnOffItemList> ();
//		for (int i = 0; i < _ic._item_list.Length; i++) {
//			if (_ic._item_name_list [i] == "Star") {
//					Star_pos = GameObject.Find ("Item_button_" + i).GetComponent<RectTransform> ();
//				}
//			}
//	}

    void Update()
    {
//		if (findIC == false) {
//			Debug.Log (GameObject.FindWithTag ("Item_Canvas").name);
//			_ic = GameObject.FindWithTag ("Item_Canvas").GetComponent<Item_Controller> ();
//			itemlist = _ic.GetComponentInChildren<TurnOnOffItemList> ();
//			if (Star_pos == null) {
//				for (int i = 0; i < _ic._item_list.Length; i++) {
//					if (_ic._item_name_list [i] == "Star") {
//						Star_pos = GameObject.Find ("Item_button_" + i).GetComponent<RectTransform> ();
//					}
//				}
//			}
//			Debug.Log ("4 find IC " + findIC);
//			findIC = true;
//		}

        //Debug.Log (GameObject.FindWithTag ("Item_Canvas").name);
        _ic      = GameObject.FindWithTag("Item_Canvas").GetComponent <Item_Controller> ();
        itemlist = _ic.GetComponentInChildren <TurnOnOffItemList> ();
        if (Star_pos == null)
        {
            for (int i = 0; i < _ic._item_list.Length; i++)
            {
                if (_ic._item_name_list [i] == "Star")
                {
                    Star_pos = GameObject.Find("Item_button_" + i).GetComponent <RectTransform> ();
                }
            }
        }
        s.position      = new Vector3(Star_pos.position.x - 50, Star_pos.position.y, Star_pos.position.z);
        itemlist.OnTime = Time.realtimeSinceStartup;
    }
示例#2
0
 void Awake()
 {
     //mainCam = Camera.main;
     rectTransform = GetComponent <RectTransform> ();
     ic            = GameObject.FindWithTag("Item_Canvas").GetComponent <Item_Controller> ();
     itemlist      = ic.GetComponentInChildren <TurnOnOffItemList> ();
     Debug.Log(nameFind);
 }
示例#3
0
 void OnEnable()
 {
     _ic      = GameObject.FindWithTag("Item_Canvas").GetComponent <Item_Controller> ();
     itemlist = _ic.GetComponentInChildren <TurnOnOffItemList> ();
     for (int i = 0; i < _ic._item_list.Length; i++)
     {
         if (_ic._item_name_list [i] == "별감")
         {
             Star_pos = GameObject.Find("Item_button_" + i).GetComponent <RectTransform> ();
         }
     }
 }
 void Awake()
 {
     onofflist = GetComponentInChildren<TurnOnOffItemList> ();
     DontDestroyOnLoad (transform.gameObject);
     cant_pick_during_using = true;
     for (int i = 0; i < 5; i++) {
         _item_name_list [i] = "";
         _usable_item[i] = false;
         _the_number_of_items[i] = 0;
         _interaction_object [i] = "";
         _consumable [i] = false;
         _item_list [i].GetComponent<Image> ().color = new Color (255, 255, 255, 0);
         _item_list [i].transform.parent.GetComponentInChildren<Text> ().color = new Color (255, 255, 255, 0);
         //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
         _explanations[i] = "";
         //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     }
 }
示例#5
0
    //ani//

    void Awake()
    {
        Debug.Log("item canvas awake");
        mbr       = GameObject.FindWithTag("Player").GetComponent <Moving_by_RLbuttons> ();
        onofflist = GetComponentInChildren <TurnOnOffItemList> ();
        DontDestroyOnLoad(transform.gameObject);
        cant_pick_during_using = true;
        for (int i = 0; i < 5; i++)
        {
            _item_name_list [i]     = "";
            _usable_item[i]         = false;
            _the_number_of_items[i] = 0;
            _interaction_object [i] = "";
            _consumable [i]         = false;
            _item_list [i].GetComponent <Image> ().color = new Color(255, 255, 255, 0);
            _item_list [i].transform.parent.GetComponentInChildren <Text> ().color = new Color(255, 255, 255, 0);
            //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
            _explanations[i] = "";
            //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        }
    }
示例#6
0
    public bool Talk(int _lineNo)
    {
        lineNo = _lineNo;

        for (int i = 0; i < names.Length; i++)
        {
            if (names [i] == speaker[lineNo])              //같은 이름 NPC 찾고

            {
                for (int x = 0; x < cocoDialogue.Length; x++)
                {
                    cocoDialogue [x].SetActive(false);
                }                 //직전에 한 대사를 모두 끈다.

                if (speaker [lineNo] == "Coco")
                {
                    for (int j = 0; j < cocoDialogue.Length; j++)
                    {
                        if ((int)textLine[lineNo][0] == (int)cocoDialogue[j].name[0])
                        {
                            cocoDialogue [j].SetActive(true);
                            if (player.transform.localScale.x > 0)
                            {
                                cocoDialogue [j].transform.localScale = new Vector3(-1, 1, 1);
                                cocoDialogue [j].GetComponentInChildren <Transform> ().localScale = new Vector3(-1, 1, 1);
                            }
                            else if (player.transform.localScale.x < 0)
                            {
                                cocoDialogue [j].transform.localScale = new Vector3(1, 1, 1);
                                cocoDialogue [j].GetComponentInChildren <Transform> ().localScale = new Vector3(1, 1, 1);
                            }
                            break;
                        }
                    }
                }

                if (speaker [lineNo] == "Star")
                {
                    try{
                        TurnOnOffItemList s = GameObject.FindWithTag("Item_Canvas").GetComponentInChildren <TurnOnOffItemList> ();
                        if (s.OnOffButton.localScale.x == 1)
                        {
                            s.TurnOnOffitemList();
                        }
                    } catch {
                    }
                }

                //other character say
                if (speaker[lineNo] == "null")
                {
                    //Debug.Log ("case 1");
                    player_moving.enabled = true;

                    switch (stageNo)
                    {
                    case 0:
                        break;

                    case 1:
                        //Stage1_Controller.q [int.Parse (textLine [lineNo])] = true;
                        break;

                    case 2:
                        //Stage2_Controller.q [int.Parse (textLine [lineNo])] = true;
                        break;

                    case 3:
                        //Stage3_Controller.q [int.Parse (textLine [lineNo])] = true;
                        break;

                    case 4:
                        Stage4_Controller.q [int.Parse(textLine [lineNo])] = true;
                        break;

                    case 5:
                        Stage5_Controller.q [int.Parse(textLine [lineNo])] = true;
                        break;

                    case 6:
                        Stage6_Controller.q [int.Parse(textLine [lineNo])] = true;
                        break;

                    default:
                        break;
                    }

                    lineNo--;
                    return(false);
                }
                else if (lineNo < speaker.Length - 1 && speaker [lineNo] == speaker [lineNo + 1])
                {
                    //Debug.Log("case 2");
                    textBoxes [i].SetActive(true);
                    player_moving.enabled = false;
                    textInBoxes [i].text  = textLine [lineNo++];
                    return(true);
                }
                else
                {
                    //Debug.Log("case 3");
                    textBoxes [i].SetActive(true);
                    player_moving.enabled = false;
                    textInBoxes [i].text  = textLine [lineNo++];
                    return(true);
                }
            }
            else if (names [i] != speaker[lineNo])
            {
                textBoxes [i].SetActive(false);
            }
        }
        return(false);
    }
示例#7
0
    public bool NPC_Say_yeah(string npcname)
    {
        for (int i = 0; i < pNum; i++)          //받은 NPC이름하고 가지고 있는 NPC리스트 비교
        {
            if (nameArr [i] == npcname)         //같은 이름 NPC 찾고
            {
                if (npcname == "코코")
                {
                    //
                    _text_boxes[i].transform.parent.gameObject.SetActive(true);
                    //
                    _text_boxes [i].SetActive(true);
                    player_moving.enabled = false;

                    for (int x = 0; x < _coco_dialogue.Length; x++)
                    {
                        _coco_dialogue [x].SetActive(false);
                    }                                              //직전에 한 대사를 모두 끈다.

                    if (dialogArr [i] [currLineArr [i]] != "<><>") //현재 대사를 한다.
                    {
                        for (int j = 0; j < _coco_dialogue.Length; j++)
                        {
                            if (dialogArr [i] [currLineArr [i]] == _coco_dialogue[j].name)
                            {
                                //_coco_dialogue [j].transform.rotation = player_moving.gameObject.transform.rotation;
                                _coco_dialogue[j].SetActive(true);
                                currLineArr [i]++;
                                break;
                            }
                        }
                        //_text_in_boxes [i].text = dialogArr [i] [currLineArr [i]++];
                        return(true);
                    }
                    else                        //대화가 끝난 상태면 직전 마지막 말을 반복함
                    {
                        player_moving.enabled = true;
                        currLineArr[i]--;
                        return(false);
                    }
                }

                if (npcname == "별감")
                {
                    TurnOnOffItemList s = GameObject.FindWithTag("Item_Canvas").GetComponentInChildren <TurnOnOffItemList> ();
                    if (s.OnOffButton.localScale.x == 1)
                    {
                        s.TurnOnOffitemList();
                    }
                }

                if (_npc_collider[i])
                {
                    _npc_collider[i].enabled = false;                     //NPC Collider 끄기
                }
                //
                _text_boxes[i].transform.parent.transform.gameObject.SetActive(true);
                //
                _text_boxes [i].SetActive(true);
                player_moving.enabled = false;
                if (dialogArr [i] [currLineArr [i]] != "<><>")
                {
                    _text_in_boxes [i].text = dialogArr [i] [currLineArr [i]++];
                    return(true);
                }
                else                    //대화가 끝난 상태면 직전 마지막 말을 반복함
                {
                    player_moving.enabled = true;
                    currLineArr[i]--;
                    return(false);
                }
            }
            else
            {
                //return false;
            }
        }
        return(false);
    }