求大神把下面JS的代码转化成C#的
在学UNITY对C#的yield用法不是很熟悉求大神转化下JS代码varliveTime:float=2.0;vardelayTime:float=2.0;varstar...
在学UNITY 对C#的yield用法不是很熟悉 求大神转化下JS代码
var liveTime : float = 2.0;
var delayTime : float = 2.0;
var starDelay : float = 0.0;
var box : GameObject;
var IsActive : boolean = true;
function Start () {
yield WaitForSeconds(starDelay);
if(IsActive){
Live();
}else{
Delay();
}
}
function Update () {
}
function Live(){
var k = 0;
while (k < 10){
yield WaitForSeconds(liveTime);
box.SetActive(false);
yield WaitForSeconds(delayTime);
box.SetActive(true);
}
//Delay();
}
function Delay(){
yield WaitForSeconds(delayTime);
box.SetActive(true);
Live();
} 展开
var liveTime : float = 2.0;
var delayTime : float = 2.0;
var starDelay : float = 0.0;
var box : GameObject;
var IsActive : boolean = true;
function Start () {
yield WaitForSeconds(starDelay);
if(IsActive){
Live();
}else{
Delay();
}
}
function Update () {
}
function Live(){
var k = 0;
while (k < 10){
yield WaitForSeconds(liveTime);
box.SetActive(false);
yield WaitForSeconds(delayTime);
box.SetActive(true);
}
//Delay();
}
function Delay(){
yield WaitForSeconds(delayTime);
box.SetActive(true);
Live();
} 展开
- 你的回答被采纳后将获得:
- 系统奖励15(财富值+成长值)+难题奖励10(财富值+成长值)+提问者悬赏10(财富值+成长值)
1个回答
展开全部
float liveTime= 2.0;
float delayTime= 2.0;
float starDelay= 0.0;
GameObject box;
bool IsActive= true;
public void Start () {
yield WaitForSeconds(starDelay);
if(IsActive){
Live();
}else{
Delay();
}
}
public void Update () {
}
public void Live(){
int k = 0;
while (k < 10){
yield WaitForSeconds(liveTime);
box.SetActive(false);
yield WaitForSeconds(delayTime);
box.SetActive(true);
}
//Delay();
}
public void Delay(){
yield WaitForSeconds(delayTime);
box.SetActive(true);
Live();
}
float delayTime= 2.0;
float starDelay= 0.0;
GameObject box;
bool IsActive= true;
public void Start () {
yield WaitForSeconds(starDelay);
if(IsActive){
Live();
}else{
Delay();
}
}
public void Update () {
}
public void Live(){
int k = 0;
while (k < 10){
yield WaitForSeconds(liveTime);
box.SetActive(false);
yield WaitForSeconds(delayTime);
box.SetActive(true);
}
//Delay();
}
public void Delay(){
yield WaitForSeconds(delayTime);
box.SetActive(true);
Live();
}
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询