Exemplo n.º 1
0
        void Start()
        {
            base.IMass = 1f;//REAL MASS OF UNIT

            if (SimulationManager.Get().addRigidBodyCollider == false)
            {
                base.IMaxForce = 0.06f;
                base.IMaxSpeed = 0.06f;
            }

            if (SimulationManager.Get().addRigidBodyCollider)
            {
                base.IMaxForce = 3.5f;
                base.IMaxSpeed = 3.5f;
            }



            if (SimulationManager.Get().runSimulation)
            {
                runSimulation = true;
            }


            base.VisionRadius = (this.gameObject.GetComponent <SphereCollider>().radius * 2) * 1.9f;

            rb = GetComponent <Rigidbody>();
            //rb.velocity = base.velocity;
            //rb.mass = base.IMass = 1;

            agentRadius = this.gameObject.GetComponent <SphereCollider>().radius;
            base.energyDecreasingFactor = 0.05f;
            //base.energyLevel = 650f; // 650 maH --> litjuim batter capacity that we are using



            base.energyCapacity = 650f; // 650 maH --> litjuim batter capacity that we are using

            // if (base.heliumLevel < 0) base.heliumLevel = 0;



            ///////////////////////////////VARIABLE INITIALIZATION////////////////////////////////

            // NON STATIC PUBLIC VARIABLE INITIALIZATION

            agentPopulation = GameObject.Find("AgentPopulation");  // create variable to store game object that holds script top reference
            AP = agentPopulation.GetComponent <AgentPopulation>(); // store script to reference in variable

            generationManager = GameObject.Find("GenerationManager");
            GM = generationManager.GetComponent <GenerationManager>();

            pixelPopulation = GameObject.Find("PixelPopulation");
            pixelPop        = pixelPopulation.GetComponent <PixelPopulation>();

            scalarField = GameObject.Find("ScalarField2D");
            SF          = scalarField.GetComponent <ScalarField2D>();

            ///////////////////////////////METHOD INITIALIZATION////////////////////////////////
        } // END START
Exemplo n.º 2
0
        void Start()
        {
            emissiveMaterial = gameObject.GetComponent <MeshRenderer>().material;
            startTime        = Time.time;



            ///////////////////////////////VARIABLE INITIALIZATION////////////////////////////////

            // NON STATIC PUBLIC VARIABLE INITIALIZATION


            agentPopulation = GameObject.Find("AgentPopulation");  // create variable to store game object that holds script top reference
            AP = agentPopulation.GetComponent <AgentPopulation>(); // store script to reference in variable


            pixelPopulation = GameObject.Find("PixelPopulation");
            pixelPop        = pixelPopulation.GetComponent <PixelPopulation>();
            //  NON STATIC PUBLIC VARIABLE INITIALIZATION



            scalarField = GameObject.Find("ScalarField2D");
            SF          = scalarField.GetComponent <ScalarField2D>();

            generationManager = GameObject.Find("GenerationManager");
            GM = generationManager.GetComponent <GenerationManager>();

            ///////////////////////////////METHOD INITIALIZATION////////////////////////////////



            base.IMass = 1f;//REAL MASS OF UNIT

            if (SimulationManager.Get().addRigidBodyCollider == false)
            {
                base.IMaxForce = 0.06f;
                base.IMaxSpeed = 0.06f;
            }

            if (SimulationManager.Get().addRigidBodyCollider)
            {
                base.IMaxForce = 2.6f;
                base.IMaxSpeed = 2.6f;
            }

            base.VisionRadius = (this.gameObject.GetComponent <SphereCollider>().radius * 2) * 0.9f;

            rb = GetComponent <Rigidbody>();


            base.energyDecreasingFactor = 0.1f;
            base.energyLevel            = 650f; // 650 maH --> litjuim batter capacity that we are using


            base.energyCapacity = 650f; // 650 maH --> litjuim batter capacity that we are using



            if (SimulationManager.Get().addRigidBodyCollider)
            {
                this.gameObject.GetComponent <SphereCollider>().isTrigger = false;
                rb.isKinematic = false;
            }
        } // END START