コード例 #1
0
    //public Transform tmpTsEmitFishPot;
    IEnumerator _Coro_FishQueueGenerating()
    {
        WeightTotal_QueuGenerate = 0;
        foreach (FishQueueGenerateData d in FishQueueData)
        {
            WeightTotal_QueuGenerate += d.Weight;
            d.HittedWeight            = WeightTotal_QueuGenerate;
        }
        while (true)
        {
            if (GameMain.Singleton.NumFishAlive >= MaxFishAtWorld)
            {
                goto TAG_NextGenerateWait;
            }

            //随机
            int curWeight = Random.Range(0, WeightTotal_QueuGenerate);
            int queueIdx  = 0;
            for (; queueIdx != FishQueueData.Length; ++queueIdx)
            {
                if (curWeight < FishQueueData[queueIdx].HittedWeight)
                {
                    break;
                }
            }
            if (queueIdx >= FishQueueData.Length)
            {
                goto TAG_NextGenerateWait;
            }

            FishEmitter_Queue fg = Instantiate(FishQueueData[queueIdx].Prefab_Queue) as FishEmitter_Queue;
            Vector2           interectPot;
            Vector2           rndPos = Random.onUnitSphere;
            rndPos.Normalize();
            if (InterectWorldRectWithOriginRay(rndPos, out interectPot))
            {
                Vector3 posInstance = interectPot + rndPos * (fg.Prefab_Fish.swimmer.BoundCircleRadius);
                fg.transform.parent        = transform;
                fg.transform.localPosition = posInstance;
                //fg.transform.right = -rndPos /*+ ((Vector2)Random.onUnitSphere).normalized * 0.5F*/;
                fg.transform.rotation = PubFunc.RightToRotation(-rndPos);
                fg.Generate();
            }

TAG_NextGenerateWait:
            yield return(new WaitForSeconds(Interval_QueuGenerate.Value));
        }
    }
コード例 #2
0
 static void Menu_TranSwimPropertyScal384()
 {
     foreach (GameObject go in Selection.gameObjects)
     {
         Swimmer s = go.GetComponent <Swimmer>();
         if (s != null)
         {
             s.Speed             *= 384F;
             s.BoundCircleRadius *= 384F;
         }
         FishEmitter_Queue fq = go.GetComponent <FishEmitter_Queue>();
         if (fq != null)
         {
             fq.Distance   *= 384F;
             fq.Fish_Speed *= 384F;
         }
         EditorUtility.SetDirty(go);
     }
 }