Esempio n. 1
0
        public override void Initialise()
        {
            base.Initialise();

            camera = GameManager.tiltCamera.GetComponentsInParent <Transform>()[1];
            temp   = GameManager.activeArena.transform;

            // Set voice commands (functions) for relevant intents
            VoiceCommands voiceCommands = settings.voiceCommands;

            _voiceActions.Add("tilt", () => voiceCommands.TiltShrineTilt(incomingEntities, inputText, camera));
            _voiceActions.Add("reset", () => voiceCommands.TiltShrineReset(settings.playerControls.TiltShrine));
            _voiceActions.Add("rotate", () => voiceCommands.TiltShrineRotate(incomingEntities, inputText, camera));
            _voiceActions.Add("look", () => voiceCommands.TiltShrineRotate(incomingEntities, inputText, camera));
            _voiceActions.Add("skip", () => Skip());

            // Tilt
            settings.playerControls.TiltShrine.Tilt.performed += ctx => tilt = ctx.ReadValue <Vector2>();
            settings.playerControls.TiltShrine.Tilt.canceled  += _ => tilt = Vector2.zero;

            // Rotate
            settings.playerControls.TiltShrine.Rotate.performed += ctx => rotate = ctx.ReadValue <Vector2>();
            settings.playerControls.TiltShrine.Rotate.canceled  += _ => rotate = Vector2.zero;

            // Reset & Skip
            settings.playerControls.TiltShrine.Reset.performed += ctx => voiceCommands.TiltShrineReset(settings.playerControls.TiltShrine);
            settings.playerControls.TiltShrine.Skip.performed  += ctx => Skip();

            Enable();
        }
Esempio n. 2
0
        private void Fire()
        {
            GameManager.rtWaypoint.positiveAction.onClick.Invoke();
            VoiceCommands voiceCommands = settings.voiceCommands;

            voiceCommands.DisableActionTemporarily(settings.playerControls.RingToss.Fire, 2f);
        }
Esempio n. 3
0
        // Need to attach voice commands to an object because
        // coroutines can only be called if attached to an object,
        private void SetUpVoiceCommands()
        {
            GameObject obj = new GameObject("Voice Commands");

            obj.AddComponent <VoiceCommands>();
            voiceCommands        = obj.GetComponent <VoiceCommands>();
            voiceCommands.player = this.gameObject;
            // Only reliable way of getting the camera in awake, GameManger.cs does not have it yet.
            voiceCommands.cam = Camera.main;
        }
Esempio n. 4
0
        private void Awake()
        {
            if (_instance != null && _instance != this)
            {
                Destroy(this.gameObject);
            }
            else
            {
                _instance = this;

                // We use the target for pathfinding so get a reference to it here.
                // Not the most efficient way, but only done once so overhead is not bad.
                target = GameObject.FindGameObjectWithTag("Target").transform;
            }
        }
Esempio n. 5
0
        // Complete constructor
        public Settings(GameObject player, ref VoiceCommands voiceCommands, PlayerPhysics playerPhysics, ref CharacterController characterController, AgentMovement agentMovement,
                        ref NavMeshAgent navMeshAgent, float speed, float sens, Camera main, PlayerControls controls, PlayerUISetUp ui)
        {
            this.player              = player;
            this.voiceCommands       = voiceCommands;
            this.playerPhysics       = playerPhysics;
            this.characterController = characterController;
            this.agentMovement       = agentMovement;
            this.navMeshAgent        = navMeshAgent;
            playerUI = ui;

            playerControls = controls;

            // Other settings
            this.navMeshAgent.speed = speed;
            runSpeed    = speed;
            sensitivity = sens;
            cam         = main;
        }
Esempio n. 6
0
        public override void Initialise()
        {
            base.Initialise();

            VoiceCommands voiceCommands = settings.voiceCommands;

            // Set voice commands actions
            _voiceActions.Add("move", () => voiceCommands.Move(incomingEntities, inputText));
            _voiceActions.Add("look", () => voiceCommands.Look(incomingEntities, inputText));
            _voiceActions.Add("zoom", () => VoiceZoom(incomingEntities));
            _voiceActions.Add("jump", () => Jump());
            _voiceActions.Add("interact", () => Interact());

            // Movement
            settings.playerControls.DefaultGameplay.Move.performed       += ctx => move = ctx.ReadValue <Vector2>();
            settings.playerControls.DefaultGameplay.Move.canceled        += _ => move = Vector2.zero;
            settings.playerControls.DefaultGameplay.TriggerRun.performed += _ => run = true;
            settings.playerControls.DefaultGameplay.TriggerRun.canceled  += _ => run = false;
            speed = settings.runSpeed;

            // Look & Zoom
            settings.playerControls.DefaultGameplay.Look.performed     += ctx => look = ctx.ReadValue <Vector2>();
            settings.playerControls.DefaultGameplay.Look.canceled      += _ => look = Vector2.zero;
            settings.playerControls.DefaultGameplay.ZoomHold.performed += _ => zoom = true;
            settings.playerControls.DefaultGameplay.ZoomHold.canceled  += _ => zoom = false;
            settings.playerControls.DefaultGameplay.ZoomTap.performed  += _ => zoom = !zoom;
            zoom = false;

            // Jump
            settings.playerControls.DefaultGameplay.Jump.performed += _ => Jump();

            // Interaction
            settings.playerControls.DefaultGameplay.Interact.performed += _ => Interact();

            // Disable the navMeshAgent component and enable the default gameplay action map
            settings.navMeshAgent.enabled = false;

            // Enable the default action map
            Enable();
        }
Esempio n. 7
0
 // Simplified constructor
 /// <summary>
 /// Simplified constructor only requiring the camera and player controls.
 /// Used only for prototyping control states for new minigames.
 /// </summary>
 public Settings(Camera main, PlayerControls controls, ref VoiceCommands voiceCommands)
 {
     cam                = main;
     playerControls     = controls;
     this.voiceCommands = voiceCommands;
 }