Example #1
0
    protected override void OnCreate()
    {
        commandBufferSystem         = World.GetOrCreateSystem <EndSimulationEntityCommandBufferSystem>();
        nearbyIntersectionQueryDesc = new EntityQueryDesc { // define query for the 'find nearest intersection'
            All = new ComponentType[] {
                ComponentType.ReadOnly <Translation>(),
                ComponentType.ReadOnly <PoliceUnitComponent>(),
                ComponentType.ReadOnly <PoliceUnitTargetNearestIntersection>(),
            }
        };

        addFindIntersectionQueryDesc = new EntityQueryDesc { // define query for the 'find nearest intersection'
            All = new ComponentType[] {
                ComponentType.ReadOnly <Translation>(),
                ComponentType.ReadOnly <PoliceUnitComponent>(),
                ComponentType.ReadOnly <SelectedPoliceUnit>(),
            }
        };

        toldToFindIntersection = false;

        //Obtain Voice Controller - There should only be one
        PoliceUnitVoiceController[] voiceControllers = Object.FindObjectsOfType <PoliceUnitVoiceController>();
        if (voiceControllers.Length > 0)
        {
            PoliceUnitVoiceController voiceController = voiceControllers[0]; // grab the voice controller if there is one
            voiceController.OnMoveToIntersectionCommand += VoiceFindIntersectionResponse;
        }

        base.OnCreate();
    }
    protected override void OnCreate()
    {
        //Mouse click controls set up
        mouseEventTriggered = false;
        minX = 0;
        maxX = 0;
        minZ = 0;
        maxZ = 0;
        commandBufferSystem = World.GetOrCreateSystem <EndSimulationEntityCommandBufferSystem>();

        World.GetOrCreateSystem <UIController>().OnLeftMouseClick += LeftClickResponse;


        //Voice controller set up
        voiceSelectUnitEventTriggered = false;
        selectedUnitName = new NativeArray <FixedString64>(1, Allocator.Persistent);

        voiceSelectAllUnitsEventTriggered = false;

        voiceDeselectAllUnitsEventTriggered = false;

        //Obtain Voice Controller - There should only be one
        PoliceUnitVoiceController[] voiceControllers = UnityEngine.Object.FindObjectsOfType <PoliceUnitVoiceController>();
        if (voiceControllers.Length > 0)
        {
            PoliceUnitVoiceController voiceController = voiceControllers[0]; // grab the voice controller if there is one
            voiceController.OnPoliceUnitSelectionCommand += VoicePoliceSelectionResponse;
            voiceController.OnDeselectPoliceUnitsCommand += VoicePoliceDeselectionResponse;
        }

        selectSingleUnitQueryDesc = new EntityQueryDesc { // define query for selecting a single police unit
            All = new ComponentType[] {
                ComponentType.ReadOnly <PoliceUnitComponent>(),
                ComponentType.ReadOnly <PoliceUnitName>()
            }
        };

        selectAllUnitsQueryDesc = new EntityQueryDesc { // define query for selecting a single police unit
            All = new ComponentType[] {
                ComponentType.ReadOnly <PoliceUnitComponent>()
            },
            None = new ComponentType[] {
                ComponentType.ReadOnly <SelectedPoliceUnit>()
            }
        };

        deselectAllUnitsQueryDesc = new EntityQueryDesc { // define query for selecting a single police unit
            All = new ComponentType[] {
                ComponentType.ReadOnly <PoliceUnitComponent>(),
                ComponentType.ReadOnly <SelectedPoliceUnit>()
            }
        };

        //base.OnCreate();
    }
Example #3
0
 public void ConnectToVoiceController()
 {
     //Obtain Voice Controller - There should only be one
     PoliceUnitVoiceController[] voiceControllers = Object.FindObjectsOfType <PoliceUnitVoiceController>();
     if (voiceControllers.Length > 0)
     {
         PoliceUnitVoiceController voiceController = voiceControllers[0]; // grab the voice controller if there is one
         voiceController.OnMoveForwardCommand += VoiceMoveForwardResponse;
         voiceController.OnRotateCommand      += VoiceRotateResponse;
     }
 }
    //private bool changedToWedge = false;

    //private float wedgeDelay = 3f;

    #endregion

    // Approach, box, repel, go to exit, end


    // Start is called before the first frame update
    private void Start()
    {
        cam.SetTarget(policeUnit);
        //World.DefaultGameObjectInjectionWorld.GetOrCreateSystem<CrowdCountingSystem>().NoCrowdLeftEvent += RepelledRiotersResponse;

        PoliceUnitVoiceController[] voiceControllers = UnityEngine.Object.FindObjectsOfType <PoliceUnitVoiceController>();
        if (voiceControllers.Length > 0)
        {
            PoliceUnitVoiceController voiceController = voiceControllers[0]; // grab the voice controller if there is one
            voiceController.OnTo3SidedBoxVoiceCommand           += VoiceToBoxResponse;
            voiceController.OnToParallelTightCordonVoiceCommand += VoiceToCordonResponse;
        }

        World.DefaultGameObjectInjectionWorld.GetOrCreateSystem <PoliceUnitRemoveMovementSystem>().ConnectToPrototypeManager();

        UpdateDisplayText(approachTextBlocks);
    }
    //Wedge, parallel loose cordon, box, tight cordon, rotate left, rotate right, first halt, move forward, second halt, end tutorial


    // Start is called before the first frame update
    private void Start()
    {
        cam.SetTarget(policeUnit);

        PoliceUnitVoiceController[] voiceControllers = Object.FindObjectsOfType <PoliceUnitVoiceController>();
        if (voiceControllers.Length > 0)
        {
            PoliceUnitVoiceController voiceController = voiceControllers[0]; // grab the voice controller if there is one
            voiceController.OnToWedgeVoiceCommand += VoiceToWedgeResponse;
            voiceController.OnToParallelLooseCordonVoiceCommand += VoiceToParaLooseCordonResponse;
            voiceController.OnTo3SidedBoxVoiceCommand           += VoiceToBoxResponse;
            voiceController.OnToParallelTightCordonVoiceCommand += VoiceToParaTightCordonResponse;
            voiceController.OnRotateCommand      += VoiceRotateResponse;
            voiceController.OnHaltCommand        += VoiceHaltResponse;
            voiceController.OnMoveForwardCommand += VoiceMoveForwardResponse;
        }
        UpdateDisplayText(rotateCameraTextBlocks);
    }