public override void OnStartServer() { ResetBodyParts(); if (maxHealth <= 0) { Logger.LogWarning($"Max health ({maxHealth}) set to zero/below zero!", Category.Health); maxHealth = 1; } OverallHealth = maxHealth; //Generate BloodType and DNA DNABloodType = new DNAandBloodType(); DNABloodTypeJSON = JsonUtility.ToJson(DNABloodType); bloodSystem.SetBloodType(DNABloodType); base.OnStartServer(); }
//Initial setting for blood type. Server only public void SetBloodType(DNAandBloodType dnaBloodType) { bloodType = dnaBloodType; bloodSplatColor = dnaBloodType.BloodColor; }
// This is the DNA SyncVar hook private void DNASync(string updatedDNA) { DNABloodTypeJSON = updatedDNA; DNABloodType = JsonUtility.FromJson <DNAandBloodType>(updatedDNA); }
//Initial setting for blood type. Server only public void SetBloodType(DNAandBloodType dnaBloodType) { bloodType = dnaBloodType; }
private void SyncDNABloodTypeJSON(string oldDNABloodTypeJSON, string newDNABloodTypeJSON) { DNABloodTypeJSONSync = newDNABloodTypeJSON; DNABloodType = JsonUtility.FromJson <DNAandBloodType>(newDNABloodTypeJSON); }
public void SetDNA(DNAandBloodType newDNA) { DNABloodTypeJSONSync = JsonUtility.ToJson(newDNA); DNABloodType = newDNA; }