Ejemplo n.º 1
0
        private FloatParameters Read_FloatParameters(BinaryReader reader)
        {
            var result = new FloatParameters();

            result.Version = ReadVersion(reader, 1, 0x141223920);
            result.Name    = ReadString(reader);
            result.Value   = reader.ReadSingle();

            return(result);
        }
Ejemplo n.º 2
0
        public override int GetHashCode()
        {
            int hash = 1;

            hash ^= FloatParameters.GetHashCode();
            if (customResetParameters_ != null)
            {
                hash ^= CustomResetParameters.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
Ejemplo n.º 3
0
 public bool Equals(EnvironmentParametersProto other)
 {
     if (ReferenceEquals(other, null))
     {
         return(false);
     }
     if (ReferenceEquals(other, this))
     {
         return(true);
     }
     if (!FloatParameters.Equals(other.FloatParameters))
     {
         return(false);
     }
     if (!object.Equals(CustomResetParameters, other.CustomResetParameters))
     {
         return(false);
     }
     return(Equals(_unknownFields, other._unknownFields));
 }
Ejemplo n.º 4
0
    public void AddRailPoint(ref string[] xml, ref int xml_index, bool isVrail)
    {
        Vector3 translate = transform.position;
        Vector3 rotation  = UnityEditor.TransformUtils.GetInspectorRotation(this.transform);

        //Setup our always used values
        IntParameters    check_point_index = new IntParameters("CheckPointIndex", checkPointIndex);
        StringParameters obj_id            = new StringParameters("Id", id);
        BoolParameters   link_dest         = new BoolParameters("IsLinkDest", isLinkDest);
        StringParameters layer             = new StringParameters("LayerConfigName", layerConfigName);
        FloatParameters  offset_x          = new FloatParameters("OffsetX", offsetX);
        FloatParameters  offset_y          = new FloatParameters("OffsetY", offsetY);
        FloatParameters  offset_z          = new FloatParameters("OffsetZ", offsetZ);
        StringParameters unit_config_name  = new StringParameters("UnitConfigName", unitConfigName);
        BoolParameters   use_offset        = new BoolParameters("UseOffset", useOffset);

        Vector3 control_one = GetControlPoint1();

        control_one.x = -control_one.x;
        Vector3 control_two = GetControlPoint2();

        control_two.x = -control_two.x;
        Vector3Parameters control_point1 = new Vector3Parameters("", control_one);
        Vector3Parameters control_point2 = new Vector3Parameters("", control_two);


        //Vrail stuff
        IntParameters  check_point_hp = new IntParameters("CheckPointHP", checkPointHp);
        IntParameters  slope_fill_up  = new IntParameters("SlopeFillUp", slopeFillUp);
        BoolParameters use_rotate_dir = new BoolParameters("UseRotateDir", useRotateDir);

        //Common
        if (isVrail)
        {
            xml[xml_index++] = four_white_space + header + check_point_hp.param_name + ": " + check_point_hp.value;
            xml[xml_index++] = ObjFactory(check_point_index);
        }
        else
        {
            xml[xml_index++] = four_white_space + header + check_point_index.param_name + ": " + check_point_index.value;
        }

        xml[xml_index++] = six_white_space + four_white_space + "ControlPoints:";
        xml[xml_index++] = four_white_space + four_white_space + header + control_point1.value;
        xml[xml_index++] = four_white_space + four_white_space + header + control_point2.value;

        xml[xml_index++] = ObjFactory(obj_id);
        xml[xml_index++] = ObjFactory(link_dest);
        xml[xml_index++] = ObjFactory(layer);
        xml[xml_index++] = four_white_space + six_white_space + "Links: {}";
        //Likely not required, but it exists on all objects in the final game
        if (isVrail)
        {
            xml[xml_index++] = four_white_space + six_white_space + "ModelName: RailPoint";
        }
        else
        {
            xml[xml_index++] = four_white_space + six_white_space + "ModelName:";
        }

        xml[xml_index++] = ObjFactory(offset_x);
        xml[xml_index++] = ObjFactory(offset_y);
        xml[xml_index++] = ObjFactory(offset_z);

        //Add rotate, transform, and scale
        xml[xml_index++] = ObjFactory(new Vector3Parameters("Rotate", rotation));
        xml[xml_index++] = ObjFactory(new Vector3Parameters("Scale", transform.localScale));
        if (isVrail)
        {
            xml[xml_index++] = ObjFactory(slope_fill_up);
        }
        translate.x      = -translate.x;
        xml[xml_index++] = ObjFactory(new Vector3Parameters("Translate", translate));

        xml[xml_index++] = ObjFactory(unit_config_name);
        xml[xml_index++] = ObjFactory(use_offset);
        if (isVrail)
        {
            xml[xml_index++] = ObjFactory(use_rotate_dir);
        }
    }
Ejemplo n.º 5
0
    string ObjFactory(FloatParameters inject)
    {
        string parameter = four_white_space + six_white_space + inject.param_name + ": " + inject.value;

        return(parameter);
    }
Ejemplo n.º 6
0
 /// <summary>
 /// Try to retrieve a float from parameters, return the default value if the parameter isn't present
 /// </summary>
 /// <param name="parameterName">name of the parameter</param>
 /// <param name="defaultValue">the value returned if the parameter isn't present</param>
 /// <returns>the parameter if present, the default value otherwise</returns>
 public float GetFloat(string parameterName, float defaultValue = 0)
 {
     return(FloatParameters.ContainsKey(parameterName) ? FloatParameters[parameterName] : defaultValue);
 }