Unity3D 体感游戏物体下落脚本
Posted on 2013 年 07 月 10 日 by U3d / Unity3D 脚本/插件 /被围观 26 次
这段代码是下落的位置,下落的游戏物体,还定义了 ScoreHit()得分。主要解决
下落问题,此脚本具有通用性。
using System.Collections.Generic;
public class BallCreator : MonoBehaviour
// the ball prefab. @note MUST be attached
public GameObject prefab;
// the object we create the balls near @note MUST be attached.
// holds the player mapper (used to find out if we have a target
player).
public NIPlayerManager m_playerManager;
// the time to create the next ball
//private float m_timeToCreateNextBall;
public float m_timeToCreateNextBall;
// The number of balls the user hit (used for scoring)
private int m_numBallsHit = 0;
// The number of balls created (used for scoring)
// private int m_numBallsCreated;
public int m_numBallsCreated;
// Marks that the user has scored a hit (used for scoring).
// mono-behavior initialization
m_timeToCreateNextBall = 0;
if(m_playerManager==null)
m_playerManager =
FindObjectOfType(typeof(NIPlayerManager)) as NIPlayerManager;
//Unity3D
教程手册:
www.unitymanual.com
评论0
最新资源