本文整理汇总了C#中Level.GetComponent方法的典型用法代码示例。如果您正苦于以下问题:C# Level.GetComponent方法的具体用法?C# Level.GetComponent怎么用?C# Level.GetComponent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Level
的用法示例。
在下文中一共展示了Level.GetComponent方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnLevelChange
void OnLevelChange (Level level)
{
var scoreComp = level.GetComponent<ScoreCounter> ();
if (scoreComp != null)
scoreComp.OnScoreChange += OnScoreUpdate;
var goal = level.GetComponent<GoalController>();
if ( goal != null )
{
if ( goal.TotalWindows > 0 )
{
TotalWindows.text = goal.TotalWindows.ToString();
goal.OnWindowsChange += OnWindowsUpdate;
}
if (goal.TotalScore > 0)
{
TotalScore.text = goal.TotalScore.ToString();
}
OnWindowsUpdate(0);
OnScoreUpdate(0);
}
m_levelLabel.text = level.Number.ToString();
}
示例2: OpenLevelDialog
public void OpenLevelDialog(Level level)
{
if (level.IsActive && level.GetComponent<Toggle>().isOn)
{
_listOfViews[(int) ViewEnums.LevelDialog].SetActive(true);
GameObject child =
_listOfViews[(int) ViewEnums.LevelDialog].transform.FindChild("ResponsiveWindow(LevelDialog)")
.gameObject;
GameObject banner = child.transform.FindChild("Header").gameObject;
GameObject textObj = banner.transform.FindChild("Text").gameObject;
textObj.GetComponent<Text>().text = level.Name;
//To make level loadable
_selectedLevelDialog = level;
}
}
示例3: OnEnable
void OnEnable()
{
// Note that non static vars are uninitialized whenever the editor is deselected.
// That's why I've taken out "if(not init...)" because always null values when this function called. Will have to use static for undos etc later
_level = (Level)target;
_mesh = GetMesh();
_collider = _level.GetComponent<MeshCollider>();
_lastTool = Tools.current;
if(_level.faces == null) CalculateFaces(); // calc them faces if never been done before
InitTiles();
}