public static void WriteJson(this Game.RocketInstance self, JsonTextWriter writer) { writer.WriteStartObject(); if (self.config == null) { writer.WritePropertyName("config"); writer.WriteNull(); } else { writer.WritePropertyName("config"); self.config.WriteJson(writer); } writer.WritePropertyName("position"); self.position.WriteJson(writer); writer.WritePropertyName("speed"); self.speed.WriteJson(writer); writer.WritePropertyName("invulTime"); writer.WriteValue(self.invulTime); writer.WritePropertyName("lifeTime"); writer.WriteValue(self.lifeTime); writer.WritePropertyName("parentId"); writer.WriteValue(self.parentId); writer.WriteEndObject(); }
public static void ReadFromJson(this Game.RocketInstance self, JsonTextReader reader) { while (reader.Read()) { if (reader.TokenType == JsonToken.PropertyName) { var name = (string)reader.Value; reader.Read(); switch (name) { case "config": if (reader.TokenType == JsonToken.Null) { self.config = null; } else { if (self.config == null) { self.config = new Game.RocketConfig(); } self.config.ReadFromJson(reader); } break; case "position": self.position = (UnityEngine.Vector2)reader.ReadFromJsonUnityEngine_Vector2(); break; case "speed": self.speed = (UnityEngine.Vector2)reader.ReadFromJsonUnityEngine_Vector2(); break; case "invulTime": self.invulTime = (System.Single)(double) reader.Value; break; case "lifeTime": self.lifeTime = (System.Single)(double) reader.Value; break; case "parentId": self.parentId = (int)(Int64)reader.Value; break; } } else if (reader.TokenType == JsonToken.EndObject) { break; } } }
public static void ReadFromJson(this ZergRush.ReactiveCore.ReactiveCollection <Game.RocketInstance> self, JsonTextReader reader) { if (reader.TokenType != JsonToken.StartArray) { throw new JsonSerializationException("Bad Json Format"); } while (reader.Read()) { if (reader.TokenType == JsonToken.EndArray) { break; } Game.RocketInstance val = default; val = new Game.RocketInstance(); val.ReadFromJson(reader); self.Add(val); } }
public void Show(RocketInstance rocket) { this.rocket = rocket; this.transform.localScale = Vector3.one * 0.1f; }