本文整理汇总了C#中Tower.GetTopSection方法的典型用法代码示例。如果您正苦于以下问题:C# Tower.GetTopSection方法的具体用法?C# Tower.GetTopSection怎么用?C# Tower.GetTopSection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tower
的用法示例。
在下文中一共展示了Tower.GetTopSection方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: StartBuild
private void StartBuild(Player player, Tower t, SectionMaterial m, SectionWeapon w)
{
GameObject block = null;
GameObject weapon = null;
Section topOfTower = t.GetTopSection();
GameObject playerSpot = t.towerBase.towerPoint;
if(topOfTower == null) {
spawnPoint.transform.position = playerSpot.transform.position;
spawnPoint.transform.Translate(0,25,0);
} else {
Vector3 old = playerSpot.transform.position;
spawnPoint.transform.position = new Vector3(old.x, topOfTower.collider.bounds.max.y, old.z);
spawnPoint.transform.Translate(0,25,0);
}
block = Instantiate(m.GetPrefab(),spawnPoint.transform.position,Quaternion.identity) as GameObject;
if(player.playerNumber == 1)
{
block.transform.rotation = Quaternion.AngleAxis(90, Vector3.up);
}
else if(player.playerNumber ==2)
{
block.transform.rotation = Quaternion.AngleAxis(-90, Vector3.up);
}
block.transform.Find("FireCam").camera.enabled = false;
block.transform.Find("HitCam").camera.enabled = false;
block.transform.Find("CollapseCam").camera.enabled = false;
if (w.wtype != "Nothing"){
weapon = Instantiate(w.GetPrefab()) as GameObject; //I believe the here lies the issue for why building Nothing doesn't work? maybe.
if(player.playerNumber == 1)
{
weapon.transform.rotation = Quaternion.AngleAxis(90, Vector3.up);
}
else if(player.playerNumber ==2)
{
weapon.transform.rotation = Quaternion.AngleAxis(-90, Vector3.up);
}
//if(weapon != null) {
Vector3 localScale = weapon.transform.localScale;
weapon.transform.parent = block.transform;
weapon.transform.localPosition = block.transform.Find("WeaponLocation").localPosition;
weapon.transform.localScale = localScale;
}
Section sc = block.GetComponent<Section>();
SectionAttributes s = new SectionAttributes(m, w);
sc.attributes = s;
player.Build(sc, t);
TowerSelection.LocalSelectSection(t, sc.attributes.height);
}