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


C# Fish.getPrefab方法代码示例

本文整理汇总了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)
开发者ID:kurix2,项目名称:FishFishRevolution-PC,代码行数:67,代码来源:RodStatus.cs


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