Exemplo n.º 1
0
    private void FixedUpdate()
    {
        if (starvingLevel <= 0f)
        {
            //AddReward(-1f);
            //EndEpisode();
        }
        else
        {
            starvingLevel = starvingLevel - 0.05f;
        }
        if (m_InfectionStatus == agentStatus.HEALTHY)
        {
            //Survive Bonus
            SetReward(0.01f);

            //Add to totalScore also
            statRecorder.totalScore += 0.01f;
        }
        //Debug.Log("I'm now infected and time left for my recovery: " + recoverTime);
        else if (m_InfectionStatus == agentStatus.INFECTED)
        {
            // Debug.Log("I'm now infected and time left for my recovery: " + recoverTime);
            if (recoverTime <= 0)
            {
                m_InfectionStatus = agentStatus.RECOVERED;
                changeAgentStatus();
            }
            else
            {
                recoverTime -= Time.fixedDeltaTime;
            }
        }
    }
Exemplo n.º 2
0
    /// <summary>
    /// Gets the distance between agents and expose with infenction probability.
    /// There is an inverse proportion between distance and infection probability.
    /// </summary>
    /// <param name="infector">The agent who is inside of the collider</param>
    private void exposeInfection(GameObject infector)
    {
        //Distance between two agents
        float distance = Vector3.Distance(infector.transform.position, transform.position);

        probability = Mathf.InverseLerp(exposureRadius, 0, distance) / infectionCoeff;

        //Debug.Log("exposureRadius: " + exposureRadius);
        //Debug.Log("Distance: " + distance);
        //Debug.Log("InfectionCoeff : " + infectionCoeff);
        //Debug.Log("Probability of getting infected is: " + probability);

        if (Random.Range(0f, 1f) < probability)
        {
            //Debug.Log("You got infected");
            m_InfectionStatus = agentStatus.INFECTED;
            changeAgentStatus();
            SetReward(-1f);
            //pandemicArea.addRewardAllAgents(-0.5f);
            statRecorder.infectedCounts += 1;

            //EndEpisode();
            //If infector is an agent then also penalize it too for infecting someone. Shame!
            if (infector.GetComponent <PandemicAgent>())
            {
                infector.GetComponent <PandemicAgent>().AddReward(-1f);
                statRecorder.totalScore += -1;
            }
        }
    }
Exemplo n.º 3
0
 private void FixedUpdate()
 {
     if (!isFrozen)
     {
         //Debug.Log("movement type : " + m_MoveType);
         if (m_MoveType == MovementType.RANDOMTARGET)
         {
             moveRandomTarget();
         }
         else if (m_MoveType == MovementType.BOUNCY)
         {
             moveBouncy();
         }
     }
     if (m_InfectionStatus == agentStatus.INFECTED)
     {
         if (recoverTime <= 0)
         {
             m_InfectionStatus = agentStatus.RECOVERED;
             changeAgentStatus();
         }
         else
         {
             recoverTime -= Time.deltaTime;
         }
     }
 }
Exemplo n.º 4
0
        public void showMain(System.Windows.Forms.TreeNode currentNode)
        {
            clearCellValueChangedEvent();
            clearCellClickEvent();
            if (currentNode.Name == "ctiDrive")
            {
                ConfigLeaf.ctiDrive cti = new ConfigLeaf.ctiDrive();
                cti.showDataGridView(dataGridView1);
                MainConfigAreaTitle.Text = "CTI数据库配置";
            }
            else if (currentNode.Name == "drivesConfig")
            {
                drivesConfig drivesConfig = new drivesConfig();
                drivesConfig.showDataGridView(dataGridView1);
                MainConfigAreaTitle.Text = "分机,坐席设备";
            }
            else if (currentNode.Name == "URLConfig")
            {
                URLConfig URLConfig = new URLConfig();
                URLConfig.showDataGridView(dataGridView1);
                MainConfigAreaTitle.Text = "URL跳转配置";
            }
            else if (currentNode.Name == "agent" || currentNode.Name == "agentConfig")
            {
                agent agent = new agent();
                agent.showDataGridView(dataGridView1);
                MainConfigAreaTitle.Text = "坐席配置";
            }
            else if (currentNode.Name == "agentGroup")
            {
                showSonNode(currentNode);
                agentGroup ag = new agentGroup();
                ag.esunnetConfig = this;
                ag.showDataGridView(dataGridView1);
                MainConfigAreaTitle.Text = "坐席组配置";
            }
            else if (currentNode.Name == "agentStatus")
            {
                agentStatus ageSta = new agentStatus();

                ageSta.showDataGridView(dataGridView1);
                MainConfigAreaTitle.Text = "坐席忙碌原因";
            }
            else if (currentNode.Parent != null)
            {
                if (currentNode.Parent.Name == "agentGroup")
                {
                    string[]       fullName = currentNode.Name.Split('<');
                    agentGroupLeaf aGL      = new agentGroupLeaf();
                    aGL.groupId = fullName[1];
                    aGL.showDataGridView(dataGridView1);
                    MainConfigAreaTitle.Text = "坐席组" + fullName[1];
                }
                ;
            }
            ;
        }
Exemplo n.º 5
0
    /// <summary>
    /// Gets the distance between agents and expose with infenction probability.
    /// There is an inverse proportion between distance and infection probability.
    /// </summary>
    /// <param name="infector">The agent who is inside of the collider</param>
    private void exposeInfection(GameObject infector)
    {
        //Distance between two agents
        float distance = Vector3.Distance(infector.transform.position, transform.position);

        probability = Mathf.InverseLerp(exposureRadius, 0, distance) / infectionCoeff;

        //Debug.Log("Probability of getting infected is: " + probability);

        if (Random.Range(0f, 1f) < probability)
        {
            // Debug.Log("You got infected");
            m_InfectionStatus = agentStatus.INFECTED;
            changeAgentStatus();
        }
    }
Exemplo n.º 6
0
 private void FixedUpdate()
 {
     if (!isFrozen)
     {
         moveRandomTarget();
     }
     if (m_InfectionStatus == agentStatus.INFECTED)
     {
         if (recoverTime <= 0)
         {
             m_InfectionStatus = agentStatus.RECOVERED;
             changeAgentStatus();
         }
         else
         {
             recoverTime -= Time.deltaTime;
         }
     }
 }
Exemplo n.º 7
0
 private void FixedUpdate()
 {
     if (!isFrozen)
     {
         lastFrameVelocity = rb.velocity;
     }
     if (m_InfectionStatus == agentStatus.INFECTED)
     {
         if (recoverTime <= 0)
         {
             m_InfectionStatus = agentStatus.RECOVERED;
             changeAgentStatus();
         }
         else
         {
             recoverTime -= Time.deltaTime;
         }
     }
 }