public void Load(SaveData data) { SaveLoadUtils.BasicLoad(this, data); ExtendedSaveData saveData = (ExtendedSaveData)data; if (saveData != null) { for (int i = 0; i < components.Length; i++) { if (components[i] is Behaviour behaviour) { behaviour.enabled = saveData.ComponentDatas[i].Enabled; if (behaviour is AudioSource source) { ExtendedSaveData.AudioSourceData audioSourceData = (ExtendedSaveData.AudioSourceData)saveData.ComponentDatas[i]; source.clip = audioSourceData.Clip; if (audioSourceData.Playing) { source.Play(); } } else if (behaviour is Animator animator) { ExtendedSaveData.AnimatorData animatorData = (ExtendedSaveData.AnimatorData)saveData.ComponentDatas[i]; animator.speed = animatorData.Speed; for (int l = 0; l < animator.layerCount; l++) { animator.Play(animatorData.States[l].fullPathHash, l, animatorData.States[l].normalizedTime); } } } else { switch (components[i]) { case Rigidbody rb: ExtendedSaveData.RigidbodyData rigidbodyData = (ExtendedSaveData.RigidbodyData)saveData.ComponentDatas[i]; rb.mass = rigidbodyData.Mass; rb.isKinematic = rigidbodyData.IsKinematic; rb.useGravity = rigidbodyData.UseGravity; break; case Collider cl: ExtendedSaveData.ColliderData colliderData = (ExtendedSaveData.ColliderData)saveData.ComponentDatas[i]; cl.isTrigger = colliderData.IsTrigger; cl.enabled = colliderData.Enabled; break; case MeshRenderer mr: ExtendedSaveData.MeshRendererData meshRendererData = (ExtendedSaveData.MeshRendererData)saveData.ComponentDatas[i]; mr.materials = meshRendererData.Materials; mr.enabled = meshRendererData.Enabled; break; } } } } }
public void Load(SaveData data) { SaveLoadUtils.BasicLoad(this, data); if (data is StealthTriggerSaveData saveData) { settings = saveData.Settings; UpdateLayer(); } }
public void Load(SaveData data) { SaveLoadUtils.BasicLoad(this, data); ActivateableSaveData saveData = (ActivateableSaveData)data; Open = saveData.open; Active = saveData.isActive; done = saveData.done; Reload(); }
///<inheritdoc/> public void Load(SaveData data) { SaveLoadUtils.BasicLoad(this, data); BonusSaveData saveData = (BonusSaveData)data; if (saveData != null) { done = saveData.done; } }
public void Load(SaveData data) { SaveLoadUtils.BasicLoad(this, data); DamageableSaveData saveData = (DamageableSaveData)data; if (saveData != null) { HP = saveData.hp; Dead = saveData.dead; } }
/// <inheritdoc/> public override void Load(SaveData data) { SaveLoadUtils.BasicLoad(this, data); navMeshAgent.Warp(data.pos); sensors.ResetVision(); EntitySaveData entitySaveData = (EntitySaveData)data; if (entitySaveData != null) { hp = entitySaveData.hp; if (Dead != entitySaveData.dead) { if (entitySaveData.dead) { Kill(); } else { Revive(); } Dead = entitySaveData.dead; } switch (entitySaveData.state) { case AIStateAggresion agr: SwitchState(aggresionState); break; case AIStateAttention att: SwitchState(attentionState); break; case AIStateCover cvr: SwitchState(coverState); break; case AIStateIdle idl: SwitchState(idleState); break; case AIStateSleep slp: SwitchState(sleepState); break; } } }
public void Load(SaveData data) { paused = true; SaveLoadUtils.BasicLoad(this, data); rigid.position = data.pos; if (data is MoveableSaveData saveData) { currentStep = saveData.RuntimeData.CurrentStep; done = saveData.RuntimeData.Done; paused = saveData.RuntimeData.Paused; posIndex = saveData.RuntimeData.PosIndex; stopped = saveData.RuntimeData.Stopped; t = saveData.RuntimeData.T; tickCount = saveData.RuntimeData.TickCount; } paused = false; UpdateTarget(); }
///<inheritdoc/> public virtual void Load(SaveData data) { CancelInvoke(); SaveLoadUtils.BasicLoad(this, data); TriggerSaveData saveData = (TriggerSaveData)data; if (saveData != null) { done = saveData.done; reloading = saveData.reloading; } if (reloading) { Invoke("Reload", Random.Range(reloadTime.x, reloadTime.y)); } }
public void Load(SaveData data) { SaveLoadUtils.BasicLoad(this, data); paused = true; if (moveByPhysics) { rigid.position = data.pos; } if (data is TransportableSaveData saveData) { moveSpeed = saveData.RuntimeData.MoveSpeed; moveTime = saveData.RuntimeData.MoveTime; moving = saveData.RuntimeData.Moving; paused = saveData.RuntimeData.Pause; rotationSpeed = saveData.RuntimeData.RotSpeed; t = saveData.RuntimeData.T; targetPos = saveData.RuntimeData.TargetPos; rotating = saveData.RuntimeData.Rotating; rotTime = saveData.RuntimeData.RotTime; targetRot = saveData.RuntimeData.TargetRot; tRot = saveData.RuntimeData.TRot; } paused = false; }
///<inheritdoc/> public override void Load(SaveData data) { SaveLoadUtils.BasicLoad(this, data); EntitySaveData entitySaveData = (EntitySaveData)data; if (entitySaveData != null) { hp = entitySaveData.hp; if (Dead != entitySaveData.dead) { if (entitySaveData.dead) { Kill(); } else { Revive(); } Dead = entitySaveData.dead; } } }