本文整理汇总了C#中GameStateManager.EnsureGameScriptsAdded方法的典型用法代码示例。如果您正苦于以下问题:C# GameStateManager.EnsureGameScriptsAdded方法的具体用法?C# GameStateManager.EnsureGameScriptsAdded怎么用?C# GameStateManager.EnsureGameScriptsAdded使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GameStateManager
的用法示例。
在下文中一共展示了GameStateManager.EnsureGameScriptsAdded方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Start
// Use this for initialization
void Start()
{
GameObject mainObject = GameObject.FindGameObjectsWithTag("MainObject")[0];
if (GameObject.FindGameObjectsWithTag("MainObject").Length > 1)
{
GameObject[] mainObjectList = GameObject.FindGameObjectsWithTag("MainObject");
for (int i = 0; i < mainObjectList.Length; ++i)
{
if (mainObjectList[i].GetComponent<GameStateManager>().objectSaved)
mainObject = mainObjectList[i];
}
}
// Ensures all necessary scripts are added for the MainObject
gameStateManagerRef = mainObject.GetComponent<GameStateManager>();
gameStateManagerRef.EnsureGameScriptsAdded();
worldCollisionRef = gameStateManagerRef.GetWorldCollision();
}
示例2: Start
// Use this for initialization
void Start()
{
GameObject mainObject = GameObject.FindGameObjectsWithTag("MainObject")[0];
if (GameObject.FindGameObjectsWithTag("MainObject").Length > 1)
{
GameObject[] mainObjectList = GameObject.FindGameObjectsWithTag("MainObject");
for (int i = 0; i < mainObjectList.Length; ++i)
{
if (mainObjectList[i].GetComponent<GameStateManager>().objectSaved)
mainObject = mainObjectList[i];
}
}
// Ensures all necessary scripts are added for the MainObject
gameStateManagerRef = mainObject.GetComponent<GameStateManager>();
gameStateManagerRef.EnsureGameScriptsAdded();
worldCollisionRef = gameStateManagerRef.GetWorldCollision();
playerRef = GameObject.FindGameObjectWithTag("Player").GetComponent<TWCharacterController>();
//Init local reference - J.C.
TearManagerLocalRef = GameObject.FindGameObjectWithTag("TearManager").GetComponent<TearManager>();
}
示例3: Start
// Use this for initialization.
public void Start()
{
// Keeping GameObject component grabbing consistent among classes. - J.T.
GameObject mainObject = GameObject.FindGameObjectsWithTag("MainObject")[0];
if(GameObject.FindGameObjectsWithTag("MainObject").Length > 1){
GameObject[] mainObjectList = GameObject.FindGameObjectsWithTag("MainObject");
for(int i = 0; i < mainObjectList.Length; ++i){
if(mainObjectList[i].GetComponent<GameStateManager>().objectSaved){
mainObject = mainObjectList[i];
}
}
}
gameStateManagerRef = mainObject.GetComponent <GameStateManager>();
gameStateManagerRef.EnsureGameScriptsAdded();
gameStateManagerRef.EnsureCoreScriptsAdded();
screenManagerRef = mainObject.GetComponent<ScreenManager>();
animManagerRef = mainObject.GetComponent<AnimationManager>();
worldCollisionRef = mainObject.GetComponent<WorldCollision>();
touchController = gameObject.GetComponent<TouchController>();
soundManagerRef = gameStateManagerRef.GetSoundManager();
paperObject = GameObject.FindGameObjectWithTag("background");
tearBorder = GameObject.FindGameObjectWithTag("DeadSpace");
foldBorder = GameObject.FindGameObjectWithTag("foldborder");
unfoldBorder = GameObject.FindGameObjectWithTag("unfoldborder");
unfoldBlocker = GameObject.FindGameObjectWithTag("RayTraceBlocker");
moveBorder = GameObject.FindGameObjectWithTag("insideBorder");
menuButton = GameObject.Find("MenuButton_Prefab");
restartButton = GameObject.Find("RestartButton_Prefab");
moveMode = true;
tearMode = false;
foldMode = false;
//Keeping old code here in case something gets broken. - J.T.
// Ensures all necessary scripts are added for the MainObject.
/*
gameStateManagerRef = gameObject.GetComponent<GameStateManager>();
gameStateManagerRef.EnsureCoreScriptsAdded();
gameStateManagerRef.EnsureGameScriptsAdded();
screenManagerRef = gameObject.GetComponent<ScreenManager>();
animManagerRef = gameObject.GetComponent<AnimationManager>();
worldCollisionRef = gameObject.GetComponent<WorldCollision>();
touchController = gameObject.GetComponent<TouchController>();
*/
idleTriggerLimit = Random.Range (1000, 3000);
keyDownWatch = new Stopwatch();
idleKeyWatch = new Stopwatch();
releaseWatch = new Stopwatch();
justPressedWatch = new Stopwatch();
playerBottomCollisionWatch = new Stopwatch();
idlePlayerWatch = new Stopwatch();
watchList.Add(keyDownWatch);
watchList.Add(idleKeyWatch);
watchList.Add(releaseWatch);
watchList.Add(justPressedWatch);
watchList.Add(playerBottomCollisionWatch);
watchList.Add(idlePlayerWatch);
wasdRight = KeyCode.D;
wasdLeft = KeyCode.A;
arrowRight = KeyCode.RightArrow;
arrowLeft = KeyCode.LeftArrow;
keyJump = KeyCode.Space;
hasHorizontalCollision = false;
currentDirection = ScreenSide.NONE;
tornPieceInitiated = false;
movingTornPiece = false;
}