// LoseFood is called when an enemy attacks the player.
        // It takes a parameter loss which specifies how many points to lose.
        public void LoseHealth(int loss)
        {
            // Set the trigger for the player animator to transition to the
            // playerHit animation.
            // TODO: play an animation or sound when hit!

            if (Player.Score >= 0)
            {
                // Subtract lost food points from the players total.
                PlayerInfo.AddScore(player.DeviceId, -loss);
                GameManager.Instance.OnScoreChanged(player.DeviceId);
            }

            // Check to see if game has ended.
            CheckIfDead();
        }
        // OnTriggerEnter2D is sent when another object enters a trigger
        // collider attached to this object (2D physics only).
        private void OnTriggerEnter2D(Collider2D other)
        {
            // Check if the tag of the trigger collided with is Exit.
            if (other.tag == "exit")
            {
                // Invoke the Restart function to start the next level with
                // a delay of restartLevelDelay (default 1 second).
                Invoke("Restart", restartLevelDelay);

                // Disable the player object since level is over.
                enabled = false;
            }
            else if (other.tag == "powerup")
            {
                // Check if the tag of the trigger collided with is Food.
                // Add pointsPerFood to the players current total.
                PlayerInfo.AddScore(player.DeviceId, pointsPerCoin);
                GameManager.Instance.OnScoreChanged(player.DeviceId);

                // Disable the food object the player collided with.
                other.gameObject.SetActive(false);
                GameManager.Instance.OnObjectChanged(
                    other.gameObject.GetComponent <Shareable>());
            }
            else if (other.tag == "gem")
            {
                // Check if the tag of the trigger collided with is a gem.
                // Add pointsPerSoda to players food points total
                PlayerInfo.AddScore(player.DeviceId, pointsPerGem);
                GameManager.Instance.OnScoreChanged(player.DeviceId);

                // Disable the object the player collided with.
                other.gameObject.SetActive(false);
                GameManager.Instance.OnObjectChanged(
                    other.gameObject.GetComponent <Shareable>());
            }
            else if (other.tag == "deadly")
            {
                // Check if the tag of the trigger collided with is Exit.
                LoseHealth(20);
            }
        }