public override Dictionary <string, object> Load(bool destroyUnloaded = false) { var dataDictionary = base.Load(destroyUnloaded); SenseRange = DataPersitanceHelpers.GetValueFromDictionary <float>(ref dataDictionary, "SenseRange"); AngleOfVision = DataPersitanceHelpers.GetValueFromDictionary <float>(ref dataDictionary, "AngleOfVision"); WalkDistance = DataPersitanceHelpers.GetValueFromDictionary <float>(ref dataDictionary, "WalkDistance"); AttackDistance = DataPersitanceHelpers.GetValueFromDictionary <float>(ref dataDictionary, "AttackDistance"); CurrentPatrolPoint = DataPersitanceHelpers.GetValueFromDictionary <int>(ref dataDictionary, "CurrentPatrolPoint"); NextPatrolPoint = DataPersitanceHelpers.GetValueFromDictionary <int>(ref dataDictionary, "NextPatrolPoint"); currentDestination = DataPersitanceHelpers.GetValueFromDictionary <Vector3?>(ref dataDictionary, "currentDestination"); //reset states (should really save the state stack instead) if (stackOfStates) { stackOfStates.Clear(); if (PotentialStates.Length > 0) { State patrol = PotentialStates.FirstOrDefault(x => x.StateName == StateNames.PatrolState); State idle = PotentialStates.FirstOrDefault(x => x.StateName == StateNames.IdleState); if (patrol) { stackOfStates.PushState(patrol); } else if (idle) { stackOfStates.PushState(idle); } } } return(dataDictionary); }
public Dictionary <string, object> Load(bool destroyUnloaded = false) { //create new dictionary to contain data for characterbase Dictionary <string, object> dataDictionary = new Dictionary <string, object>(); if (!uuid) { return(dataDictionary); } //load dictionary DataPersitanceHelpers.LoadDictionary(ref dataDictionary, uuid.ID); IsInteractable = DataPersitanceHelpers.GetValueFromDictionary <bool>(ref dataDictionary, "IsInteractable"); Toggle = DataPersitanceHelpers.GetValueFromDictionary <bool>(ref dataDictionary, "Toggle"); triggered = DataPersitanceHelpers.GetValueFromDictionary <bool>(ref dataDictionary, "triggered"); if (TriggerAnimator != null) { TriggerAnimator.SetBool(OnTriggerAnimation, triggered); } //OnTrigger?.Invoke(triggered, this); return(dataDictionary); }
public virtual Dictionary <string, object> Load(bool destroyUnloaded = false) { //create new dictionary to contain data for characterbase Dictionary <string, object> dataDictionary = new Dictionary <string, object>(); if (!uuid) { return(dataDictionary); } //load dictionary DataPersitanceHelpers.LoadDictionary(ref dataDictionary, uuid.ID); Dictionary <string, int> itemPaths; itemPaths = DataPersitanceHelpers.GetValueFromDictionary <Dictionary <string, int> >(ref dataDictionary, "items"); //Remove all items; RemoveAll(); //add loaded items foreach (var itemPath in itemPaths) { //load asset var item = Resources.Load <Item>(itemPath.Key); for (int i = 0; i < itemPath.Value; i++) { AddItem(item as Item, false); } } return(dataDictionary); }
public override Dictionary <string, object> Load(bool disableUnloaded = false) { var dataDictionary = base.Load(disableUnloaded); playerVelocity = DataPersitanceHelpers.GetValueFromDictionary <Vector3>(ref dataDictionary, "velocity"); onGround = DataPersitanceHelpers.GetValueFromDictionary <bool>(ref dataDictionary, "onGround"); isCrouching = DataPersitanceHelpers.GetValueFromDictionary <bool>(ref dataDictionary, "isCrouching"); return(dataDictionary); }
public override Dictionary <string, object> Load(bool destroyUnloaded = false) { Dictionary <string, object> dataDictionary = base.Load(destroyUnloaded); //remove current slots for (int i = 0; i < leftHand.Length; i++) { leftHand[i].RemoveItem(); } for (int i = 0; i < rightHand.Length; i++) { rightHand[i].RemoveItem(); } //save left hand Dictionary <int, string> leftHandPaths = DataPersitanceHelpers .GetValueFromDictionary <Dictionary <int, string> >(ref dataDictionary, "leftHand"); for (int i = 0; i < leftHand.Length; i++) { if (leftHandPaths != null && leftHandPaths.ContainsKey(i)) { var ability = Resources.Load <Item>(leftHandPaths[i]); //To improve this we can equip the ability in the slot it was saved in if (ability) { var invItem = AddItem(ability, false); invItem.LeftClick(this, character); } ; } } //save right hand Dictionary <int, string> rightHandPaths = DataPersitanceHelpers .GetValueFromDictionary <Dictionary <int, string> >(ref dataDictionary, "rightHand"); for (int i = 0; i < rightHand.Length; i++) { if (rightHandPaths != null && rightHandPaths.ContainsKey(i)) { var ability = Resources.Load <Item>(rightHandPaths[i]); //To improve this we can equip the ability in the slot it was saved in if (ability) { var invItem = AddItem(ability, false); invItem.RightClick(this, character); } ; } } return(dataDictionary); }
public Dictionary <string, object> Load(bool destroyUnloaded = false) { //create new dictionary to contain data for characterbase Dictionary <string, object> dataDictionary = new Dictionary <string, object>(); if (!uuid) { return(dataDictionary); } //load dictionary DataPersitanceHelpers.LoadDictionary(ref dataDictionary, uuid.ID); AlertMeter = DataPersitanceHelpers.GetValueFromDictionary <int>(ref dataDictionary, "AlertMeter"); return(dataDictionary); }
public Dictionary <string, object> Load(bool destroyUnloaded = false) { //create new dictionary to contain data for characterbase Dictionary <string, object> dataDictionary = new Dictionary <string, object>(); if (!uuid) { return(dataDictionary); } //load dictionary DataPersitanceHelpers.LoadDictionary(ref dataDictionary, uuid.ID); TriggeredPositionOffset = DataPersitanceHelpers.GetValueFromDictionary <Vector3>(ref dataDictionary, "TriggeredPositionOffset"); targetPosition = DataPersitanceHelpers.GetValueFromDictionary <Vector3>(ref dataDictionary, "targetPosition"); return(dataDictionary); }
public Dictionary <string, object> Load(bool destroyUnloaded = false) { //create new dictionary to contain data for characterbase Dictionary <string, object> dataDictionary = new Dictionary <string, object>(); if (!uuid) { return(dataDictionary); } //load dictionary DataPersitanceHelpers.LoadDictionary(ref dataDictionary, uuid.ID); TargetPortalIndex = DataPersitanceHelpers.GetValueFromDictionary <int>(ref dataDictionary, "TargetPortalIndex"); previousTargetPortal = DataPersitanceHelpers.GetValueFromDictionary <int>(ref dataDictionary, "previousTargetPortal"); return(dataDictionary); }
public override Dictionary <string, object> Load(bool destroyUnloaded = false) { Dictionary <string, object> dataDictionary = base.Load(destroyUnloaded); armourSlot.equippedSlot.InventoryItem?.UnapplyModifiers(character); leftWeaponSlot.equippedSlot.InventoryItem?.UnapplyModifiers(character); rightWeaponSlot.equippedSlot.InventoryItem?.UnapplyModifiers(character); armourSlot.equippedSlot.Clear(); leftWeaponSlot.equippedSlot.Clear(); rightWeaponSlot.equippedSlot.Clear(); var armourPath = DataPersitanceHelpers.GetValueFromDictionary <string>(ref dataDictionary, "armourSlot"); var leftWeaponPath = DataPersitanceHelpers.GetValueFromDictionary <string>(ref dataDictionary, "leftWeapon"); var rightWeaponPath = DataPersitanceHelpers.GetValueFromDictionary <string>(ref dataDictionary, "rightWeapon"); if (!string.IsNullOrWhiteSpace(armourPath)) { var item = Resources.Load <Item>(armourPath); if (item) { AddItem(item, false).LeftClick(this, character); } } if (!string.IsNullOrWhiteSpace(leftWeaponPath)) { var item = Resources.Load <Item>(leftWeaponPath); if (item) { AddItem(item, false).LeftClick(this, character); } } if (!string.IsNullOrWhiteSpace(rightWeaponPath)) { var item = Resources.Load <Item>(rightWeaponPath); if (item) { AddItem(item, false).RightClick(this, character); } } return(dataDictionary); }
public Dictionary <string, object> Load(bool destroyUnloaded = false) { //create new dictionary to contain data for characterbase Dictionary <string, object> dataDictionary = new Dictionary <string, object>(); if (!uuid) { return(dataDictionary); } //load dictionary DataPersitanceHelpers.LoadDictionary(ref dataDictionary, uuid.ID); IsLocked = DataPersitanceHelpers.GetValueFromDictionary <bool>(ref dataDictionary, "IsLocked"); if (Animator != null) { Animator.SetBool(OnTriggerAnimation, InteractionTrigger.AnyTrue(InteractTriggers)); } return(dataDictionary); }