/// <summary>
        /// This is where all sensor and motor properties are initialized
        /// </summary>
        /// <param name="bluetoothPortName"></param>
        public Scorpio(string bluetoothPortName)
        {
            Brick = new AForgeNxtBrickFacade();
            BluetoothPortName = bluetoothPortName;

            // Sensors:
            // 1
            TouchSensor = new TouchSensor(Brick, NxtBrick.Sensor.First);
            // 2
            LightIntensitySensor = new LightSensor(Brick, NxtBrick.Sensor.Second);
            // 3 (shared)
            SoundLevelSensor = new SoundSensor(Brick, NxtBrick.Sensor.Third);
            SoundRatioSensor = new SoundDbaRatioSensor(Brick, NxtBrick.Sensor.Third);
            // 4
            UltrasonicSensor = new UltrasonicSensor(Brick, NxtBrick.Sensor.Fourth);

            // Motor sensors:
            // 1

            // Motors:
            // A,B,C
            MotorTail = new Motor(Brick, NxtBrick.Motor.A);
            MotorRight = new Motor(Brick, NxtBrick.Motor.B);
            MotorLeft = new Motor(Brick, NxtBrick.Motor.C);

            // Walk:
            WalkBehavior = new TwoMotorWalkBehavior(MotorLeft, MotorRight);
        }
Exemple #2
0
    // Token: 0x06000C93 RID: 3219 RVA: 0x00050434 File Offset: 0x0004E634
    public void SetText(SoundSensor sensor)
    {
        if (!this.Sensors.Contains(sensor))
        {
            this.Sensors.Add(sensor);
            sensor.id = this.Sensors.Count - 1;
        }
        switch (sensor.id)
        {
        case 0:
            this.sensor_1_Text.text = this.Sensors[0].roomName;
            return;

        case 1:
            this.sensor_2_Text.text = this.Sensors[1].roomName;
            return;

        case 2:
            this.sensor_3_Text.text = this.Sensors[2].roomName;
            return;

        case 3:
            this.sensor_4_Text.text = this.Sensors[3].roomName;
            return;

        default:
            return;
        }
    }
 public HeardSomething(SoundSensor Sensor, string SoundType, float offset)
 {
     sensor    = Sensor;
     soundType = SoundType;
     //El offset representa cuanto mas de lo minimos aceptamos
     minIntensity = Sensor.threshold + offset;
 }
Exemple #4
0
        /// <summary>
        /// This is where all sensor and motor properties are initialized
        /// </summary>
        /// <param name="bluetoothPortName"></param>
        public Scorpio(string bluetoothPortName)
        {
            Brick             = new AForgeNxtBrickFacade();
            BluetoothPortName = bluetoothPortName;

            // Sensors:
            // 1
            TouchSensor = new TouchSensor(Brick, NxtBrick.Sensor.First);
            // 2
            LightIntensitySensor = new LightSensor(Brick, NxtBrick.Sensor.Second);
            // 3 (shared)
            SoundLevelSensor = new SoundSensor(Brick, NxtBrick.Sensor.Third);
            SoundRatioSensor = new SoundDbaRatioSensor(Brick, NxtBrick.Sensor.Third);
            // 4
            UltrasonicSensor = new UltrasonicSensor(Brick, NxtBrick.Sensor.Fourth);

            // Motor sensors:
            // 1

            // Motors:
            // A,B,C
            MotorTail  = new Motor(Brick, NxtBrick.Motor.A);
            MotorRight = new Motor(Brick, NxtBrick.Motor.B);
            MotorLeft  = new Motor(Brick, NxtBrick.Motor.C);

            // Walk:
            WalkBehavior = new TwoMotorWalkBehavior(MotorLeft, MotorRight);
        }
 public HeardSleepSong(SoundSensor Sensor)
 {
     sensor = Sensor;
     //Solo nos dormiremos si la cancion es mas fuerte que el
     //threshold mas un offset
     minSongIntensity = Sensor.threshold + 6f;
 }
Exemple #6
0
    public override void setSensors()
    {
        GameObject  obj         = m_soldierBuildParam.character.getGameObject();
        SightSensor sightSensor = new SightSensor(obj);
        SoundSensor soundSensor = new SoundSensor(obj);

        GameManager.Instance.registerSensor(sightSensor);
        GameManager.Instance.registerSensor(soundSensor);
    }
        public ButtonTimerHostedService(IPIManager Pimanager)
        {
            _piManager   = Pimanager;
            button       = new Button(_piManager.grovePi, GrovePort.DigitalPin7);
            buzzer       = new Buzzer(_piManager.grovePi, GrovePort.DigitalPin6);
            buzzer.Value = 10;

            lightSensor      = new LightSensor(_piManager.grovePi, GrovePort.AnalogPin0);
            soundSesnor      = new SoundSensor(_piManager.grovePi, GrovePort.AnalogPin1);
            ultrasonicSensor = new UltrasonicSensor(_piManager.grovePi, GrovePort.DigitalPin8);
        }
Exemple #8
0
        public static IProducer <double> CreateComponent(this SoundSensor soundSensor, Pipeline pipeline, TimeSpan samplingInterval)
        {
            if (soundSensor == null)
            {
                throw new ArgumentNullException(nameof(soundSensor));
            }

            if (pipeline == null)
            {
                throw new ArgumentNullException(nameof(pipeline));
            }
            return(Generators.Sequence(pipeline, 0.0, _ => soundSensor.Value, samplingInterval));
        }
Exemple #9
0
        private static void TestSound()
        {
            SoundSensor soundSensor = new SoundSensor(_goPiGo3, GrovePort.Grove1);

            Console.WriteLine($"Test {soundSensor.SensorName} on port {soundSensor.Port}. Press a key to finish the test");
            AddLines();
            while (!Console.KeyAvailable)
            {
                Console.CursorLeft = 0;
                Console.Write($"{soundSensor.SensorName}: {soundSensor} which is {soundSensor.ValueAsPercent} %");
                Thread.Sleep(100);
                CleanALine();
            }
        }
Exemple #10
0
        internal static PocketView GetSvg(this SoundSensor soundSensor)
        {
            var value = soundSensor.Value.ToString("0.##");

            return(g(
                       g[transform: "matrix(0.0834819,0,0,0.0762288,-11.0292,-7.71042)"](
                           CreatePath("M623.239,203.06C623.239,154.054 586.908,114.267 542.16,114.267L225.172,114.267C180.423,114.267 144.093,154.054 144.093,203.06L144.093,550.209C144.093,599.216 180.423,639.003 225.172,639.003L542.16,639.003C586.908,639.003 623.239,599.216 623.239,550.209L623.239,203.06Z", "fill:white;stroke:black;stroke-width:25.02px;")
                           ),
                       g[transform: "matrix(1,0,0,1,-764.084,-112.282)"](
                           _.text[x: "768.748px", y: "149.76px", style: TextStyle]("SOUND")
                           ),
                       g[@class: "SoundLevel", transform: "matrix(1,0,0,1,-752.084,-120.282)"](
                           _.text[x: "768.748px", y: "149.76px", style: TextStyle](value)
                           ),
                       g[transform: "matrix(1,0,0,1,-905.923,-182.8)"](
                           g[transform: "matrix(0.586987,0,0,0.586987,473.851,113.711)"](
                               _.circle[cx: "788.557", cy: "138.653", r: "8.673", style: "fill:rgb(235,235,235);fill-opacity:0;stroke:black;stroke-width:3.41px;"]()
                               ),
                           g[transform: "matrix(0.0293774,0,0,0.026825,906.652,185.697)"](
                               CreatePath("M623.239,203.06C623.239,154.054 586.908,114.267 542.16,114.267L225.172,114.267C180.423,114.267 144.093,154.054 144.093,203.06L144.093,550.209C144.093,599.216 180.423,639.003 225.172,639.003L542.16,639.003C586.908,639.003 623.239,599.216 623.239,550.209L623.239,203.06Z", "fill:rgb(0,24,255);stroke:black;stroke-width:71.1px;")
                               )
                           )
                       ));
        }
Exemple #11
0
    // Token: 0x06000C94 RID: 3220 RVA: 0x00050500 File Offset: 0x0004E700
    public void RemoveText(SoundSensor sensor)
    {
        switch (sensor.id)
        {
        case 0:
            this.sensor_1_Text.text = "";
            return;

        case 1:
            this.sensor_2_Text.text = "";
            return;

        case 2:
            this.sensor_3_Text.text = "";
            return;

        case 3:
            this.sensor_4_Text.text = "";
            return;

        default:
            return;
        }
    }
    }                                                                                                                                                                                                      // 0x0000000181347270-0x00000001813473A0

    public void u0929u0922u0922u091Fu0920u0929u091Au0922u091Eu091Au0926(SoundSensor u0924u0926u0921u091Au091Du091Cu091Du0922u091Eu0924u0920)
    {
    }                                                                                                                                               // 0x0000000181348C60-0x0000000181348DB0
Exemple #13
0
    // public float radiusAlert = 40f;//radio para alertarse
    // public float radiusRun = 35f;//radio para huir


    void Start()
    {
        //INICIALIZAMOS LA DATA DEL EXTERIOR
        kineticsAgent      = agent.kineticsAgent;
        steeringAgent      = agent.steeringAgent;
        kineticsTrainer    = trainer.kineticsAgent;
        kineticsRival      = rival.kineticsAgent;
        sightSensor        = sightComponent.sensor;
        sightSensorPokemon = sightComponentPokemon.sensor;
        soundSensor        = soundComponent.sensor;



        //Piedras
        stones = GameObject.FindGameObjectsWithTag("Stone");
        List <GameObject> stonesList = new List <GameObject>(stones);


        //Inicializamos grafo y A*
        graph = graphComponent.graph;
        aStar = new PathFindAStar(graph, null, null, null, walkable);

        //Inicializamos seek
        seek = new Seek(kineticsAgent, kineticsAgent, maxAccel);

        //Inicializamos lookwehereyougoing
        look = new LookWhereYouAreGoing(kineticsAgent);

        //Obstaculos
        GameObject[]    obstacles     = GameObject.FindGameObjectsWithTag("Obstacle");
        obstacle_data[] obstaclesData = new obstacle_data[obstacles.Length];

        for (int k = 0; k < obstacles.Length; k++)
        {
            obstaclesData[k] = obstacles[k].GetComponent <obstacle_data>();
        }

        //Puntos estrategicos
        strategicPoints = pointsComponent.coverNodes;



        //COMENZAMOS A CONSTRUIR LA MAQUINA DE ESTADOS

        //1. ACCIONES:

        //acciones relacionadas a astar
        FollowPathOfPoints        followPath       = new FollowPathOfPoints(steeringAgent, seek, null, false);
        UpdateFollowPathWithAstar updateFollow     = new UpdateFollowPathWithAstar(followPath, aStar, obstaclesData);
        UpdateAstarBestCoverPoint updateAstarCover = new UpdateAstarBestCoverPoint(strategicPoints, transform, new Transform[] { kineticsRival.transform, kineticsTrainer.transform }, obstaclesData, graph, aStar, walkable);
        UpdateAStarSeenStone      updateAstarStone = new UpdateAStarSeenStone(sightSensor, aStar, graph, transform, walkable);
        //acciones de manejo de giros
        SetAngularSpeed setDefaultRotation = new SetAngularSpeed(kineticsAgent, 10f);
        SetAngularSpeed setZeroRotation    = new SetAngularSpeed(kineticsAgent, 0f);
        StopMoving      stop       = new StopMoving(kineticsAgent, steeringAgent);
        LookWhereGoing  lookAction = new LookWhereGoing(look, steeringAgent);
        //acciones de manejo de srpites
        ShowDefaultSprite defaultSprite = new ShowDefaultSprite(pokemonData);
        RunSprite         showRunSprite = new RunSprite(pokemonData);
        Evolve2           evolve;
        ShowIcon          showExclamation    = new ShowIcon(this.gameObject, "Exclamation");
        DisableIcon       disableExclamation = new DisableIcon(this.gameObject, "Exclamation");
        ShowIcon          showSweat          = new ShowIcon(this.gameObject, "Sweat");
        DisableIcon       disableSweat       = new DisableIcon(this.gameObject, "Sweat");
        //acciones de asistencia
        ResetSensor     resetSight        = new ResetSensor(sightSensor);
        ResetSensor     resetSightPokemon = new ResetSensor(sightSensorPokemon);
        ResetSensor     resetSound        = new ResetSensor(soundSensor);
        ResetSensorList resetSensors      = new ResetSensorList(new List <ResetSensor>()
        {
            resetSight, resetSound, resetSightPokemon
        });
        //acciones de tiempo
        SetTimer setAlertTime;
        //acciones que modifican la maquina de estados misma
        RemoveStateTransition removeTouchStone;
        RemoveStateTransition removeSawStone;
        RemoveStateTransition removeSawStone2;
        RemoveAction          removeDefaultSpriteAction;
        RemoveAction          removeRunSpriteAction;
        RemoveAction          removeRunSpriteAction2;



        //2. ESTADOS:

        List <Action> entryActions; //aqui iremos guardanndo todas las acciondes de entrada
        List <Action> exitActions;  //aqui iremos guardanndo todas las acciones de salida
        List <Action> actions;      //aqui guardaremos todas las acciones intermedias

        //2.a estado para esperar sin hacer nada
        //durante este estado eevee estara quieto hasta que algun humano lo haga reaccionar
        entryActions = new List <Action>()
        {
            stop, defaultSprite, setZeroRotation, resetSensors
        };                                                                                     //al entrar al estado debemos parar y sentarnos
        removeDefaultSpriteAction = new RemoveAction(defaultSprite, entryActions);
        actions = new List <Action>()
        {
        };                            //hacer guardia girando
        exitActions = new List <Action>()
        {
        };

        State wait = new State(actions, entryActions, exitActions);


        //2.b estado para sorprenderse
        //durante este estado eevee dara vueltas en alterta angustiado porque escucho algo, este estado durara solo cierto tiempo
        entryActions = new List <Action>()
        {
            showExclamation, setDefaultRotation
        };                                                                      //al entrar al estado debemos sorprendernos
        actions = new List <Action>()
        {
        };
        exitActions = new List <Action>()
        {
            disableExclamation, setZeroRotation
        };                                                                    //al salir dejamos de sorprendernos

        State alert = new State(actions, entryActions, exitActions);

        //2.c estado para perseguir piedra
        //durante este estado eevee se concentrara unicamente en buscar las piedra que vio
        entryActions = new List <Action>()
        {
            updateAstarStone, updateFollow, showExclamation, showRunSprite
        };                                                                                                 //al entrar al estado debemos actualizar el a* y luego el camino
        removeRunSpriteAction2 = new RemoveAction(showRunSprite, entryActions);
        actions = new List <Action>()
        {
            followPath, lookAction
        };                                                   //durante la accion seguimos el camino
        exitActions = new List <Action>()
        {
            disableExclamation
        };                                                    //al salir no hacemos nada

        State followStone = new State(actions, entryActions, exitActions);

        //2.d estado para perseguir punto de encuentro
        //durante este estado eevee buscara donde esconderse, puede verse interrumpido si accidentalmente toca una piedra o se comprometio su escondite
        entryActions = new List <Action>()
        {
            updateAstarCover, updateFollow, showSweat, showRunSprite, resetSensors
        };                                                                                                         //al entrar al estado debemos actualizar el a* y luego el camino
        removeRunSpriteAction = new RemoveAction(showRunSprite, entryActions);
        actions = new List <Action>()
        {
            followPath, lookAction
        };                                                   //durante la accion seguimos el camino
        exitActions = new List <Action>()
        {
            disableSweat
        };                                              //al salir no hacemos nada

        State followCoverPoint = new State(actions, entryActions, exitActions);

        //2.extra dummy states
        //estos estados son de relleno para facilitar la activacion de ciertas acciones en le orden adecuado
        entryActions = new List <Action>(); //al entrar al estado debemos parar y sentarnos
        actions      = new List <Action>(); //hacer guardia girando
        exitActions  = new List <Action>(); //al salir no hacemos nada

        State evolveState1 = new State(actions, entryActions, exitActions);
        State evolveState2 = new State(actions, entryActions, exitActions);



        //3. CONDICIONES:

        SawSomething       sawStone            = new SawSomething(sightSensor, "Stone");               //si vemos una piedra evolutiva
        SawSomething       sawHuman            = new SawSomething(sightSensor, "Human");               //si vemos una persona
        HeardSomething     heardHumanClose     = new HeardSomething(soundSensor, "Human", 0f);         //si escuchamos a un humano cerca
        HeardSomething     heardHumanVeryClose = new HeardSomething(soundSensor, "Human", 5f);         //si escuchamos a un  humanos muy cerca
        TouchedGameObjects touchedStone        = new TouchedGameObjects(stonesList, transform, "Sun"); //si tocamos una piedra evolutiva

        evolve = new Evolve2(pokemonData, touchedStone, updateAstarCover, aStar);
        FollowArrived       arrived        = new FollowArrived(followPath, transform);                      //si llegamos al objetivo de follow
        PokemonInCoverPoint otherInMyCover = new PokemonInCoverPoint(aStar, sightSensorPokemon, transform); //si vemos que un pokemon se metio en nuestro escondite

        TimeOut alertTimeOut = new TimeOut(5f);

        setAlertTime = new SetTimer(alertTimeOut);
        TrueCondition alwaysTrue = new TrueCondition();


        //4. TRANSICIONES:

        List <Action> transitionsActions;
        List <Action> noActions = new List <Action>();

        transitionsActions = new List <Action>()
        {
            setAlertTime
        };
        Transition heardCloseHuman     = new Transition(heardHumanClose, transitionsActions, alert);
        Transition seemsSafe           = new Transition(alertTimeOut, noActions, wait);
        Transition heardVeryCloseHuman = new Transition(heardHumanVeryClose, noActions, followCoverPoint);

        transitionsActions = new List <Action>()
        {
        };
        Transition sawAhuman        = new Transition(sawHuman, transitionsActions, followCoverPoint);
        Transition sawAstone        = new Transition(sawStone, transitionsActions, followStone);
        Transition pokemonInMyCover = new Transition(otherInMyCover, transitionsActions, followCoverPoint);

        //transiciones dummy
        transitionsActions = new List <Action>()
        {
            evolve
        };
        Transition evolving1 = new Transition(alwaysTrue, transitionsActions, followCoverPoint);
        Transition evolving2 = new Transition(alwaysTrue, transitionsActions, wait);


        transitionsActions = new List <Action>()
        {
            evolve, removeDefaultSpriteAction, removeRunSpriteAction, removeRunSpriteAction2
        };
        Transition touchStone1 = new Transition(touchedStone, transitionsActions, evolveState1);
        Transition touchStone2 = new Transition(touchedStone, transitionsActions, evolveState2);

        //si evolucionamos debemos quitar las transiciones relacionadas a las stones
        removeSawStone   = new RemoveStateTransition(sawAstone, followCoverPoint);
        removeSawStone2  = new RemoveStateTransition(sawAstone, alert);
        removeTouchStone = new RemoveStateTransition(touchStone1, followCoverPoint);
        transitionsActions.Add(removeSawStone);
        transitionsActions.Add(removeSawStone2);
        transitionsActions.Add(removeTouchStone);

        Transition arrivedFollowEnd = new Transition(arrived, noActions, wait);

        //4.1 AGREGAMOS TRANSICIONES A ESTADOS

        List <Transition> transitions;

        transitions = new List <Transition>()
        {
            sawAhuman, heardCloseHuman
        };
        wait.transitions = transitions;

        transitions = new List <Transition>()
        {
            sawAhuman, sawAstone, heardVeryCloseHuman, seemsSafe
        };
        alert.transitions = transitions;

        transitions = new List <Transition>()
        {
            evolving1
        };
        evolveState1.transitions = transitions;

        transitions = new List <Transition>()
        {
            evolving2
        };
        evolveState2.transitions = transitions;


        transitions = new List <Transition>()
        {
            touchStone1, sawAstone, pokemonInMyCover, arrivedFollowEnd, sawAhuman
        };
        followCoverPoint.transitions = transitions;

        transitions = new List <Transition>()
        {
            touchStone2, arrivedFollowEnd, pokemonInMyCover
        };
        followStone.transitions = transitions;



        //5 MAQUINA DE ESTADOS
        State[] states = new State[] { wait, alert, followCoverPoint, followStone, evolveState1, evolveState2 };
        eeveeMachine = new StateMachine(states, wait);
    }
    }                                                                             // 0x0000000181346AB0-0x0000000181346B00

    public void u0925u0920u091Bu0920u0926u0924u0925u0921u0925u091Eu0920(SoundSensor u0924u0926u0921u091Au091Du091Cu091Du0922u091Eu0924u0920)
    {
    }                                                                                                                                               // 0x00000001813473A0-0x00000001813474F0
    }                                                                                                                                               // 0x00000001813473A0-0x00000001813474F0

    public void u091Eu0920u0926u0928u091Cu091Fu091Bu0924u091Au0927u0929(SoundSensor u0924u0926u0921u091Au091Du091Cu091Du0922u091Eu0924u0920)
    {
    }                                                                                                                                               // 0x00000001813459D0-0x0000000181345AE0
    }                                                                                                                                                                                                      // 0x0000000181345D50-0x0000000181345E80

    public void u0926u0924u091Du091Eu0923u0920u091Au0922u0925u0928u091E(SoundSensor u0924u0926u0921u091Au091Du091Cu091Du0922u091Eu0924u0920)
    {
    }                                                                                                                                               // 0x0000000181347EF0-0x0000000181348070
    public string[] careToHear;//que nos interesa oir

    void Awake()
    {
        sensor = new SoundSensor(transform, threshold, player, careToHear);
    }
Exemple #18
0
 IPhidgetViewModel CreateViewModel(SoundSensor phidget)
 {
     return(new SoundSensorViewModel(phidget));
 }
    }                                                                                                                                               // 0x0000000181346C80-0x0000000181346DD0

    public void u091Fu0921u0927u0926u0926u091Du0924u0924u091Fu0926u091F(SoundSensor u0924u0926u0921u091Au091Du091Cu091Du0922u091Eu0924u0920)
    {
    }                                                                                                                                               // 0x0000000181345B30-0x0000000181345C40
    }                                                                                                                                               // 0x0000000181344FF0-0x0000000181345100

    public void u0924u091Du0927u0924u091Bu0929u0929u0922u0925u0920u0921(SoundSensor u0924u0926u0921u091Au091Du091Cu091Du0922u091Eu0924u0920)
    {
    }                                                                                                                                               // 0x0000000181346C80-0x0000000181346DD0
    }                               // 0x0000000181349100-0x0000000181349170

    // Methods
    public void u0920u0920u0924u091Du0927u091Du0924u0926u0928u0922u0923(SoundSensor u0924u0926u0921u091Au091Du091Cu091Du0922u091Eu0924u0920)
    {
    }                                                                                                                                               // 0x0000000181345FB0-0x00000001813460C0
    }                                                                                                                                               // 0x0000000181344DD0-0x0000000181344EE0

    public void u091Bu091Cu091Au0926u0924u0928u091Bu0920u0928u0924u091D(SoundSensor u0924u0926u0921u091Au091Du091Cu091Du0922u091Eu0924u0920)
    {
    }                                                                                                                                               // 0x0000000181344CC0-0x0000000181344DD0
    }                                                                                                                                               // 0x0000000181347780-0x0000000181347890

    public void u091Bu0922u0924u0926u0929u0925u0926u091Au0925u091Du0925(SoundSensor u0924u0926u0921u091Au091Du091Cu091Du0922u091Eu0924u0920)
    {
    }                                                                                                                                               // 0x0000000181344DD0-0x0000000181344EE0
    }                                                                                                                                               // 0x0000000181347EF0-0x0000000181348070

    public void u0925u0926u091Fu091Cu0927u091Eu0929u0926u091Au091Bu091B(SoundSensor u0924u0926u0921u091Au091Du091Cu091Du0922u091Eu0924u0920)
    {
    }                                                                                                                                               // 0x0000000181347780-0x0000000181347890
    }                                                                             // 0x0000000181347030-0x0000000181347080

    public void u0925u0922u091Cu091Du0928u091Cu091Bu0925u0920u0923u091C(SoundSensor u0924u0926u0921u091Au091Du091Cu091Du0922u091Eu0924u0920)
    {
    }                                                                                                                                               // 0x0000000181347670-0x0000000181347780
    }                                                                                                                                               // 0x00000001813461F0-0x0000000181346320

    public void u091Bu0923u0927u0928u091Bu0920u0924u091Fu0925u091Cu091D(SoundSensor u0924u0926u0921u091Au091Du091Cu091Du0922u091Eu0924u0920)
    {
    }                                                                                                                                               // 0x0000000181344EE0-0x0000000181344FF0
    }                                                                                                                                                                                                      // 0x0000000181347540-0x0000000181347670

    public void u091Eu091Bu091Fu0920u0923u0923u091Eu091Eu0926u091Au0923(SoundSensor u0924u0926u0921u091Au091Du091Cu091Du0922u091Eu0924u0920)
    {
    }                                                                                                                                               // 0x00000001813458C0-0x00000001813459D0
    }                                                                                                                                               // 0x00000001813452D0-0x0000000181345420

    public void u0921u091Cu091Au091Au0923u0925u091Au0927u0922u091Du091B(SoundSensor u0924u0926u0921u091Au091Du091Cu091Du0922u091Eu0924u0920)
    {
    }                                                                                                                                               // 0x00000001813461F0-0x0000000181346320
Exemple #29
0
    // Start is called before the first frame update
    void Start()
    {
        //DATOS EXTERNOS
        smellSensor     = smellSensorScript.sensor;
        soundSensor     = soundSensorScript.sensor;
        kinTrainer      = trainerStaticData.kineticsAgent;
        steeringTrainer = trainerStaticData.steeringAgent;

        //COMENZAMOS A CONSTRUIR LA MAQUINA DE ESTADOS

        //1. ACCIONES:
        ShowIcon    showPoisoned    = new ShowIcon(this.gameObject, "Poisoned");
        DisableIcon disablePoisoned = new DisableIcon(this.gameObject, "Poisoned");
        ShowIcon    showSleep       = new ShowIcon(this.gameObject, "Sleeping");
        DisableIcon disableSleep    = new DisableIcon(this.gameObject, "Sleeping");
        SetTimer    setPoisonClock;
        SetTimer    setSleepClock;
        ResetSensor resetSmellSensor = new ResetSensor(smellSensor);
        ResetSensor resetSoundSensor = new ResetSensor(soundSensor);

        List <ResetSensor> resets = new List <ResetSensor>()
        {
            resetSmellSensor, resetSoundSensor
        };
        ResetSensorList resetAllSensor = new ResetSensorList(resets);

        UpdateMaxSpeed  setOriginalSpeed      = new UpdateMaxSpeed(trainerStaticData, trainerStaticData.maxspeed);
        UpdateMaxSpeed  setSlowSpeed          = new UpdateMaxSpeed(trainerStaticData, poisonedSpeed);
        UpdateMaxSpeed  setZeroSpeed          = new UpdateMaxSpeed(trainerStaticData, 0f);
        SetAngularSpeed setAngularToZero      = new SetAngularSpeed(kinTrainer, 0f);
        SetAngularAccel setAngularAccelToZero = new SetAngularAccel(steeringTrainer, 0f);


        //accion para deshabilitar todos scripts de interes mientras dormimos
        List <DisableScript> disables = new List <DisableScript>();

        foreach (var script in scriptsToDisable)
        {
            disables.Add(new DisableScript(script));
        }
        DisableScriptList disableScripts = new DisableScriptList(disables);

        //accion para habilitar todos los script de interes si despertamos
        List <EnableScript> enables = new List <EnableScript>();

        foreach (var script in scriptsToDisable)
        {
            enables.Add(new EnableScript(script));
        }
        EnableScriptList enableScripts = new EnableScriptList(enables);


        //2. ESTADOS:

        List <Action> entryActions; //aqui iremos guardanndo todas las acciondes de entrada
        List <Action> exitActions;  //aqui iremos guardanndo todas las acciones de salida
        List <Action> actions;      //aqui guardaremos todas las acciones intermedias

        //2.a estado donde estamos sanos

        entryActions = new List <Action>(); //al entrar al estado ponemos un corazon
        actions      = new List <Action>(); //durante el estado perseguimos al enamorado
        exitActions  = new List <Action>(); //al salir quitamos el corazon

        State healthyState = new State(actions, entryActions, exitActions);

        //2.b estado donde estamos envenenados

        entryActions = new List <Action>()
        {
            showPoisoned, setSlowSpeed
        };                                 //al entrar al estado ponemos un corazon
        actions     = new List <Action>(); //durante el estado perseguimos al enamorado
        exitActions = new List <Action>()
        {
            disablePoisoned, resetAllSensor, setOriginalSpeed
        };                                                                                  //al salir quitamos el corazon

        State poisonedState = new State(actions, entryActions, exitActions);

        //2.c estado donde estamos dormidos

        entryActions = new List <Action>()
        {
            showSleep, setZeroSpeed, disableScripts, setAngularAccelToZero, setAngularToZero
        };                             //al entrar al estado ponemos un corazon
        actions = new List <Action>(); //durante el estado perseguimos al enamorado
        //al salir debemos:
        // quitar el icono de dormir, resetear el sensor de sonido, reset el sensor de aroma porque puede haber un sweet
        // volver a habilitar lo que se deba
        exitActions = new List <Action>()
        {
            disableSleep, resetAllSensor, setOriginalSpeed, enableScripts
        };                                                                                              //al salir quitamos el corazon

        State sleepState = new State(actions, entryActions, exitActions);

        //3. CONDICIONES:
        SmelledSomething smelledPoison = new SmelledSomething(smellSensor, "Poison");
        SmelledSomething smelledSweet  = new SmelledSomething(smellSensor, "Sweet");
        HeardSleepSong   heardSong     = new HeardSleepSong(soundSensor);
        TimeOut          poisonClock   = new TimeOut(poisonTimer);

        setPoisonClock = new SetTimer(poisonClock);
        TimeOut sleepClock = new TimeOut(sleepTimer);

        setSleepClock = new SetTimer(sleepClock);



        //4. TRANSICIONES:

        List <Action> noActions = new List <Action>();
        List <Action> transitionActions;


        transitionActions = new List <Action>()
        {
            setPoisonClock
        };
        Transition gotPoisoned   = new Transition(smelledPoison, transitionActions, poisonedState);
        Transition poisonTimeOut = new Transition(poisonClock, noActions, healthyState);
        Transition sweetScent    = new Transition(smelledSweet, noActions, healthyState);

        transitionActions = new List <Action>()
        {
            setSleepClock
        };
        Transition gotSlept     = new Transition(heardSong, transitionActions, sleepState);
        Transition sleepTimeOut = new Transition(sleepClock, noActions, healthyState);



        //4.1 AGREGAMOS TRANSICIONES A ESTADOS
        List <Transition> transitions;

        transitions = new List <Transition>()
        {
            gotPoisoned, gotSlept
        };;
        healthyState.transitions = transitions;

        poisonedState.transitions = new List <Transition>()
        {
            poisonTimeOut, sweetScent
        };

        sleepState.transitions = new List <Transition>()
        {
            sleepTimeOut, sweetScent
        };

        //5 MAQUINA DE ESTADOS
        State[] states = new State[] { healthyState, poisonedState, sleepState };
        trainerStatusMachine = new StateMachine(states, healthyState);
    }
    }                                                                                                                                                                                                      // 0x0000000181345530-0x0000000181345630

    public void u091Bu0924u0924u0928u091Eu091Cu091Du0928u0927u091Du091C(SoundSensor u0924u0926u0921u091Au091Du091Cu091Du0922u091Eu0924u0920)
    {
    }                                                                                                                                               // 0x0000000181344FF0-0x0000000181345100
    }                                                                                                                                               // 0x0000000181345FB0-0x00000001813460C0

    public void u0923u091Eu091Eu0924u0929u0926u091Fu091Au091Bu0925u0925(SoundSensor u0924u0926u0921u091Au091Du091Cu091Du0922u091Eu0924u0920)
    {
    }                                                                                                                                               // 0x00000001813464A0-0x00000001813465F0