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


C# Box.GetComponent方法代码示例

本文整理汇总了C#中Box.GetComponent方法的典型用法代码示例。如果您正苦于以下问题:C# Box.GetComponent方法的具体用法?C# Box.GetComponent怎么用?C# Box.GetComponent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Box的用法示例。


在下文中一共展示了Box.GetComponent方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: PickUpBox

    void PickUpBox(Box box)
    {
        // make it so players can't fire while picking up a box
        playerController.DisableWeapons();

        pickedUpObject = box.gameObject;

        // rpc to disable the box
        box.GetComponent<PhotonView>().RPC("Disable", PhotonTargets.All, null);

        // rpc to set the boxes parent
        box.GetComponent<PhotonView>().RPC ("SetParent", PhotonTargets.All, playerController.GetComponent<PhotonView> ().viewID);
    }
开发者ID:remz99,项目名称:simplefps,代码行数:13,代码来源:ActionManager.cs

示例2: CreateLevel2Box

    /**
       * Create a level two box, ie two boxes next to each other
       */
    private void CreateLevel2Box(Box from, Box to, string direction)
    {
        // send rpc to master client to destroy the box
        to.GetComponent<PhotonView>().RPC("Explode", PhotonTargets.MasterClient, null);

        // set the build level to 2
        from.GetComponent<PhotonView>().RPC("BuildLevel", PhotonTargets.All, 2);

        if (direction == "sideways") {
          // ie left to right

          // increase the scale of the box
          from.transform.localScale += new Vector3(1f, 0f, 0f);

          // reposition the box
          from.transform.position += new Vector3(0.5f, 0f, 0f);
        } else {
          // front to back
          // increase the scale of the box
          from.transform.localScale += new Vector3(0f, 0f, 1f);

          // reposition the box
          from.transform.position += new Vector3(0.0f, 0f, 0.5f);
        }
    }
开发者ID:remz99,项目名称:simplefps,代码行数:28,代码来源:BuildingPad.cs

示例3: DisableBox

    /**
       * Disable the given box, this box has been placed and can be built from
       */
    private void DisableBox(Box box, Vector3 position)
    {
        box.GetComponent<PhotonView>().RPC("Disable", PhotonTargets.All, null);

        // WIP Ideally just do this in one request
        box.GetComponent<PhotonView>().RPC ("Buildable", PhotonTargets.All, true);
        box.GetComponent<PhotonView>().RPC ("TeamBase", PhotonTargets.All, teamBase.ID);

        box.transform.position = position;
        box.transform.rotation = Quaternion.identity;
    }
开发者ID:remz99,项目名称:simplefps,代码行数:14,代码来源:BuildingPad.cs

示例4: CreateLevel6Box

    /**
       * Create a level six box, 4x4
       */
    private void CreateLevel6Box(Box from, Box to)
    {
        // send rpc to master client to destroy the box
        to.GetComponent<PhotonView>().RPC("Explode", PhotonTargets.MasterClient, null);

        // set the build level to 6
        from.GetComponent<PhotonView>().RPC("BuildLevel", PhotonTargets.All, 6);

        // set the scale
        from.transform.localScale = new Vector3 (2f, 2f, 2f);

        // reposition the box
        from.transform.position = y0x0Position + new Vector3 (0.5f, 0.5f, 0.5f);
    }
开发者ID:remz99,项目名称:simplefps,代码行数:17,代码来源:BuildingPad.cs

示例5: CreateLevel4Box

    /**
       * Create a level 4 box, 2x2 horizontal
       */
    private void CreateLevel4Box(Box from, Box to, string level)
    {
        // send rpc to master client to destroy the box
        to.GetComponent<PhotonView>().RPC("Explode", PhotonTargets.MasterClient, null);

        // set the build leve to 4
        from.GetComponent<PhotonView>().RPC("BuildLevel", PhotonTargets.All, 4);

        // increase the scale of the box
        from.transform.localScale = new Vector3(2f, 1f, 2f);

        // reposition the box
        from.transform.position = y0x0Position + new Vector3(0.5f, 0f, 0.5f);

        if (level == "top") {
          from.transform.position += new Vector3(0f, 1f, 0f);
        }
    }
开发者ID:remz99,项目名称:simplefps,代码行数:21,代码来源:BuildingPad.cs

示例6: Createlevel3Box

    /**
       * Create a level 3 box, ie two boxes on top
       */
    private void Createlevel3Box(Box from, Box to)
    {
        // send rpc to master client to destroy the box
        to.GetComponent<PhotonView>().RPC("Explode", PhotonTargets.MasterClient, null);

        // set the build level to 3
        from.GetComponent<PhotonView>().RPC("BuildLevel", PhotonTargets.All, 3);

        // increase the scale of the box
        from.transform.localScale += new Vector3(0f, 1f, 0f);

        // reposition the box
        from.transform.position += new Vector3(0f, 0.5f, 0f);
    }
开发者ID:remz99,项目名称:simplefps,代码行数:17,代码来源:BuildingPad.cs


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