using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class TextController : MonoBehaviour
void OnTriggerStay( Collider other )
{
// Playerタグをターゲットにする
if( other.tag == "Player" )
{
public string[] scenarios;
[SerializeField] Text uiText;
[SerializeField][Range(0.001f, 0.3f)] float intervalForCharacterDisplay = 0.05f; private string currentText = string.Empty; private float timeUntilDisplay = 0; private float timeElapsed = 1; private int currentLine = 0; private int lastUpdateCharacter = -1; // 文字の表示が完了しているかどうか public bool IsCompleteDisplayText { get { return Time.time > timeElapsed + timeUntilDisplay; } } void Start() { SetNextLine(); } void Update () { // 文字の表示が完了してるならクリック時に次の行を表示する if( IsCompleteDisplayText ){ if(currentLine < scenarios.Length && Input.GetMouseButtonDown(0)){ SetNextLine(); } }else{ // 完了してないなら文字をすべて表示する if(Input.GetMouseButtonDown(0)){ timeUntilDisplay = 0; } } int displayCharacterCount = (int)(Mathf.Clamp01((Time.time - timeElapsed) / timeUntilDisplay) * currentText.Length); if( displayCharacterCount != lastUpdateCharacter ){ uiText.text = currentText.Substring(0, displayCharacterCount); lastUpdateCharacter = displayCharacterCount; } } void SetNextLine() { currentText = scenarios[currentLine]; timeUntilDisplay = currentText.Length * intervalForCharacterDisplay; timeElapsed = Time.time; currentLine ++; lastUpdateCharacter = -1; }
}
Assets/Assets/Scripts/kaiwaivent.cs(7,4): error CS1525: Unexpected symbol `void'
↑このようになってしまいます
なにをもって「悪い」と定義すればいいのでしょうか? エラーかなにか出ますか? それともコーディングやネーミングが悪い?