本文整理汇总了C#中Fish.getPrefab方法的典型用法代码示例。如果您正苦于以下问题:C# Fish.getPrefab方法的具体用法?C# Fish.getPrefab怎么用?C# Fish.getPrefab使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Fish
的用法示例。
在下文中一共展示了Fish.getPrefab方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Update
//.........这里部分代码省略.........
linePower += step*10;
if (linePower >= 0.9f)
linePower-=0.9f;
if (rodPullFactor >= 0.1f)
rodPullFactor -= 0.1f;
// Fish hooked
if (catchSwitch)
{
if (randomTrigger == 1)
{
randomDir = Random.Range(-90.0f, 90.0f);
}
if (!fishAttached)
{
Debug.Log("Caught a random fish");
fishAttached = true;
Gauge.fishGauge.enabled = true;
hookedFish = fishManager.GetComponent<FishManager>().hookFish();
hookedFish.setDistance(boatDistance);
hookHinge = Instantiate(Resources.Load("Prefabs/CharacterHook"), rb.position, Quaternion.identity) as GameObject;
//hookHinge = Instantiate(Resources.Load("Prefabs/HookHinges3"), rb.position, Quaternion.identity) as GameObject;
//GameObject Connecter = GameObject.Find("HookJoint");
//HingeJoint hj = Connecter.GetComponent<HingeJoint>();
//hj.connectedBody = rb;
string fishPrefab = hookedFish.getPrefab();
fish = Instantiate(Resources.Load("Prefabs/Fish/" + fishPrefab), new Vector3(rb.position.x,rb.position.y-0.1f,rb.position.z), Quaternion.identity) as GameObject;
//fish = Instantiate(Resources.Load("Prefabs/Fish/" + fishPrefab), rb.position, Quaternion.identity) as GameObject;
// GameObject hookJointGO = GameObject.Find("FishJoint");
// HingeJoint fishJoint = fish.GetComponent<HingeJoint>();
GameObject hookOfHook = GameObject.Find("CharacterHookHook");
hookOfHook.GetComponent<CharacterJoint>().connectedBody = fish.GetComponent<Rigidbody>();
hookHinge.transform.parent = rb.transform;
//hookHinge = fish.GetComponent<Rigidbody>();
rb.useGravity = false;
swimSpeed = hookedFish.getSpeed();
}
}
randomTrigger = Random.Range(0, 50);
Quaternion rotation2 = Quaternion.LookRotation(rb.position - rodEnd.transform.position);
Quaternion rotation3 = Quaternion.Euler(rotation2.x, rotation2.y + randomDir, rotation2.z);
rb.rotation = rotation3;
Vector3 towardsRod = Vector3.MoveTowards(rb.position, rodEnd.transform.position, step);
Vector3 swimVec = -rb.transform.forward * (swimSpeed * Time.deltaTime);
Vector3 newPos = towardsRod - swimVec;
rb.position = newPos;
rodPullFactor = 0;
if (bobber.GetComponent<Bobber>().reelMeUp == true || Vector3.Distance(bobber.transform.position,boatPos) < 6.0f)