Exemple #1
0
    // Use this for initialization
    void Start()
    {
        Text myText = GetComponent <Text>();

        myText.text = ScoreKeeping.score.ToString();
        ScoreKeeping.Reset();
    }
Exemple #2
0
    void OnLevelWasLoaded(int level)
    {
        scoreKeepingScript = GameObject.Find("World").GetComponent <ScoreKeeping> ();
        scoreKeepingScript.resetHitsForHole();
        if (Application.loadedLevelName.Equals("StartF"))
        {
            devControlCanvas.gameObject.SetActive(false);
        }
        else
        {
            devControlCanvas.gameObject.SetActive(true);
        }

        transform.FindChild("Canvas").GetComponent <Canvas> ().worldCamera = Camera.main;
        mouseOverUI = false;
        addObstacles();
        if (currentLevel <= 20)
        {
            currentMaterial = coloredLevels;
        }
        else
        {
            currentMaterial = dashedLines;
        }
        setMaterialType(currentMaterial);
    }
Exemple #3
0
 private void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
 }
	// Use this for initialization
	void Start () {
		player1 = GameObject.Find("Player1");
		player2 = GameObject.Find("Player2");
		racket1 = GameObject.Find ("racket_p1");
		transform.position = racket1.transform.position;
		scoreKeeper = GameObject.Find("ScoreKeeper").GetComponent<ScoreKeeping>();
	}
 // Use this for initialization
 void Start()
 {
     player1            = GameObject.Find("Player1");
     player2            = GameObject.Find("Player2");
     racket1            = GameObject.Find("racket_p1");
     transform.position = racket1.transform.position;
     scoreKeeper        = GameObject.Find("ScoreKeeper").GetComponent <ScoreKeeping>();
 }
        public IHttpActionResult GetGame(int id)
        {
            var user = UserController.Players.FirstOrDefault((p) => p.ID == id);

            if (user == null)
            {
                return(NotFound());
            }

            //end game
            if (Gameplay.Pass_Count >= UserController.Players.Count)
            {
                string endgameString = "The game has ended. Final Scores:\n";


                if (!ScoreKeeping.endgame)
                {
                    foreach (Player p in UserController.Players)
                    {
                        p.Score -= p.Letters.Count * 5;
                    }
                    ScoreKeeping.LogEndGame();
                    ScoreKeeping.endgame = true;
                }

                foreach (Player p in UserController.Players)
                {
                    endgameString += "Player " + p.ID + ": " + p.Score + "\n";
                }
                Player winner = UserController.Players.Find(q => q.Score == UserController.Players.Max(p => p.Score));
                endgameString += "The winner is Player " + winner.ID + "!";



                return(Ok(endgameString));
            }
            Status report = new Status();

            report.Letters = user.Letters;
            report.Score   = user.Score;
            try
            {
                if (Request.Headers.GetValues("Hash").ElementAt(0).ToString().Equals(user.Hash))
                {
                    return(Ok(report));

                    //Add code to return Game data and Player data
                }
            }
            catch
            {
                Ok("User Auth Failed");
            }

            return(Ok("User Auth Failed"));
        }
    void Start()
    {
        alive      = true;
        timePassed = Time.time;

        SetDirection();
        SetMovementTime();
        scoreKeeping = GameObject.FindGameObjectWithTag("Player").GetComponent <ScoreKeeping>();
        scoreTimer  += Time.deltaTime;
    }
Exemple #8
0
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
         DontDestroyOnLoad(this.gameObject);
     }
     else
     {
         Destroy(gameObject);
     }
 }
Exemple #9
0
    void Start()
    {
        scoreKeeping = GameObject.FindGameObjectWithTag("Score").GetComponent <ScoreKeeping>();
        gm           = GameObject.FindGameObjectWithTag("GM").GetComponent <GM>();
        rend         = GetComponent <SpriteRenderer>();
        cracks       = GameObject.FindGameObjectWithTag("Cracks").GetComponent <Animator>();
        camAnim      = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <Animator>();

        int randColor = Random.Range(0, colors.Length);

        rend.color = colors[randColor];
    }
 void Start()
 {
     arrowHead.sizeDelta = new Vector2 (arrowHead.rect.width * ARROW_HEAD_SCALE_COEFFICIENT, arrowHead.rect.height * ARROW_HEAD_SCALE_COEFFICIENT);
     arrowTail.sizeDelta = new Vector2 (arrowTail.rect.width, arrowTail.rect.height * ARROW_TAIL_SCALE_COEFFICIENT);
     scoreKeepingScript = GameObject.Find ("World").GetComponent<ScoreKeeping> ();
     ballManagerScript = GetComponent<BallManager> ();
     cameraFollowScript = camera3D.GetComponent<CameraFollow> ();
     levelManage = GameObject.Find ("LevelManager");
     levelManagerScript = levelManage == null ? null : levelManage.GetComponent<LevelManager> ();
     arrowTailRenderer = arrowTail.GetComponent<CanvasRenderer> ();
     arrowTailRenderer.SetMaterial (arrowTailShader, null);
     distance = 0;
     arrowScalePercent = 0;
     overUI = false;
 }
Exemple #11
0
 void Start()
 {
     arrowHead.sizeDelta = new Vector2(arrowHead.rect.width * ARROW_HEAD_SCALE_COEFFICIENT, arrowHead.rect.height * ARROW_HEAD_SCALE_COEFFICIENT);
     arrowTail.sizeDelta = new Vector2(arrowTail.rect.width, arrowTail.rect.height * ARROW_TAIL_SCALE_COEFFICIENT);
     scoreKeepingScript  = GameObject.Find("World").GetComponent <ScoreKeeping> ();
     ballManagerScript   = GetComponent <BallManager> ();
     cameraFollowScript  = camera3D.GetComponent <CameraFollow> ();
     levelManage         = GameObject.Find("LevelManager");
     levelManagerScript  = levelManage == null ? null : levelManage.GetComponent <LevelManager> ();
     arrowTailRenderer   = arrowTail.GetComponent <CanvasRenderer> ();
     arrowTailRenderer.SetMaterial(arrowTailShader, null);
     distance          = 0;
     arrowScalePercent = 0;
     overUI            = false;
 }
    private void Start()
    {
        int scoresToEnter = 0;

        if (ScoreKeeping.IsNewHighScore(ScoreKeeping.currentPlayerScores[0]))
        {
            scoresToEnter++;
        }

        if (ScoreKeeping.IsNewHighScore(ScoreKeeping.currentPlayerScores[2]))
        {
            scoresToEnter++;
        }

        highScoresEntered = new bool[scoresToEnter];
    }
    void Start()
    {
        GameObject earth  = GameObject.FindGameObjectWithTag("Earth");
        GameObject player = GameObject.FindGameObjectWithTag("Player");

        playerHealth = player.GetComponent <PlayerHealth>();
        playerWeapon = player.GetComponent <PlayerWeapon>();
        scoreKeeping = player.GetComponent <ScoreKeeping>();
        earthHealth  = earth.GetComponent <EarthHealth>();
        upgradeMenu  = gameObject.GetComponent <UpgradeMenu>();

        if (upgradeMenu != null)
        {
            RefreshTexts();
            ToggleUpgradeButtons();
        }
    }
Exemple #14
0
 void OnGameOver()
 {
     Cursor.visible = true;
     StartCoroutine(Fade(Color.clear, new Color(0, 0, 0, 0.985f), 1));
     healthBar.transform.parent.gameObject.SetActive(false);
     OnEnterLevel();
     itemDropCounter.gameObject.SetActive(false);
     gameOverUI.SetActive(true);
     gameOverScoreUI.text     = ScoreKeeping.kills + "";
     gameOverHighScoreUI.text = ScoreKeeping.GetMostKills() + "";
     if (ScoreKeeping.IsHighestScore())
     {
         StartCoroutine(FlashingText());
     }
     else
     {
     }
 }
    private void Awake()
    {
        MLInput.Start();
        spawnMngr    = GetComponent <SpawnManager>();
        audioManager = GameObject.Find("AudioManager").GetComponent <AudioManager>();
        scoreKeeping = GameObject.Find("[Content]/Controller").GetComponent <ScoreKeeping>();
        trailAndBall = spawnMngr.trailAndBall.GetComponent <DisplayTrailAndBall>();
        _control     = MLInput.GetController(MLInput.Hand.Left);

        scoreText.enabled      = false;
        summaryText.enabled    = false;
        statusText.enabled     = false;
        helpText.enabled       = false;
        beamController.enabled = false;
        spawnMngr.enabled      = false;
        menu.SetActive(false);
        canvas.SetActive(false);
        settings.SetActive(false);

        // update setting text to reflect current settings
        pathOn = trailAndBall.trails[0].activeSelf;
        if (GameObject.Find("[Content]/MLSpatialMapper/Original").GetComponent <Renderer>().material.mainTexture == null)
        {
            meshOn = false;
        }
        else
        {
            meshOn = true;
        }


        foreach (SettingType type in Enum.GetValues(typeof(SettingType)))
        {
            SetSettingText(type);
        }

        Playspace.Instance.OnCompleted.AddListener(OnPlayspaceComplete);
        Playspace.Instance.OnCleared.AddListener(OnPlayspaceClear);
        MLInput.OnControllerButtonUp  += OnButtonUp;
        scoreKeeper.ScoreChange       += OnScoreChange;
        beamController.OptionSelected += OnOptionSelected;

        wallStat = WallStat.Empty;
    }
	public bool sideAgnosticOOB; // Does this OOB object care about sides?

	// Use this for initialization
	void Start () {
		// Find and assign the scripts OOBDetection needs to talk to
		scoreKeeping = GameObject.Find ("ScoreKeeper").GetComponent<ScoreKeeping> ();
		endOfRound = GameObject.Find ("EndOfRound").GetComponent<EndOfRound> ();

		// An OOB object cannot be on both sides of the court, if so print error
		if (leftSideOfCourt == true && rightSideOfCourt == true) {
			Debug.LogError("ERROR: This OOB object: " + transform.name + ", is marked as being on both sides of the court, you dunce.");
		}

		// If this OOB object has been marked as side agnostic, it cannot have side assignments
		if (sideAgnosticOOB == true){
			if (leftSideOfCourt == true || rightSideOfCourt == true){
				leftSideOfCourt = false;
				rightSideOfCourt = false;
				Debug.LogWarning("WARN: This OOB object: " + transform.name + ", has been marked as side agnostic.");
			}
		}
	}
Exemple #17
0
    /// <summary>
    /// Loops through return of GameOBject.FindObjecstWithTag for tag Block and unhides them.
    /// Also re assigns original transform to paddle and ball. Will also reset velocity of ball to zero.
    /// </summary>
    public void ResetGame()
    {
        foreach (GameObject go in goArray)
        {
            go.SetActive(true);
        }
        Rigidbody2D rb2D = Ball.GetComponent <Rigidbody2D>();

        rb2D.velocity = Vector2.zero;
        ScoreKeeping scoreKeep = GameObject.Find("_Keepers").GetComponent <ScoreKeeping>();

        scoreKeep.ResetScore();

        Paddle.transform.position = new Vector2(0.0f, -3.5f);
        Ball.transform.position   = new Vector2(0, 1.75f);

        MenuSystem menSys = GameObject.Find("_Keepers").GetComponent <MenuSystem>();

        menSys.UnPause();
    }
Exemple #18
0
    // Use this for initialization
    void Start()
    {
        // zero out total rocks delivered for this round
        NumberOfRocksPlayer1Delivered = 0;
        NumberOfRocksPlayer2Delivered = 0;
        GameStarted = false;
        LevelEnded  = false;
        // make first carrying rock nothing
        Astronaut1CarryingRock.mainTexture = RockTextures[0];
        Astronaut2CarryingRock.mainTexture = RockTextures[0];
        // put this round's rocks on the ground
        for (int i = 0; i < Astronaut1GroundRocks.Length; i++)
        {
            Astronaut1GroundRocks [i].mainTexture = RockTextures [i + 1];
        }
        for (int i = 0; i < Astronaut1GroundRocks.Length; i++)
        {
            Astronaut2GroundRocks [i].mainTexture = RockTextures [i + 1];
        }
        // adjust gravity
        if (Planet == "Moon")
        {
            Physics.gravity = new Vector3(0, -1.622f, 0);
        }
        else if (Planet == "Mars")
        {
            Physics.gravity = new Vector3(0, -3.711f, 0);
        }
        else if (Planet == "Venus")
        {
            Physics.gravity = new Vector3(0, -8.87f, 0);
        }


        Score = GameObject.Find("Score");

        if (Score != null)
        {
            scoreScript = (ScoreKeeping)Score.GetComponent(typeof(ScoreKeeping));
        }
    }
Exemple #19
0
    public bool sideAgnosticOOB;       // Does this OOB object care about sides?

    // Use this for initialization
    void Start()
    {
        // Find and assign the scripts OOBDetection needs to talk to
        scoreKeeping = GameObject.Find("ScoreKeeper").GetComponent <ScoreKeeping> ();
        endOfRound   = GameObject.Find("EndOfRound").GetComponent <EndOfRound> ();

        // An OOB object cannot be on both sides of the court, if so print error
        if (leftSideOfCourt == true && rightSideOfCourt == true)
        {
            Debug.LogError("ERROR: This OOB object: " + transform.name + ", is marked as being on both sides of the court, you dunce.");
        }

        // If this OOB object has been marked as side agnostic, it cannot have side assignments
        if (sideAgnosticOOB == true)
        {
            if (leftSideOfCourt == true || rightSideOfCourt == true)
            {
                leftSideOfCourt  = false;
                rightSideOfCourt = false;
                Debug.LogWarning("WARN: This OOB object: " + transform.name + ", has been marked as side agnostic.");
            }
        }
    }
 // Use this for initialization
 void Start()
 {
     Score       = GameObject.Find("Score");
     scoreScript = (ScoreKeeping)Score.GetComponent(typeof(ScoreKeeping));
 }
Exemple #21
0
 void Awake()
 {
     rb2d        = gameObject.GetComponent <Rigidbody2D>();
     ballSpawner = GameObject.Find("Players");
     UI          = GameObject.Find("Score").GetComponent <ScoreKeeping>();
 }
Exemple #22
0
 private void Start()
 {
     rb = GetComponent <Rigidbody>();
     sk = GetComponent <ScoreKeeping>();
 }
Exemple #23
0
 void Start()
 {
     anim  = GetComponent <Animator>();
     score = GameObject.FindGameObjectWithTag("Score").GetComponent <ScoreKeeping>();
 }
 void Start()
 {
     scoreKeeper = GameObject.Find("Score").GetComponent <ScoreKeeping>();
 }
        public IHttpActionResult PostGame(int id)
        {
            var user = UserController.Players.FirstOrDefault((p) => p.ID == id);

            if (user == null)
            {
                return(NotFound());
            }
            if (Gameplay.Pass_Count >= UserController.Players.Count)
            {
                string endgameString = "The game has ended. Final Scores:\n";


                if (!ScoreKeeping.endgame)
                {
                    foreach (Player p in UserController.Players)
                    {
                        p.Score -= p.Letters.Count * 5;
                    }
                    ScoreKeeping.LogEndGame();
                    ScoreKeeping.endgame = true;
                }

                foreach (Player p in UserController.Players)
                {
                    endgameString += "Player " + p.ID + ": " + p.Score + "\n";
                }
                Player winner = UserController.Players.Find(q => q.Score == UserController.Players.Max(p => p.Score));
                endgameString += "The winner is Player " + winner.ID + "!";
                return(Ok(endgameString));
            }
            try
            {
                if (Request.Headers.GetValues("Hash").ElementAt(0).ToString().Equals(user.Hash))
                {
                    JToken move;
                    JToken exchange;
                    try
                    {
                        JToken RequestValue = JObject.Parse(Request.Headers.GetValues("Move").ElementAt(0).ToString());
                        move     = RequestValue.SelectToken("Board");
                        exchange = RequestValue.SelectToken("Letters");
                    }
                    catch
                    {
                        move     = null;
                        exchange = null;
                    }
                    string[,,] dict = null;
                    string[] letter = null;
                    if (move != null)
                    {
                        try {
                            dict = JsonConvert.DeserializeObject <string[, , ]>(move.ToString());
                        }
                        catch { return(Ok("Something went wrong in deserializing for a board play")); }
                    }
                    if (exchange != null)
                    {
                        try {
                            letter = JsonConvert.DeserializeObject <string[]>(exchange.ToString());
                        }
                        catch { return(Ok("Something went wrong in deserializing for an exchange play")); }
                    }

                    if (dict != null)
                    {
                        //var dict = JsonConvert.DeserializeObject<string[, ,]>(move.ToString());
                        if (dict != null)
                        {
                            //Send the data to the move checkers

                            Gameplay.Board_temp = dict;
                            var valid = Models.Gameplay.accept_or_reject_move(user); //Fill in player
                            if (valid)
                            {
                                Status report = new Status();
                                report.Letters = user.Letters;
                                return(Ok(report));
                            }
                            else
                            {
                                return(Ok("Invalid Move"));
                            }
                        }
                        else
                        {
                            return(Ok("Something went wrong in deserializing for a board play"));
                        }
                    }
                    else if (letter != null)
                    {
                        //The user has chosen to exchange
                        if (letter != null)
                        {
                            //letters stuff here
                            user.ExchangeLetter = letter[0];
                            Gameplay.exchange_move(user);
                            return(Ok("You decided to turn in: " + string.Join("", letter) + "your new letters are:" + string.Join("", user.Letters)));
                        }
                        else
                        {
                            return(Ok("Something went wrong in deserializing for an exchange move"));
                        }
                    }
                    else
                    {
                        //Player has passed
                        Gameplay.pass();
                        return(Ok("You have passed your turn."));
                    }



                    //Add code to return Game data and Player data
                }
                else
                {
                    return(Ok("User Auth Failed"));
                }
            }
            catch (Exception e)
            {
                return(Ok(e.Message));
            }
        }
Exemple #26
0
 void Start()
 {
     score = GameObject.FindGameObjectWithTag("Score").GetComponent <ScoreKeeping>();
 }
Exemple #27
0
 void Start()
 {
     score             = GameObject.FindGameObjectWithTag("Score").GetComponent <ScoreKeeping>();
     scoreDisplay.text = "" + score.score;
 }
 // Use this for initialization
 void Start()
 {
     rb           = GetComponent <Rigidbody>();
     scoreKeeper  = gameController.GetComponent <ScoreKeeping>();
     acceleration = 50;
 }
Exemple #29
0
 void Start()
 {
     Score      = GetComponent <Text>();
     Score.text = "S C O R E :  " + ScoreKeeping.GetScore();
     ScoreKeeping.ResetScore();
 }
 // Start is called before the first frame update
 void Start()
 {
     //score.text = "this is a test";
     score = GetComponent <Text>();
     sk    = snitch.GetComponent <ScoreKeeping>();
 }
Exemple #31
0
 new void Awake()
 {
     scoreKeep = GameObject.Find("_Keepers").GetComponent <ScoreKeeping>();
     partMan   = GameObject.Find("_Keepers").GetComponent <ParticleManager>();
     blockMan  = GameObject.Find("_Keepers").GetComponent <BlockManager>();
 }