42 lines
1.1 KiB
C#
42 lines
1.1 KiB
C#
|
|
using System.Collections;
|
||
|
|
using System.Collections.Generic;
|
||
|
|
using UnityEngine;
|
||
|
|
|
||
|
|
public class NPCActor : MyCoroutine
|
||
|
|
{
|
||
|
|
public string nextanim, msg;
|
||
|
|
|
||
|
|
SaveNPCToolTip speechbubble;
|
||
|
|
|
||
|
|
private void Awake()
|
||
|
|
{
|
||
|
|
speechbubble = DSUtil.Get_Clone<SaveNPCToolTip>("Ingame/SaveNPCToolTip", NewGameUI.Ins.tf_HUD);
|
||
|
|
speechbubble.Set(transform);
|
||
|
|
}
|
||
|
|
|
||
|
|
private void LateUpdate()
|
||
|
|
{
|
||
|
|
if (!speechbubble.Get_Click())
|
||
|
|
speechbubble.gameObject.SetActive(Vector3.Distance(MyValue.MyPC.Get_position(), transform.position) < 20f);
|
||
|
|
}
|
||
|
|
|
||
|
|
public void BubbleOff()
|
||
|
|
{
|
||
|
|
if (!speechbubble.Get_Click())
|
||
|
|
speechbubble.Off();
|
||
|
|
}
|
||
|
|
|
||
|
|
public void Set_Off()
|
||
|
|
{
|
||
|
|
if (!string.IsNullOrEmpty(msg)) NPCScript.Ins.Set_Msg(msg);
|
||
|
|
if (!string.IsNullOrEmpty(nextanim))
|
||
|
|
{
|
||
|
|
transform.LookAt(MyValue.MyPC.transform);
|
||
|
|
var anim = GetComponent<Animation>();
|
||
|
|
anim.Play(nextanim);
|
||
|
|
Set_Coroutine(() => { gameObject.SetActive(false); }, anim[nextanim].length);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
void Set_Idle() { }
|
||
|
|
}
|