Exemple #1
0
        /***************************************** DELEGATES AND EVENTS ***************************************************
        * This section holds all delegates and events, that we will use to notify subscribers of state changes.          *
        * For example, whenever the perception range is changed, notify the perception sphere to make it change its size.*
        ******************************************************************************************************************/


        /******************************************* UNITY FUNCTIONS ********************************************
        * This section holds all functions strictly related to Unity, such as updates, collision detection etc.*
        * In principle, every function in this section will run once per frame, except Start().                *
        ********************************************************************************************************/

        protected override void Start()
        {
            base.Start();

            HealthController health = this.GetComponent <HealthController>();

            health.max_health = MaxHealth;
            health.Init();
            InventoryController inventory = this.GetComponent <InventoryController>();

            inventory.max_inventory = MaxInventory;
            inventory.Init();
            DetectionController detection = this.GetComponent <DetectionController>();

            detection.perception_radius = PerceptionRadius;
            detection.Init();
        }
Exemple #2
0
        /***************************************** DELEGATES AND EVENTS ***************************************************
        * This section holds all delegates and events, that we will use to notify subscribers of state changes.          *
        * For example, whenever the perception range is changed, notify the perception sphere to make it change its size.*
        ******************************************************************************************************************/


        /******************************************* UNITY FUNCTIONS ********************************************
        * This section holds all functions strictly related to Unity, such as updates, collision detection etc.*
        * In principle, every function in this section will run once per frame, except Start().                *
        ********************************************************************************************************/

        protected override void Start()
        {
            base.Start();

            HealthController health = this.GetComponent <HealthController>();

            health.max_health = MaxHealth;
            health.Init();
            InventoryController inventory = this.GetComponent <InventoryController>();

            inventory.max_inventory = MaxInventory;
            inventory.Init();
            DetectionController detection = this.GetComponent <DetectionController>();

            detection.perception_radius = PerceptionRadius;
            detection.Init();
            WalkController walk = this.GetComponent <WalkController>();

            walk.move_speed = Speed;
            walk.Init();

            SpawnController.last_spawn = 3f;
        }