Beispiel #1
0
    public void OnMouseClick()
    {
        PersistentVars persVarsScript = persVars.GetComponent <PersistentVars>();

        persVarsScript.taskTime = persVarsScript.taskTimeRT;    // Bit weird but prevents an if loop on every update for persVars and keeps all vars there. Probably a better way!
        SceneManager.LoadScene("survey");
    }
Beispiel #2
0
        // return value for system tables
        public RelationValue GetCatalogTableValue(CatalogTables table)
        {
            var tablemaker = CatalogTableMaker.Create(_catalogtableheadings[table]);

            _catalogtablemaker[table](tablemaker, PersistentVars.GetEntries());
            return(RelationValue.Create(tablemaker.Table));
        }
 void Awake()
 {
     // If this hasn't been created yet (no _instance), create _instance
     if (!_instance)
     {
         _instance = this;
     }
     // Else if it does exist already, destroy this version
     else
     {
         Destroy(this.gameObject);
     }
     DontDestroyOnLoad(this.gameObject);
 }
Beispiel #4
0
    // Use this for initialization
    void Start()
    {
        endSceneUI.gameObject.SetActive(false);
        Time.timeScale = 1;
        persVarsObj    = GameObject.Find("Persistent vars");
        PersistentVars persVars = persVarsObj.GetComponent <PersistentVars>();

        // Aircraft stats
        diveRate  = persVars.diveRate;
        climbRate = persVars.climbRate;
        yawRate   = persVars.yawRate;
        rollRate  = persVars.rollRate;

        // Drift rate off centre
        drift = persVars.drift;

        // Reticle vars
        targetDist = 20;
        segments   = 16;
        retRadius  = 0.5f;

        // Set up reticle
        LineRenderer reticle = gameObject.GetComponent <LineRenderer>();

        reticle.positionCount = 5;
        reticle.useWorldSpace = false;
        reticle.startColor    = Color.black;
        reticle.endColor      = Color.black;
        reticle.startWidth    = 0.1f;
        reticle.endWidth      = 0.1f;
        reticle.loop          = false;
        reticle.SetPositions(CreateCrossPoints(new Vector3(0, 0, transform.position.z + targetDist)));


        // Time in seconds to run for and start time
        taskTime   = persVars.taskTime;
        timeOnTask = 0;
        oobTime    = 3;

        // Back button text
        string[] bt = { "tea", "crumpets", "whiskey", "biscuits", "gin", "glory", "abuse", "indifference", "paperwork", "disaster", "cake", "medals" };
        backTextList = new List <string>(bt);

        // Reset button text
        string[] rt = { "glinty", "dark", "bright", "early", "late", "many JPEGs", "drunk", "happy" };
        resetTextList = new List <string>(rt);
    }
Beispiel #5
0
        public void LoadFromTable()
        {
            Logger.WriteLine(2, "Load catalog for '{0}'", DatabaseName);
            var centry = GlobalVars.FindEntry(CatalogTableName);
            var table  = GlobalVars.GetValue(centry).AsTable();

            foreach (var row in table.GetRows())
            {
                var blob = (row.Values[3] as BinaryValue).Value;
                // BUG: argLess is an attribute of a symbol but not of an ExpressionBlock, so does not round trip
                var entry = CatalogEntry.FromBinary(blob);
                PersistentVars.Add(entry);
                if (entry.IsDatabase)
                {
                    if (!LinkRelvar(entry.Name))
                    {
                        throw ProgramError.Fatal("Catalog", "cannot add '{0}'", entry.Name);
                    }
                }
            }
        }
Beispiel #6
0
        //--- persistence Mk II

        // Store the persistent catalog and modified tables, local only
        // note: for Sql, only used to create new empty catalog
        public void StoreToTable()
        {
            Logger.WriteLine(2, "Save catalog for '{0}'", DatabaseName);
            var ctm   = CatalogTableMaker.Create(_catalogtableheading);
            var table = ctm.AddEntries(PersistentVars.GetEntries()).Table;

            if (SqlFlag)
            {
                DataTableSql.Create(CatalogTableName, table);
            }
            else
            {
                Persist.Create(DatabasePath, true).Store(CatalogTableName, RelationValue.Create(table));
                var savers = PersistentVars.GetEntries().Where(e => e.IsUnsaved);
                Logger.WriteLine(2, $"Persist {savers.Count()} entries");
                foreach (var entry in savers)
                {
                    Persist.Create(DatabasePath, true).Store(entry.Name, entry.Value);
                }
            }
        }