private void Awake()
        {
            current_command_time = DateTime.Now;
            last_command_time = DateTime.Now;
            working_directory = Directory.GetCurrentDirectory();

            if (Process.GetProcessesByName("speech_recognition").Length == 0) {
                _speech = new Process();
                _speech.StartInfo.CreateNoWindow = true;
                _speech.StartInfo.FileName = working_directory + "/SpeechRecognition/bin/speech_recognition.exe";
                _speech.StartInfo.RedirectStandardOutput = true;
                _speech.StartInfo.UseShellExecute = false;
                _speech.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;

                _speech.OutputDataReceived += (sender, args) => {
                        if (args.Data.Contains("Voce") == false) {
                                _command = args.Data;
                                _command = _command.Replace("\n", "");
                                _command = _command.Replace("\r", "");
                                current_command_time = DateTime.Now;
                        }
                };

                _speech.Start();
                _speech.BeginOutputReadLine();
                UnityEngine.Debug.Log("Starting speech recognition");
            }

            player = GameObject.Find("Player").GetComponent<Player>();
        }
    protected override void OnCantMove <T>(T component)
    {
        Completed.Player hitplayer = component as Completed.Player;

        animator.SetTrigger("enemyAttack");
        SoundManager.instance.RandomizeSFX(enemyattack1, enemyattack2);
        hitplayer.LoseFood(playerDamage);
    }
示例#3
0
    // Use this for initialization
    void Start()
    {
        preguntas = GameObject.Find("Preguntas").GetComponent <Canvas>();

        player = GameObject.FindObjectOfType <Completed.Player>();
    }
示例#4
0
	// Use this for initialization
	void Start () {
		playerInstance = GetComponent<Completed.Player> ();
		//position = new Vector2 (transform.localPosition.x, transform.localPosition.y);
	}
示例#5
0
        private Player playerCtrl; //Reference to the Player script.

        #endregion Fields

        #region Methods

        void Awake()
        {
            // Setting up the references.
            playerCtrl = transform.root.GetComponent<Player>();
        }
示例#6
0
        //Initializes the game for each level.
        void InitGame()
        {
            //While doingSetup is true the player can't move, prevent player from moving while title card is up.
            //doingSetup = true;

            playerobject = GameObject.Find("Player");
            player = playerobject.GetComponent<Player> ();

            manaIcon = GameObject.Find ("ManaImage").GetComponent<Image> ();
            healthIcon = GameObject.Find ("HealthImage").GetComponent<Image> ();

            turnTimer =  GameObject.Find ("TurnTimer").GetComponent<Slider>();

            alertText = GameObject.Find ("AlertText").GetComponent<Text> ();

            hideUI ();

            //Get a reference to our image LevelImage by finding it by name.
            levelImage = GameObject.Find("LevelImage");

            //Get a reference to our text LevelText's text component by finding it by name and calling GetComponent.
            levelText = GameObject.Find("LevelText").GetComponent<Text>();

            //Set the text of levelText to the string "Day" and append the current level number.
            levelText.text = "Level " + level;

            //Set levelImage to active blocking player's view of the game board during setup.
            levelImage.SetActive(true);

            //Call the HideLevelImage function with a delay in seconds of levelStartDelay.
            Invoke("HideLevelImage", levelStartDelay);

            //Clear any Enemy objects in our List to prepare for next level.
            enemies.Clear();

            //Call the SetupScene function of the BoardManager script, pass it current level number.
            boardScript.SetupScene(level);
        }
示例#7
0
 public abstract void Use(Completed.Player player);
示例#8
0
 public void removePlayer(Player dead, int team)
 {
     if (team == 0)
     {
         bluePlayer.Remove(dead);
         if (bluePlayer.Count == 0)
         {
             showEndState();
         }
     }
     else
     {
         redPlayer.Remove(dead);
         if (redPlayer.Count == 0)
         {
             showEndState();
         }
     }
 }
示例#9
0
        public IEnumerator ShopSequence()
        {
            shopping = true;
            shopImage = GameObject.Find ("Shop");
            infoPanel = GameObject.Find ("Infopanel");
            payObject = GameObject.Find ("PayButton");
            payButton = payObject.GetComponent<Button>();
            player = GameObject.Find ("Player").GetComponent<Player>();

            moneyText = GameObject.Find ("MoneyText").GetComponent<Text> ();
            foodText = GameObject.Find ("ShopFoodText").GetComponent<Text> ();
            damageText = GameObject.Find ("DamageText").GetComponent<Text> ();

            moneyText.text = "$: " + money;
            damageText.text = "dmg: " + playerEnemyDamage;
            foodText.text = "Mate: " + playerFoodPoints;

            for (int i = 3; i <=5; i++) {
                itemsToDisplay[i] = false; // Reset the reusable food items
            }
            //Stones
            stones = GameObject.Find ("Stones");
            stonesButton = stones.GetComponent<Button> ();
            stonesButton.onClick.AddListener(()=>
            {
                openInfoPanel(infoPanel,payObject, 0);
            });

            //BrokenMateItem
            brokenMate = GameObject.Find ("BrokenMate");
            brokenMateButton = brokenMate.GetComponent<Button> ();
            brokenMateButton.onClick.AddListener(()=>
            {
                openInfoPanel(infoPanel,payObject, 1);
            });

            //TriangleOfDoom
            triangleOfDoom = GameObject.Find ("TriangleOfDoom");
            triangleOfDoomButton = triangleOfDoom.GetComponent<Button> ();
            triangleOfDoomButton.onClick.AddListener(()=>
            {
                openInfoPanel(infoPanel,payObject, 2);
            });
            //Glass of Mate
            glassMateButton = GameObject.Find ("GlassMate").GetComponent<Button>();
            glassMateButton.onClick.AddListener (() =>
            {
                openInfoPanel (infoPanel, payObject, 3);
                //Debug.Log ("food: "+ playerFoodPoints);
            });

            halfMateButton = GameObject.Find ("HalfMate").GetComponent<Button>();
            halfMateButton.onClick.AddListener (() =>
            {
                        openInfoPanel (infoPanel, payObject, 4);
            });
            fullMateButton = GameObject.Find ("FullMate").GetComponent<Button>();
            fullMateButton.onClick.AddListener (() =>
            {
                        openInfoPanel (infoPanel, payObject, 5);
            });
            if (itemsToDisplay [0]) {
                stonesButton.interactable = false;
            }
            if (itemsToDisplay [1]) {
                brokenMateButton.interactable = false;
            }
            if (itemsToDisplay [2]) {
                triangleOfDoomButton.interactable = false;
            }

            shopImage.SetActive (false);

            levelImage = GameObject.Find("LevelImage");

            //Get a reference to our text LevelText's text component by finding it by name and calling GetComponent.
            levelText = GameObject.Find("LevelText").GetComponent<Text>();

            //Set the text of levelText to the string "Day" and append the current level number.
            levelText.text = "Stage "+level;

            //Set levelImage to active blocking player's view of the game board during setup.
            levelImage.SetActive(true);
            FindHighScoreObjects ();
            DisableHighScoreObjects ();

            yield return new WaitForSeconds(2);
            levelText.text = "";
            infoPanel.SetActive (false);
            shopImage.SetActive(true);

            shopping = false;
        }