Пример #1
0
void physicsactor_render_sensors(const physicsactor_t *pa, v2d_t camera_position)
{
    sensor_render(sensor_A(pa), pa->position, pa->movmode, camera_position);
    sensor_render(sensor_B(pa), pa->position, pa->movmode, camera_position);
    sensor_render(sensor_C(pa), pa->position, pa->movmode, camera_position);
    sensor_render(sensor_D(pa), pa->position, pa->movmode, camera_position);
    sensor_render(sensor_M(pa), pa->position, pa->movmode, camera_position);
    sensor_render(sensor_U(pa), pa->position, pa->movmode, camera_position);
}
Пример #2
0
//----------------------------------------------------------------------------------------------by カンペー
int getAction (Agent_status *strAGENT,node_t *strNODE)
{
    if (!(strNODE->bEND))
    {
        switch (strNODE->iSENSOR)
        {
            case 0:
                if(sensor_A(strAGENT) == 1)
                {
                    strNODE->iACTION = getAction(strAGENT,strNODE->p_strRIGHT_CHILD); 
                }
                else
                {
                    strNODE->iACTION = getAction(strAGENT,strNODE->p_strLEFT_CHILD);                   
                }
                break;
            case 1:
                if(sensor_B(strAGENT) == 1)
                {
                    strNODE->iACTION = getAction(strAGENT,strNODE->p_strRIGHT_CHILD); 
                }
                else
                {
                    strNODE->iACTION = getAction(strAGENT,strNODE->p_strLEFT_CHILD);                   
                }
                break;
            case 2:
                if(sensor_C(strAGENT) == 1)
                {
                    strNODE->iACTION = getAction(strAGENT,strNODE->p_strRIGHT_CHILD);                  
                }
                else
                {
                    strNODE->iACTION = getAction(strAGENT,strNODE->p_strLEFT_CHILD);                   
                }
                break;
            case 3:
                if(sensor_D(strAGENT) == 1)
                {
                    strNODE->iACTION = getAction(strAGENT,strNODE->p_strRIGHT_CHILD);
                }
                else
                {
                    strNODE->iACTION = getAction(strAGENT,strNODE->p_strLEFT_CHILD);                   
                }
                break;
            case 4:
                if(sensor_E(strAGENT) == 1)
                {
                    strNODE->iACTION = getAction(strAGENT,strNODE->p_strRIGHT_CHILD); 
                }
                else
                {
                    strNODE->iACTION = getAction(strAGENT,strNODE->p_strLEFT_CHILD);                   
                }
                break;
            case 5:
                if(sensor_F(strAGENT) == 1)
                {
                    strNODE->iACTION = getAction(strAGENT,strNODE->p_strRIGHT_CHILD);                   
                }
                else
                {
                    strNODE->iACTION = getAction(strAGENT,strNODE->p_strLEFT_CHILD);                   
                }
                break;
            case 6:
                if(sensor_G(strAGENT) == 1)
                {
                    strNODE->iACTION = getAction(strAGENT,strNODE->p_strRIGHT_CHILD);                   
                }
                else
                {
                    strNODE->iACTION = getAction(strAGENT,strNODE->p_strLEFT_CHILD);                   
                }
                break;
            case 7:
                if(sensor_H(strAGENT) == 1)
                {
                    strNODE->iACTION = getAction(strAGENT,strNODE->p_strRIGHT_CHILD);                   
                }
                else
                {
                    strNODE->iACTION = getAction(strAGENT,strNODE->p_strLEFT_CHILD);                   
                }
                break;
            case 8:
                if(sensor_I(strAGENT) == 1)
                {
                    strNODE->iACTION = getAction(strAGENT,strNODE->p_strRIGHT_CHILD);                   
                }
                else
                {
                    strNODE->iACTION = getAction(strAGENT,strNODE->p_strLEFT_CHILD);                   
                }
                break;
            case 9:
                if(sensor_J(strAGENT) == 1)
                {
                    strNODE->iACTION = getAction(strAGENT,strNODE->p_strRIGHT_CHILD);                   
                }
                else
                {
                    strNODE->iACTION = getAction(strAGENT,strNODE->p_strLEFT_CHILD);
                }
                break;
        case 10:
            if(sensor_K(strAGENT) == 1)
            {
                    strNODE->iACTION = getAction(strAGENT,strNODE->p_strRIGHT_CHILD);                
            }
            else
            {
                    strNODE->iACTION = getAction(strAGENT,strNODE->p_strLEFT_CHILD);
            }
            default:
                //nop
                break;
        }//switchセンサー


    }
    else
    {
        return strNODE->iACTION;
    }
}