Esempio n. 1
0
        void Start()
        {
            MessageHub.Instance.AddListener(this, ProductTrader.MessageName);

            // TODO: re-assess when to tick trades
            var node = StopWatch.AddNode("CheckForTrades", 5);

            node.OnTick += CheckForTrades;
        }
Esempio n. 2
0
        private void BeginCrafting(QueuedRecipe queuedRecipe)
        {
            var recipe = queuedRecipe.Recipe;

            // will most likely not make it here in the first place, but jic
            if (recipe.Container.Name != Info.Name)
            {
                throw new UnityException(string.Format("{0} was given a recipe for {1}", Info.Name, recipe.Container.Name));
            }

            // may replace with WorldTime when it is a more flexible type
            var seconds = WorldClock.Instance.GetSeconds(recipe.TimeLength);

            StopWatch.AddNode(STOPWATCH_NAME, seconds, true).OnTick = CompleteCraft;
            _currentlyCrafting = queuedRecipe;
            if (OnCraftingBegin != null)
            {
                OnCraftingBegin(queuedRecipe.Recipe, queuedRecipe.ID);
            }
        }