Esempio n. 1
0
 public RodModel(PlayerType _Player, RodType _Type, string rodTag, int _Column, RodPosition _Position = RodPosition.Middle)
 {
     Player           = _Player;
     Type             = _Type;
     Column           = _Column;
     Position         = _Position;
     PlayersPositions = new List <int> {
         0, 0, 0
     };
     UpdatePlayersPositions();
     View = GameObject.FindGameObjectWithTag(rodTag).GetComponent <RodView>();
 }
Esempio n. 2
0
 public void Kick(RodType Rod, DIRECTION KickDirection, int Power)
 {
     if (Rod == RodType.Defense)
     {
         DefenseAction           = ActionType.KICK;
         DefenseActionParameters = new List <int>(new int[] { Power, (int)KickDirection });
     }
     else
     {
         OffenceAction           = ActionType.KICK;
         OffenceActionParameters = new List <int>(new int[] { Power, (int)KickDirection });
     }
 }
Esempio n. 3
0
 public void NoAction(RodType Rod)
 {
     if (Rod == RodType.Defense)
     {
         DefenseAction           = ActionType.NO_ACTION;
         DefenseActionParameters = null;
     }
     else
     {
         OffenceAction           = ActionType.NO_ACTION;
         OffenceActionParameters = null;
     }
 }
Esempio n. 4
0
 public void MoveDown(RodType Rod)
 {
     if (Rod == RodType.Defense)
     {
         DefenseAction           = ActionType.MOVEROD;
         DefenseActionParameters = new List <int>(new int[] { (int)DIRECTION.RIGHT });
     }
     else
     {
         OffenceAction           = ActionType.MOVEROD;
         OffenceActionParameters = new List <int>(new int[] { (int)DIRECTION.RIGHT });
     }
 }
Esempio n. 5
0
    void Start()
    {
        switch (type)
        {
        case ItemChoice.bait:
            if (itemID >= 0 && itemID < FindObjectOfType <ItemDatabase>().baits.Count)
            {
                BaitType curB = FindObjectOfType <ItemDatabase>().baits[itemID];
                nameText.text  = curB.name;
                priceText.text = curB.price.ToString() + "g";
            }
            else
            {
                nameText.text  = "";
                priceText.text = "";
            }
            break;

        case ItemChoice.lure:
            if (itemID >= 0 && itemID < FindObjectOfType <ItemDatabase>().lures.Count)
            {
                LureType curL = FindObjectOfType <ItemDatabase>().lures[itemID];
                nameText.text  = curL.name;
                priceText.text = curL.price.ToString() + "g";
            }
            else
            {
                nameText.text  = "";
                priceText.text = "";
            }
            break;

        case ItemChoice.rod:
            if (itemID >= 0 && itemID < FindObjectOfType <ItemDatabase>().rods.Count)
            {
                RodType curR = FindObjectOfType <ItemDatabase>().rods[itemID];
                nameText.text  = curR.name;
                priceText.text = curR.price.ToString() + "g";
            }
            else
            {
                nameText.text  = "";
                priceText.text = "";
            }
            break;

        default:
            break;
        }
    }
Esempio n. 6
0
        /// <summary>
        /// Returns the maximum swing angle for the specified type of rod.
        /// </summary>
        private float GetSwingSweep(RodType rod)
        {
            switch (rod)
            {
            case RodType.Bronze: return(MathHelper.Pi / 3f);

            case RodType.Silver: return(MathHelper.Pi / 2f);

            case RodType.Gold: return(MathHelper.Pi / 1.4f);

            case RodType.Legendary: return(MathHelper.Pi / 1.25f);

            default: return(0f);
            }
        }
Esempio n. 7
0
    public void Buy(int amount)
    {
        int money = FindObjectOfType <Inventory>().money;

        switch (type)
        {
        case ItemChoice.bait:
            BaitType curB = FindObjectOfType <ItemDatabase>().baits[itemID];
            if ((curB.price * amount) < money)
            {
                FindObjectOfType <Shop>().BuyBait(curB, amount);
            }
            else
            {
                int maxAmount = Mathf.FloorToInt(money / curB.price);
                maxAmount = Mathf.Clamp(maxAmount, 0, amount);
                FindObjectOfType <Shop>().BuyBait(curB, maxAmount);
            }
            break;

        case ItemChoice.lure:
            LureType curL = FindObjectOfType <ItemDatabase>().lures[itemID];
            if ((curL.price * amount) < money)
            {
                FindObjectOfType <Shop>().BuyLure(curL, amount);
            }
            else
            {
                int maxAmount = Mathf.FloorToInt(money / curL.price);
                maxAmount = Mathf.Clamp(maxAmount, 0, amount);
                FindObjectOfType <Shop>().BuyLure(curL, maxAmount);
            }
            break;

        case ItemChoice.rod:
            RodType curR = FindObjectOfType <ItemDatabase>().rods[itemID];
            FindObjectOfType <Shop>().BuyRod(curR);
            break;

        default:
            break;
        }
    }
Esempio n. 8
0
        /// <summary>
        /// Loads the sprites necessary to display this state.
        /// </summary>
        public void LoadContent(ContentManager content)
        {
            RodSprites = new Dictionary <RodType, Sprite>();
            for (RodType rod = RodType.Bronze; rod <= RodType.Legendary; rod++)
            {
                Sprite rodSprite = content.Load <SpriteDescriptorTemplate>("Sprites/Fishing/Rod" + rod.ToString()).Create().Sprite;
                rodSprite.Position += _scene.PlayerPosition;
                RodSprites.Add(rod, rodSprite);
            }

            LureSprites = new Dictionary <Lure, Sprite>();
            for (int i = 0; i < FishingGirl.Gameplay.Lures.AllLures.Length; i++)
            {
                Lure   lure       = FishingGirl.Gameplay.Lures.AllLures[i];
                Sprite lureSprite = content.Load <SpriteDescriptorTemplate>("Sprites/Fishing/" + lure.SpriteName).Create().Sprite;
                LureSprites.Add(lure, lureSprite);
            }

            LineSprite = content.Load <SpriteDescriptorTemplate>("Sprites/Fishing/Line").Create().Sprite;

            // set up the lure now that we know what the rod looks like
            _lurePosition = GetRodTipPosition() + new Vector2(5f, 15f);
        }
Esempio n. 9
0
 public void BuyRod(RodType rod)
 {
     print(rod.ToString());
     FindObjectOfType <Inventory>().money -= rod.price;
 }
Esempio n. 10
0
 public CastDistanceBadge(RodType rod, float distance)
 {
     Rod      = rod;
     Distance = distance;
 }
Esempio n. 11
0
        /// <summary>
        /// 计算燃料棒稳态温度场
        /// </summary>
        /// <param name="Nj">轴向分段数</param>
        /// <param name="Nk">燃料棒数</param>
        /// <param name="coolent">冷却剂</param>
        /// <param name="channels">通道结合</param>
        /// <param name="rods">燃料棒集合</param>
        /// <param name="rodTypes">燃料棒类型集合</param>
        /// <param name="materials">材料集合</param>
        /// <param name="channelsFlow">已经得到的子通道稳态流体计算结果</param>
        /// <param name="gasGap">气体间隙模型对象</param>
        /// <param name="options">计算选项集合</param>
        /// <returns></returns>
        public List <RodTemperature> Caculate_Rods_Temperature_Steady(
            int Nj, int Nk,
            Fluid coolent,
            List <Channel> channels,
            List <Rod> rods,
            List <RodType> rodTypes,
            List <Material> materials,
            List <ChannelFlow> channelsFlow,
            GasGap gasGap,
            Options options)
        {
            Main.MsgCenter.ShowMessage("--------计算燃料棒温度场--------");
            //燃料棒温度集合 返回数据
            List <RodTemperature> RodsTemperature = new List <RodTemperature>();


            //包壳分段数
            var CladSegment = options.CladSegment;
            //芯块分段数
            var PelletSegment = options.PelletSegment;
            //功率因子
            var powerFactor = options.PowerFactor.Multiplier;
            //包壳功率份额
            var cladShare = options.PowerFactor.CladShare;
            //芯块功率份额
            var pelletShare = options.PowerFactor.PelletShare;
            //冷却剂中功率份额
            var fluidShare = options.PowerFactor.FluidShare;
            //计算结果准确度设置
            var acc = options.Precision;

            //燃料棒周围主流流体温度
            Matrix <double> Tf = Matrix <double> .Build.Dense(Nj, Nk, 0);

            //燃料棒周围主流流体对流换热系数
            Matrix <double> h = Matrix <double> .Build.Dense(Nj, Nk, 0);

            Matrix <double> massFlowDensity = Matrix <double> .Build.Dense(Nj, Nk, 0);

            //遍历所有燃料棒
            for (int k = 0; k < Nk; k++)
            {
                //新建一个用于存储一个燃料棒输出的对象
                RodTemperature RodkTemperature = new RodTemperature
                {
                    Index   = rods[k].Index,
                    SubRods = new List <SubRodTemperature>(),
                };
                //径向温度节点数
                int size = CladSegment + PelletSegment + 2;
                //燃料棒k的温度场 矩阵
                Matrix <double> RodTField = Matrix <double> .Build.Dense(Nj, size, 0);

                //是否找到燃料类型
                bool    isTypeFound = false;
                RodType rodType     = new RodType();
                //找到燃料棒k的燃料棒类型
                foreach (RodType type in rodTypes)
                {
                    if (type.Index == rods[k].Type)
                    {
                        rodType = type;
                        //找到了燃料棒类型
                        isTypeFound = true;
                        break;
                    }
                }
                //如果未找到燃料棒类型
                if (!isTypeFound)
                {
                    Main.MsgCenter.ShowMessage(String.Format("燃料棒{0}未找到匹配的{1}燃料棒类型", k, rods[k].Type));
                }
                //寻找燃料棒固体材料数据
                Material Clad   = new Material();
                Material Pellet = new Material();
                foreach (var material in materials)
                {
                    if (material.Index == rodType.CladMaterialIndex)
                    {
                        Clad = material;
                    }
                    else if (material.Index == rodType.PelletMaterialIndex)
                    {
                        Pellet = material;
                    }
                }
                //燃料棒直径
                double d_rod = rodType.Diameter;
                //燃料芯块直径
                double d_pellet = rodType.PelletDiameter;
                //燃料包壳厚度
                double clad_thickness = rodType.CladThickness;
                //气体间隙通过计算得出
                double gap_thickness = (d_rod - d_pellet) * 0.5 - clad_thickness;
                //分段计算燃料棒温度场
                for (int j = 0; j < Nj; j++)
                {
                    //分段长度
                    double Lj = rods[0].SubPowerCollection[j].To - rods[0].SubPowerCollection[j].From;
                    //接触的全部角度
                    double    TotalAngle = 0;
                    double    Xe         = 0;
                    FluidData FluidJ;
                    //遍历与[燃料棒k] 接触的 子通道,找到流体外部边界条件
                    foreach (ContactedChannel EachContactedChannel in rods[k].ContactedChannel)
                    {
                        //与燃料棒k接触的所有子通道流体物性参数计算结果
                        ChannelFlow ChannelFlowOfContactChannel = new ChannelFlow();
                        //找到与燃料棒接触的子通道计算结果
                        foreach (ChannelFlow channelFlow in channelsFlow)
                        {
                            //通道数据 index和连接的通道 index相同
                            if (channelFlow.ChannelIndex == EachContactedChannel.Index)
                            {
                                ChannelFlowOfContactChannel = channelFlow;
                            }
                        }
                        FluidJ    = ChannelFlowOfContactChannel.FluidDatas[j];
                        h[j, k]  += FluidJ.h * EachContactedChannel.Angle;
                        Tf[j, k] += FluidJ.Temperature * EachContactedChannel.Angle;
                        Xe        = FluidJ.Xe * EachContactedChannel.Angle;
                        //质量流密度
                        massFlowDensity[j, k] += FluidJ.Velocity * FluidJ.Density * EachContactedChannel.Angle;
                        //累加接触的角度份额
                        TotalAngle += EachContactedChannel.Angle;
                    }
                    //加权平均对流换热系数
                    h[j, k] = h[j, k] / TotalAngle;
                    //加权平均流体温度
                    Tf[j, k] = Tf[j, k] / TotalAngle;
                    //加权平均热平衡含气率
                    Xe = Xe / TotalAngle;
                    //加权平均质量流密度
                    massFlowDensity[j, k] = massFlowDensity[j, k] / TotalAngle;



                    //线性功率,单位W/M
                    double Linearpower = rods[k].SubPowerCollection[j].Value * powerFactor;
                    //体热源W/m3
                    double fi_pellet = Linearpower * pelletShare / (0.25 * PI * d_pellet * d_pellet);
                    //clad面积
                    double cladArea = 0.25 * PI * (d_rod * d_rod - (d_rod - 2 * clad_thickness) * (d_rod - 2 * clad_thickness));
                    //包壳 体热流密度
                    double fi_clad = Linearpower * cladShare / cladArea;
                    //包壳分段长度
                    double deltaR_clad = clad_thickness / CladSegment;
                    //芯块分段长度
                    double deltaR_pellet = d_pellet * 0.5 / PelletSegment;
                    //包壳外表面 - 热流密度
                    double q = Linearpower * (1 - fluidShare) / (PI * d_rod);
                    //包壳外表面 - 温度
                    double Tw = q / h[j, k] + Tf[j, k];
                    //内推温度场
                    RodTField[j, 0] = Tw;
                    //稳态,温度场由外向内内推
                    for (int layer = 0; layer < CladSegment; layer++)
                    {
                        //外径
                        double r_outside = 0.5 * d_rod - deltaR_clad * layer;
                        //内径
                        double r_inside = 0.5 * d_rod - deltaR_clad * (layer + 1);
                        //层平均半径
                        double r_av = (r_inside + r_outside) * 0.5;
                        //已经内推过的层面积
                        double layerArea = PI * (d_rod * d_rod * 0.25 - r_inside * r_inside);
                        //内推过的层发热线功率
                        double layerHeat = layerArea * fi_clad;
                        //层导热热阻ln(d2/d1)/2π lamd l   Clad.K.Get(vectorT[layer])
                        double R_layer = Math.Log(r_outside / r_inside) / (2 * PI * Clad.GetK(RodTField[j, layer]) * Lj);
                        //内推节点
                        RodTField[j, layer + 1] = (Linearpower - layerHeat) * Lj * R_layer + RodTField[j, layer];
                    }

                    //稳态下气体间隙传递的热流密度(导出热量等于芯块Pellet产热)
                    double q_gap = Linearpower * pelletShare / (PI * d_pellet);
                    //芯块外表面温度
                    RodTField[j, CladSegment + 1] = RodTField[j, CladSegment] + q_gap / gasGap.Get_h();
                    //计算燃料棒
                    for (int layer = 0; layer < PelletSegment; layer++)
                    {
                        //外径
                        double r_outside = 0.5 * d_pellet - deltaR_pellet * layer;
                        //内径
                        double r_inside = 0.5 * d_pellet - deltaR_pellet * (layer + 1);
                        //层平均半径
                        double r_av = (r_inside + r_outside) * 0.5;
                        //已经内推过的层面积
                        double layerArea = PI * (0.25 * d_pellet * d_pellet - r_inside * r_inside);
                        //层发热线功率
                        double layerHeat = layerArea * fi_pellet;
                        //层导热热阻ln(d2/d1)/2π*lamd*l   Clad.K.Get(vectorT[layer])
                        double R_layer = Math.Log(r_outside / r_inside) / (2 * PI * Clad.GetK(RodTField[j, layer]) * Lj);
                        RodTField[j, layer + CladSegment + 2] = (Linearpower * pelletShare - layerHeat) * Lj * R_layer + RodTField[j, layer + CladSegment + 1];
                    }
                    //芯块中心温度(根据有内热源传热方程)
                    RodTField[j, PelletSegment + CladSegment + 1] = RodTField[j, PelletSegment + CladSegment] + 0.25 * fi_pellet / Pellet.GetK(RodTField[j, PelletSegment + CladSegment]) * deltaR_pellet * deltaR_pellet;
                    //计算临界热流密度
                    double q_critical = Q_Critical(Xe, d_rod, massFlowDensity[j, k], coolent.GetHf(Tf[j, k]), coolent.GetH(Tf[j, k]), options.DNBR_Formula);
                    //设置输出对象(燃料棒k第j段)
                    SubRodTemperature subRodTemperature = new SubRodTemperature
                    {
                        Index = j,
                        //一些重要观测点温度
                        CladOutsideT   = Math.Round(RodTField[j, 0], acc.T),
                        CladInsideT    = Math.Round(RodTField[j, CladSegment], acc.T),
                        PelletOutsideT = Math.Round(RodTField[j, CladSegment + 1], acc.T),
                        PelletCenterT  = Math.Round(RodTField[j, PelletSegment + CladSegment + 1], acc.T),
                        //对流换热系数
                        h = Math.Round(h[j, k], acc.h),
                        //热流密度
                        Q = Math.Round(q, 1),
                        //临界热流密度
                        Qc = Math.Round(q_critical, 1),
                        //DNBR
                        DNBR = Math.Round(q_critical / q, 3),
                        //温度向量
                        TemperatureVector = RodTField.Row(j),
                    };

                    //加入计算结果集合
                    RodkTemperature.SubRods.Add(subRodTemperature);
                }//---结束轴向J循环
                RodsTemperature.Add(RodkTemperature);
                //输出消息提示
                Main.MsgCenter.ShowMessage(String.Format("燃料棒{0}:", rods[k].Index));
                Main.MsgCenter.ShowMessage(RodTField.ToMatrixString(Nj, PelletSegment + CladSegment + 2));
            }//结束燃料棒k循环

            return(RodsTemperature);
        }