本文整理汇总了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);
}
示例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);
}
}
示例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;
}
示例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);
}
示例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);
}
}
示例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);
}