南瓜脸为什么笑到一半
我的南瓜脸为什么笑到一半就重新开始再笑一次完整的????
我的南瓜脸为什么笑到一半就重新开始再笑一次完整的????
2017-12-07
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class storyBoard : MonoBehaviour
{
public GameObject particle;//粒子效果
public GameObject moon;//月亮
public GameObject batGroup;//蝙蝠
public GameObject face;//南瓜脸
public GameObject word;//文字
//精灵显示间隔时间
float[] jianGeShiJianArray = new float[] { 4, 6, 8, 10, 12 };
//数组索引
int index = 0;
//点击显示文字
//bool canClick;
// Use this for initialization
void Start()
{
//不显示
particle.SetActive(false);
//moon.SetActive(false);
batGroup.SetActive(false);
face.SetActive(false);
word.SetActive(false);
}
// Update is called once per frame
void Update()
{
if (index < jianGeShiJianArray.Length && Time.realtimeSinceStartup >= jianGeShiJianArray[index])
{
OnTime(index);
index++;
}
/*
if (canClick && Input.GetMouseButtonUp(0))
{
word.SetActive(true);
}
*/
}
void OnTime(int index)
{
switch (index)
{
case 0:
particle.SetActive(true);
break;
case 1:
{
batGroup.SetActive(true);
break;
}
case 2:
{
face.SetActive(true);
break;
}
case 3:
{
face.GetComponent<AudioSource>().Play();
break;
}
case 4:
{
// canClick = true;
word.SetActive(true);
break;
}
}
}
}
举报