Ejemplo n.º 1
0
        // Update is called once per frame
        void Update()
        {
            gather();

            if (HP == 0)
            {
                Destroy();
            }

            // Poll for incoming merchant
            World world         = GameObject.FindObjectOfType <World>();
            int   road_security = (world.military / 20); // 1..5 like merchants

            while ((merchants < road_security) && (merchants < MAX_MERCHANT))
            {
                merchants++;
            }

            // Poll for losing merchant
            while ((merchants > road_security) && (merchants > 0))
            {
                merchants--;
            }

            // Resolve market
            if (merchants > 0)
            {
                staticEvents.Add(EventBank.generateGoldEvent(merchants * goldPerMerchant));
            }
        }
Ejemplo n.º 2
0
 // Use this for initialization
 void Start()
 {
     HP            = 30;
     isStaticBonus = true;
     staticEvents  = new List <CoreEvent>(1);
     staticEvents.Add(EventBank.generateFoodStorageEvent(storageSize));
 }
Ejemplo n.º 3
0
 // Use this for initialization
 void Start()
 {
     HP            = 10;
     isStaticBonus = true;
     staticEvents  = new List <CoreEvent>(1);
     staticEvents.Add(EventBank.generateMaxPopulationEvent(houseSize));
 }
Ejemplo n.º 4
0
    // Generates events based on current world stats
    private List <CoreEvent> generateEventsFromWorldStats()
    {
        List <CoreEvent> generatedEvents = new List <CoreEvent>();

        // Hunger on Happiness
        int hungerRatio = (hunger / HUNGER_DIV_RATIO);

        if (hungerRatio > 0)
        {
            generatedEvents.Add(EventBank.generateHappinessEvent((-1) * hungerRatio));
        }
        else
        {
            generatedEvents.Add(EventBank.generateHappinessEvent(1));
        }


        // food_units_missing
        int food_units_missing = population - ressource_table[Ressource.TYPE.FOOD];

        if (food_units_missing < 0)
        {
            generatedEvents.Add(EventBank.generateHungerEvent(food_units_missing));
        }
        else
        {
            generatedEvents.Add(EventBank.generateHungerEvent(food_units_missing));
        }



        return(generatedEvents);
    }
Ejemplo n.º 5
0
 void Start()
 {
     HP            = 50;
     isStaticBonus = true;
     staticEvents  = new List <CoreEvent>(1);
     staticEvents.Add(EventBank.generateMilitaryEvent(militaryValue));
 }
Ejemplo n.º 6
0
        override public List <CoreEvent> generateEvents()
        {
            List <CoreEvent> events = new List <CoreEvent>();

            foreach (InternalEntities ie in users)
            {
                if (readyToConsume)
                {
                    events.Add(EventBank.generateFoodEvent(ressource_per_hit));
                    ressource_units_pool -= ressource_per_hit;
                    readyToConsume        = false;
                }
            }
            return(events);
        }
Ejemplo n.º 7
0
        /// +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
        /// <summary>
        /// Gets the Gpio Settings as a human readable string
        /// </summary>
        /// <history>
        ///    28 Aug 14  Cynic - Started
        /// </history>
        public string GpioSettingsAsString()
        {
            string pullMode   = "";
            string recModeStr = "";

            if (MuxMode == 7)
            {
                // really the concept of input or output only exists in mode 7 (GPIO Mode)
                if (ReceiverMode != 0)
                {
                    recModeStr = ", Input";
                }
                else
                {
                    recModeStr = ", Output";
                }
                // similarly pullup or pulldown only exists in mode 7 as well
                if (PullupIsActive == true)
                {
                    pullMode = ", Pullup";
                }
                if (PulldownIsActive == true)
                {
                    pullMode = ", Pulldown";
                }
            }

            return(HeaderNum.ToString() + "_" +
                   HeaderPin.ToString() + " " +
                   Gpio.ToString() +
                   " " + EventBank.ToString() + "[" + EventBit.ToString() + "](0x" + EventBit.ToString("x2") + ")" +
                   ", PinMuxAddr=" + PinmuxRegisterAddressAsHexString +
                   " (" + PinmuxRegisterOffsetAsHexString +
                   "/" + PinmuxRegisterDTIndexAsHexString + "), " +
                   "Mux=" + MuxOwner + ", " +
                   "Gpio=" + GpioOwner + ", " +
                   "GpioSet=" + GpioSetting.ToString("x4") + ", " +
                   "MuxMode=" + MuxMode.ToString() +
                   pullMode + recModeStr);
        }
Ejemplo n.º 8
0
 void Destroy()
 {
     staticEvents.Add(EventBank.generateFoodStorageEvent((-1) * storageSize));
 }
Ejemplo n.º 9
0
 void Destroy()
 {
     staticEvents.Add(EventBank.generateMaxPopulationEvent((-1) * houseSize));
 }
Ejemplo n.º 10
0
 void Destroy()
 {
     staticEvents.Add(EventBank.generateMilitaryEvent((-1) * militaryValue));
 }