本文整理汇总了C#中PlayerManager.getSelectedWepDrain方法的典型用法代码示例。如果您正苦于以下问题:C# PlayerManager.getSelectedWepDrain方法的具体用法?C# PlayerManager.getSelectedWepDrain怎么用?C# PlayerManager.getSelectedWepDrain使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PlayerManager
的用法示例。
在下文中一共展示了PlayerManager.getSelectedWepDrain方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Update
void Update()
{
if (universeN() != -1) {
manager = GameObject.Find("Character" + universeN()).GetComponent<PlayerManager>();
timer += Time.deltaTime;
if (Network.isClient && myCharacter) {
if (model == "china") spawnPosition = Random.value > 0.5 ? lSpawn.position : rSpawn.position;
else spawnPosition = spawn.position;
Camera cam = GameObject.Find("Camera " + universeN()).camera;
Vector3 lookAt, dir;
RaycastHit hit;
Ray ray;
if (rotated) {
ray = cam.ScreenPointToRay(Input.mousePosition);
ray.origin = spawnPosition;
if (Physics.Raycast(ray, out hit, 1000)) lookAt = hit.point;
else lookAt = ray.GetPoint(100);
dir = ray.direction;
}
else {
Vector3 mousePos = Input.mousePosition;
mousePos.z = spawnPosition.z;
ray = new Ray(cam.ScreenToWorldPoint(mousePos), Vector3.right);
Debug.DrawRay(ray.origin, ray.direction * 100, Color.red);
if (Physics.Raycast(ray, out hit, 100)) lookAt = hit.point;
else lookAt = ray.origin;
dir = lookAt - spawnPosition;
}
beam.SetPosition(1, lookAt);
beam.SetPosition(0, spawnPosition);
if (Input.GetButton("Primary Fire") && timer >= manager.wepStats.wepRate && manager.getEnergyLevel() != 0) {
// Can I fire?
if (manager.getEnergyLevel() - manager.getSelectedWepDrain() >= 0) {
int wType = manager.wepType;
string wDir = "";
switch(wType)
{
case 1: wDir = "beam/beam2";
break;
case 2: wDir = "cannon/cannon";
break;
case 3: wDir = "mine/mine";
break;
default: wDir = "beam/beam2";
break;
}
networkView.RPC("PlayNetworkShot", RPCMode.All, wDir, manager.universeNumber);
// Send message to fire
if (dir.x > 0) networkView.RPC("fireWeapon", RPCMode.Server, lookAt, dir, spawnPosition, manager.wepStats.wepType);
timer = 0;
// Tell AchievementSystem
//AchievementSystem.playerFired();
}
}
}
}
}