示例#1
0
        public void DoWork(float workTime)
        {
            // Check to make sure we have everything we need.
            // If not, don't register the work time.
            if (HasAllMaterial() == false)
            {
                // Still call the callbacks though, so animations etc can be updated
                if (cbOnJobWorked != null)
                {
                    cbOnJobWorked(this);
                }

                foreach (var funcname in cbOnJobWorkedLua)
                {
                    FurnitureActions.CallFunction(funcname, this);
                }

                return;
            }

            if (cbOnJobWorked != null)
            {
                cbOnJobWorked(this);
            }
            foreach (var funcname in cbOnJobWorkedLua)
            {
                FurnitureActions.CallFunction(funcname, this);
            }

            JobTime -= workTime;

            if (JobTime <= 0)
            {
                // Do whatever is supposed to happen when this Job completes.
                if (cbOnJobCompleted != null)
                {
                    cbOnJobCompleted(this);
                }
                foreach (var funcname in cbOnJobCompletedLua)
                {
                    FurnitureActions.CallFunction(funcname, this);
                }

                if (jobRepeats == false)
                {
                    // If the Job is completely done, notify everything.
                    if (cbOnJobStopped != null)
                    {
                        cbOnJobStopped(this);
                    }
                }
                else
                {
                    // This is a repeating Job, and must be reset.
                    JobTime += JobTimeRequired;
                }
            }
        }
示例#2
0
        public Enterability IsEnterable()
        {
            if (string.IsNullOrEmpty(_cbIsEnterableAction))
            {
                return(Enterability.Yes);
            }

            var ret = FurnitureActions.CallFunction(_cbIsEnterableAction, this);

            return((Enterability)ret.Number);
        }