Example #1
0
        public void SaveCheckpoint()
        {
            foreach (SaveValue v in variablesToSave)
            {
                switch (v.name)
                {
                case "ACTIVE":
                    v.value = gameObject.activeInHierarchy.ToString();
                    break;

                case "POSITION":
                    v.value = transform.position.ToString();
                    break;

                case "ROTATION":
                    v.value = transform.rotation.ToString();
                    break;

                default:
                    EntityVariable entVariable = interactiveVariable.GetVariable(v.name, true);
                    if (entVariable == null)
                    {
                        Debug.LogWarning("Try to save a wrong variable (" + v + ") in gameObject : " + name, gameObject);
                        continue;
                    }
                    v.value = entVariable.Value;
                    break;
                }
            }
        }
Example #2
0
        public void LoadCheckpoint()
        {
            foreach (SaveValue v in variablesToSave)
            {
                switch (v.name)
                {
                case "ACTIVE":
                    gameObject.SetActive(bool.Parse(v.value));
                    break;

                case "POSITION":
                    transform.position = ToVector3(v.value);
                    break;

                case "ROTATION":
                    transform.rotation = ToQuaternion(v.value);
                    break;

                default:
                    EntityVariable entVariable = interactiveVariable.GetVariable(v.name, true);
                    if (entVariable == null)
                    {
                        Debug.LogWarning("Try to load a wrong variable (" + v + ") in gameObject : " + name, gameObject);
                        continue;
                    }
                    entVariable.Set(v.value);
                    break;
                }
            }
        }
Example #3
0
 public void Init(EntityVariable reference)
 {
     variable = reference;
     reference.AddOnSetValue(UpdateText);
     nameColor  = ColorUtility.ToHtmlStringRGBA(Color.white);
     valueColor = ColorUtility.ToHtmlStringRGBA(Color.white);
     ResetColor();
     UpdateText("");
 }