public static void SetWolfState(AlphaStateMachine wolfInfo) { if (SaveInformation.WolfInfoList == null) { SaveInformation.WolfInfoList = new List <WolvesData>(); } WolvesData wolfData = new WolvesData() { Id = wolfInfo.name, Position = new float[3] }; wolfData.Position[0] = wolfInfo.transform.position.x; wolfData.Position[1] = wolfInfo.transform.position.y; wolfData.Position[2] = wolfInfo.transform.position.z; SaveInformation.WolfInfoList.RemoveAll(t => t.Id == wolfData.Id); SaveInformation.WolfInfoList.Add(wolfData); }
public static WolvesData GetWolfState(AlphaStateMachine wolf) { WolvesData wolfData = new WolvesData() { Id = null }; if (SaveInformation.WolfInfoList == null) { return(wolfData); } if (SaveInformation.WolfInfoList.Any(t => t.Id == wolf.name)) { return(SaveInformation.WolfInfoList.FirstOrDefault(t => t.Id == wolf.name)); } return(wolfData); }