static void ModBond(List <Character> characters, TraitsEnum roomTrait) { for (int i = 0; i < characters.Count; i++) { for (int j = i + 1; j < characters.Count; j++) { Character charA = characters[i]; Character charB = characters[j]; float distance = charA.Traits.GetTraitBias(roomTrait) - charB.Traits.GetTraitBias(roomTrait); distance = 25 - Mathf.Abs(distance); float biasMod = distance / 4; int result = Roll.Bias(5, 21, (int)biasMod - 55); charA.Relationships.ModifyBond(charB, result); charB.Relationships.ModifyBond(charA, result); Debug.Log("Bond for " + charA.Name + " and " + charB.Name + ": " + charA.Relationships.GetBond(charB) + " \\ " + charB.Relationships.GetBond(charA) + " | Distance:" + distance); } } }
public KVPTraitFloat(TraitsEnum trait, float value) { Trait = trait; Value = value; }
public void Unserialize(GMDataReader reader) { ModelName = reader.ReadStringPointerObject(); Name = reader.ReadStringPointerObject(); BuiltinName = reader.ReadInt32(); Traits = (TraitsEnum)reader.ReadInt32(); IsCreationTrack = reader.ReadWideBoolean(); int tagCount = reader.ReadInt32(); int ownedResourceCount = reader.ReadInt32(); int trackCount = reader.ReadInt32(); Tags = new List <int>(); for (int i = 0; i < tagCount; i++) { Tags.Add(reader.ReadInt32()); } OwnedResources = new List <GMSerializable>(); OwnedResourceTypes = new List <GMString>(); for (int i = 0; i < ownedResourceCount; i++) { GMString str = reader.ReadStringPointerObject(); OwnedResourceTypes.Add(str); switch (str.Content) { case "GMAnimCurve": GMAnimCurve curve = new GMAnimCurve(); curve.Unserialize(reader); OwnedResources.Add(curve); break; default: reader.Warnings.Add(new GMWarning($"Unknown owned resource type.")); break; } } Tracks = new List <Track>(); for (int i = 0; i < trackCount; i++) { Track track = new Track(); track.Unserialize(reader); Tracks.Add(track); } switch (ModelName.Content) { case "GMAudioTrack": { AudioKeyframes keyframes = new AudioKeyframes(); keyframes.Unserialize(reader); Keyframes = keyframes; } break; case "GMInstanceTrack": case "GMGraphicTrack": case "GMSequenceTrack": { IDKeyframes keyframes = new IDKeyframes(); keyframes.Unserialize(reader); Keyframes = keyframes; } break; case "GMSpriteFramesTrack": case "GMBoolTrack": { ValueKeyframes keyframes = new ValueKeyframes(); keyframes.Unserialize(reader); Keyframes = keyframes; } break; case "GMStringTrack": { StringValueKeyframes keyframes = new StringValueKeyframes(); keyframes.Unserialize(reader); Keyframes = keyframes; } break; case "GMColourTrack": case "GMRealTrack": { ValueInterpolatedKeyframes keyframes = new ValueInterpolatedKeyframes(); keyframes.Unserialize(reader); Keyframes = keyframes; } break; case "GMGroupTrack": break; default: throw new Exception(string.Format("Unknown sequence \"{0}\" model name.", ModelName.Content)); } }
public float GetTraitBias(TraitsEnum trait) { return(traitLeaning[trait]); }