Exemplo n.º 1
0
    /// <summary>
    /// パーツデータを魚のパラメータに変換
    /// </summary>
    public void InitData(FishData data)
    {
        int fixedPartsCount = 2;

        if (data.Body._id >= 0 && data.Eye._id >= 0)
        {
            Param = new CharaParam()
            {
                Height     = FishMasterData.GetBody(data.Body._id).Height,
                Attack     = FishMasterData.GetBody(data.Body._id).Attack + FishMasterData.GetEye(data.Eye._id).Attack,
                Weight     = FishMasterData.GetBody(data.Body._id).Weight,
                Aggressive = FishMasterData.GetEye(data.Eye._id).Aggressive,
                Hp         = 0,
                Speed      = 0,
                Agility    = 0
            };


            for (int i = 0; i < data.Fin.Count; i++)
            {
                Param.Weight += FishMasterData.GetFin(data.Fin[i]._id).Weight;
                Param.Height += FishMasterData.GetFin(data.Fin[i]._id).Height;
                Param.Sight  += FishMasterData.GetFin(data.Fin[i]._id).Sight;
                Param.Attack += FishMasterData.GetFin(data.Fin[i]._id).Attack;
            }
            ParamInit();


            InstantiateParts(0, FishMasterData.MaterialPath[PartsType.Body] + data.Body._id, data.Body._pos);
            InstantiateParts(1, FishMasterData.MaterialPath[PartsType.Eye] + data.Eye._id, data.Eye._pos);
            for (int i = 0; i < data.Fin.Count; i++)
            {
                InstantiateParts(i + fixedPartsCount, FishMasterData.MaterialPath[PartsType.Fin] + data.Fin[i]._id, data.Fin[i]._pos);
            }
        }
        else
        {
            DefaultParam();
            ParamInit();
            DefaultMaterial();
        }
        //dummy ---------------------------
        Param = new CharaParam()
        {
            Hp      = 1,
            Height  = 1,
            Attack  = 1,
            Weight  = 20,
            Speed   = 1,
            Agility = 20,
            Sight   = 1
        };
        //dummy ---------------------------
        Init();
        isInit = true;
    }
Exemplo n.º 2
0
 /// <summary>
 /// 初期値
 /// </summary>
 void DefaultParam()
 {
     Param = new CharaParam()
     {
         Hp      = 1,
         Height  = 1,
         Attack  = 1,
         Weight  = 1,
         Speed   = 1,
         Agility = 1,
         Sight   = 1
     };
 }