Exemple #1
0
        protected override void DoStart()
        {
            float seconds = this.seconds;

            if (seconds < 0)
            {
                if (this.blackboardKey != null)
                {
                    seconds = Blackboard.Get <float>(this.blackboardKey);
                }
                else if (this.function != null)
                {
                    seconds = this.function();
                }
            }
//            UnityEngine.Assertions.Assert.IsTrue(seconds >= 0);
            if (seconds < 0)
            {
                seconds = 0;
            }

            if (randomVariance >= 0f)
            {
                Clock.AddTimer(seconds, randomVariance, 0, onTimer);
            }
            else
            {
                Clock.AddTimer(seconds, 0, onTimer);
            }
        }
Exemple #2
0
    void Start()
    {
        resources.Add(ResType.FOOD, 4);
        resources.Add(ResType.WATER, 4);
        resources.Add(ResType.STONE, 60);

        DebugPanel.AddDebug(() => {
            return(foodAlarms);
        }, "Food Alarms");
        DebugPanel.AddDebug(() => {
            return(waterAlarms);
        }, "Water Alarms");

        Clock.AddTimer((id) => {
            if (FoodLow())
            {
                foodAlarms++;
                Clock.AddOneTimeTimer((nid) => { foodAlarms--; }, alarmTimeHours);
            }
        }, 1);

        Clock.AddTimer((id) => {
            if (WaterLow())
            {
                waterAlarms++;
                Clock.AddOneTimeTimer((nid) => { waterAlarms--; }, alarmTimeHours);
            }
        }, 1);
    }
        protected override void DoStart()
        {
            RootNode.Blackboard.Get <Agent>("self").DisableCheckMailbox();
            RootNode.Blackboard[type + "-confirmed"] = new List <Agent>();
            List <Agent> receiversList = RootNode.Blackboard.Get <List <Agent> >(receivers);

            if (quorumCount == -1)
            {
                // Check quorum list
                quorumList = RootNode.Blackboard.Get <List <Agent> >(quorum);
            }
            HardRequest request = new HardRequest(type);

            foreach (Parameter p in parameters)
            {
                request.Add(p.GetReceiverKey(), RootNode.Blackboard.Get <object>(p.GetSenderKey()));
            }
            Message message = new Message(RootNode.Blackboard.Get <Agent>("self"), request, condition, timeout);

            foreach (Agent agent in receiversList)
            {
                agent.ReceiveMessage(message);
            }
            Clock.AddTimer(0.0f, 0.0f, -1, CheckQuorum);
            Clock.AddTimer(timeout / 1000.0f, -1, QuorumNotMet);
        }
Exemple #4
0
 protected override void DoStart()
 {
     if (randomVariance >= 0f)
     {
         Clock.AddTimer(seconds, randomVariance, 0, onTimer);
     }
     else
     {
         Clock.AddTimer(seconds, 0, onTimer);
     }
 }
Exemple #5
0
    void Start()
    {
        var rnd = new System.Random(DateTime.Now.Millisecond);

        names = names.OrderBy(x => rnd.Next()).ToArray();

        newCitizensTimerId = Clock.AddTimer(TimerEnded, newCitizenTimerIngameHours);

        DebugPanel.AddDebug(() => { return(newCitizensNum.ToString()); }, "Max Arrivals");
        DebugPanel.AddDebug(() => { return(ActualArrivals().ToString()); }, "Actual Arrivals");

        SpawnNew();
        //Clock.AddOneTimeTimer((s) => { SpawnNew(8); }, 4);
        //Clock.AddOneTimeTimer((s) => { SpawnNew(8); }, 8);
    }
Exemple #6
0
 public void Start()
 {
     Clock.AddTimer((id) => { Produce(); }, productionDurationPerWorkerIGHours / 10f);
 }