当前位置: 首页>>代码示例>>C#>>正文


C# Tower.GetTopSection方法代码示例

本文整理汇总了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);
 }
开发者ID:austinblakeslee,项目名称:verthex,代码行数:48,代码来源:Builder.cs


注:本文中的Tower.GetTopSection方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。