Example #1
0
        protected override void AwardCompletion()
        {
            base.AwardCompletion();

            Debug.Log("[LRTR] DownrangeDistance AwardCompletion");

            var cc = (ConfiguredContract)Root;

            if (cc.AutoAccept)
            {
                string contractName = ConfiguredContract.contractTypeName(cc);
                Debug.Log("[LRTR] Contract name: " + contractName);

                GameEvents.onGameSceneSwitchRequested.Add(SceneChangeInProgress);

                if (CompletedParams == null)
                {
                    CompletedParams = new Dictionary <string, DownrangeDistance>();
                }

                if (CompletedParams.ContainsKey(contractName))
                {
                    CompletedParams[contractName] = this;
                }
                else
                {
                    CompletedParams.Add(contractName, this);
                }
            }
        }
Example #2
0
        protected override void OnRegister()
        {
            base.OnRegister();
            GameEvents.onLaunch.Add(new EventData <EventReport> .OnEvent(OnLaunch));

            try
            {
                var    cc           = (ConfiguredContract)Root;
                string contractName = ConfiguredContract.contractTypeName(cc);

                if (cc.AutoAccept && CompletedParams != null && CompletedParams.ContainsKey(contractName))
                {
                    Debug.Log("[LRTR] Carrying starting point over to new contract...");
                    DownrangeDistance oldParam = CompletedParams[contractName];
                    triggered     = oldParam.triggered;
                    curDist       = oldParam.curDist;
                    markLatitude  = oldParam.markLatitude;
                    markLongitude = oldParam.markLongitude;
                }
            }
            catch (Exception ex)
            {
                Debug.LogError("[LRTR] OnRegisterError: " + ex);
            }
        }