public void Sayit(string text, Color color, Vector3 position) { Hit txt = damageText.Create(); damageText.prefab.transform.position = new Vector3(Random.Range(-150, 150), Random.Range(0, 300)); txt.GetComponent <Animation>().Play("RisingText"); txt.animationLenght = 1.0f; txt.Adjust(text); //txt.GetComponent<RectTransform>().anchoredPosition3D = new Vector3(0.0f, 0.0f, 0.0f); txt.textView.GetComponent <RectTransform>().localScale = new Vector3(0.8f, 0.8f, 1.0f); txt.textView.color = color; }
// Update is called once per frame void Update() { NPCDialog.GetComponent <UILabel>().text = Text; Hits = Physics.OverlapSphere(this.transform.position, InteractRange); foreach (Collider Hit in Hits) { if (Hit.name == "player") { if (!Phone_AppearorDis.isCallOut && Input.GetKeyDown("f")) { transform.LookAt(Hit.transform.position); CallOut(); int FinishMission = MissionController.FindFinishMission(this.name); if (FinishMission != 0) { DialogController.SetNPCName(this.name); DialogController.SetFinishedMissionID(FinishMission); Hit.GetComponent <BasicMove>().SetControllable(false); } else { Tuple <string, int> MissionInfo = MissionController.FindNPCDialog(this.name); if (MissionInfo.Item2 != 0) { Debug.Log("任务中对话"); } else { Debug.Log("列表中没有这个任务"); switch (MissionController.AddItemToList(this.name, 100)) { case 0: { Debug.Log("闲聊"); break; } case 1: { Debug.Log("任务对话"); break; } case 2: { Debug.Log("任务已满"); break; } } //如果可以添加任务,就开始任务对话 //如果拒绝任务,就从列表中移除 //如果接受任务,修改任务状态 //如果添加失败,就开始闲聊 } //Debug.Log("NPC.cs:NPC name is " + this.name); DialogController.SetNPCName(this.name); Hit.GetComponent <BasicMove>().SetControllable(false); } } else if (Input.GetKeyDown("e")) { //Debug.Log("对话结束"); CallBack(); Hit.GetComponent <BasicMove>().SetControllable(true); } if (DialogController.IsFinish == true) { CallBack(); Hit.GetComponent <BasicMove>().SetControllable(true); DialogController.IsFinish = false; } } } }
private void Awake() { hitParticleSystem = hitEffect.GetComponent <ParticleSystem>(); }