Exemple #1
0
    /*###########
    #   DEATH   #
    ###########*/

    void checkDeath()
    {
        //We get the child transform ( the transform of the soldier )
        foreach (Transform child in transform)
        {
            if (child.name != "globalHUD" && child.name != "scoreBoardUI" && child.name != "InGameMenu" && child.name != "littleScoreBoardUI" && child.name != "PlayerHUD")
            {
                playerNetwork playSet = child.gameObject.GetComponent <playerNetwork>();

                if (playSet.health <= 0)
                {
                    //We get the id of the last shot
                    int killer = playSet.lastShot;

                    /*if(actualTeam=="Blue")
                     * {
                     *      addRedKill(killer);
                     *      this.photonView.RPC("addRedKill", PhotonTargets.All, killer);
                     * }
                     * else {
                     *      addBlueKill(killer);
                     *      this.photonView.RPC("addBlueKill", PhotonTargets.All, killer);
                     * }*/

                    //We trigger the respawn function by setting us non-alive
                    playSet.isAlive = false;
                    isAlive         = false;

                    scoreScript scoreMan = GetComponent <scoreScript>();
                    scoreMan.wasKilled = true;
                }
            }
        }
    }
Exemple #2
0
    public void Awake()
    {
        score = 0;
        S     = this;

        highScore      = PlayerPrefs.GetInt("highScore", highScore);
        HighScore.text = highScore.ToString();
    }
Exemple #3
0
    void Start()
    {
        body        = GetComponent <SpriteRenderer>();
        scoreScript = GameObject.Find("Score").GetComponent <scoreScript>();
        spawner     = GameObject.Find("enemySpawner").GetComponent <Spawner>();

        deathSound = GameObject.Find("enemyDeath").GetComponent <AudioSource>();
    }
Exemple #4
0
    void setTeam(string team)
    {
        actualTeam = team;

        scoreScript scoreMan = GetComponent <scoreScript>();

        scoreMan.myTeam = team;
    }
 void platformDie()
 {
     Destroy(gameObject);
     Debug.Log("Dead");
     scoreScript = scoreText.GetComponent <scoreScript>();
     score       = scoreScript.returnScore();
     globalScoreKeeper.updateBlasterScore(score);
     SceneManager.LoadScene("Scene_endGame", LoadSceneMode.Additive);
     SceneManager.UnloadSceneAsync("Scene_Game");
 }
	// Use this for initialization
	void Start (){
		shadow = (GameObject) Instantiate(shadow);
		scoreScript = GameObject.Find("scoreScript").GetComponent<scoreScript>();
		power = GameObject.Find("gameScript").GetComponent<gameScript>().power ? 2.5f : 2f;		
		
		dots = dots - GameObject.Find("gameScript").GetComponent<gameScript>().round;
		if(dots < 5)
			dots = 5;
		Dots = GameObject.Find("dots");
		transform.rigidbody2D.isKinematic = true;
		transform.collider2D.enabled = false;
		startPos = transform.position;
		ind = Dots.transform.Cast<Transform>().ToList().ConvertAll(t => t.gameObject);
		for(int i = 0; i<dots; i++){
			ind[i].renderer.enabled = false;
		}
	}
    // Update is called once per frame
    void Update()
    {
        scoreScript scoreS = transform.root.GetComponent <scoreScript>();

        //We change the team scores
        Transform bluePanel = transform.Find("BluePanel");
        Transform redPanel  = transform.Find("RedPanel");

        Transform blueText = bluePanel.GetChild(0);
        Transform redText  = redPanel.GetChild(0);

        blueScore = blueText.GetComponent <Text>();
        redScore  = redText.GetComponent <Text>();

        int bScore = scoreScript.blueScore;
        int rScore = scoreScript.redScore;

        blueScore.text = "BLUE\n\n" + bScore.ToString();
        redScore.text  = "RED\n\n" + rScore.ToString();


        //Player score
        Transform playerP = transform.Find("PlayerPanel");

        //Changing the gamertag
        Transform playerT = playerP.transform.Find("PlayerTag");

        playerTag      = playerT.GetComponent <Text>();
        playerTag.text = PlayerPrefs.GetString("Gamertag");

        //Changing the score
        Transform playerS = playerP.transform.Find("PlayerScore");

        playerScore = playerS.GetComponent <Text>();

        int pKills   = scoreS.myKills;
        int pAssists = scoreS.myAssists;
        int pDeaths  = scoreS.myDeaths;

        playerScore.text = pKills.ToString() + "            " + pAssists.ToString() + "            " + pDeaths.ToString();
    }
Exemple #8
0
    // Use this for initialization
    void Start()
    {
        shadow      = (GameObject)Instantiate(shadow);
        scoreScript = GameObject.Find("scoreScript").GetComponent <scoreScript>();
        power       = GameObject.Find("gameScript").GetComponent <gameScript>().power ? 2.5f : 2f;

        dots = dots - GameObject.Find("gameScript").GetComponent <gameScript>().round;
        if (dots < 5)
        {
            dots = 5;
        }
        Dots = GameObject.Find("dots");
        transform.GetComponent <Rigidbody2D>().isKinematic = true;
        transform.GetComponent <Collider2D>().enabled      = false;
        startPos = transform.position;
        ind      = Dots.transform.Cast <Transform>().ToList().ConvertAll(t => t.gameObject);
        for (int i = 0; i < dots; i++)
        {
            ind[i].GetComponent <Renderer>().enabled = false;
        }
    }
Exemple #9
0
    void ajoutTeam(int senderID)
    {
        networkManager netMan = (networkManager)GameObject.Find("multiScripts").GetComponent("networkManager");

        PhotonPlayer target = PhotonPlayer.Find(senderID);

        scoreScript scoreMan = GetComponent <scoreScript>();

        if (blueCount <= redCount)
        {
            //photonView.RPC("blueTeam", target, null );
            photonView.RPC("setTeam", target, "Blue");
            blueCount++;
            scoreMan.blueCount++;
        }
        else
        {
            //photonView.RPC("redTeam", target, null );
            photonView.RPC("setTeam", target, "Red");
            redCount++;
            scoreMan.redCount++;
        }
    }
Exemple #10
0
 //public float rotationSpeed;
 // Use this for initialization
 void Start()
 {
     rb = GetComponent <Rigidbody2D>();
     thescoremanager = FindObjectOfType <scoreScript>();
 }
Exemple #11
0
 // Use this for initialization
 void Start()
 {
     scr = (scoreScript)gameman.GetComponent(typeof(scoreScript));
 }
Exemple #12
0
    /*###########
    #   START   #
    ###########*/

    // Use this for initialization
    void Start()
    {
        //On récupère l'ID du joueur
        PhotonView photonView = PhotonView.Get(this);
        int        myID       = photonView.owner.ID;

        //We activate the scoreScript
        scoreScript scoreEn = GetComponent <scoreScript>();

        if (photonView.isMine)
        {
            scoreEn.enabled = true;
        }
        else
        {
            scoreEn.enabled = false;
        }


        //On change le nom du joueur
        PhotonNetwork.playerName = PlayerPrefs.GetString("Gamertag");         /*--------------------------------------------------------BUG WITH THE PLAYER NAME, PUT BACK TO NORMAL, JUST FOR TEST -----------------------------*/

        /*int playerNumb = Random.Range(0, 10000);
         * PhotonNetwork.playerName = "player" + playerNumb.ToString();*/


        networkManager netMan = (networkManager)GameObject.Find("multiScripts").GetComponent("networkManager");


        /*----- IN MATCH -----*/

        blueSpawn = GameObject.Find("spawn_Blue");

        spawnBlue1 = blueSpawn.transform.Find("spawnBlue1").gameObject;
        spawnBlue2 = blueSpawn.transform.Find("spawnBlue2").gameObject;

        playerCountUpdateTimer = 0f;


        //We change the team of the player
        if (PhotonNetwork.isMasterClient)
        {
            blueCount = 0;
            redCount  = 0;
            scoreScript scoreMan = GetComponent <scoreScript>();

            if (blueCount <= redCount)
            {
                actualTeam = "Blue";
                blueCount++;
                scoreMan.myTeam = "Blue";
            }
            else
            {
                actualTeam = "Red";
                redCount++;
                scoreMan.myTeam = "Red";
            }
        }
        else
        {
            this.photonView.RPC("ajoutTeam", PhotonTargets.MasterClient, myID);
        }
    }
Exemple #13
0
    void Start()
    {
        stopWatch = new Stopwatch();
        stopWatch.Start ();
        //		myLog = new LogMsg("ATCLog_LC", "pupilsize,timestamp,nplanes,lastaction,lastactiondetails,positivescore,negativescore");
        //	UnityEngine.Debug.Log (dataPath);

        //myLog = new LogMsg("ATCLog_T", "pupilsize,timestamp,nplanes,lastaction,lastactiondetails,positivescore,negativescore");
        // get input from bitalino copied from ConnectionState
        start = true;
        instantiator = GameObject.Find("Level").GetComponent<instantiateAirplanesHighCondition>();
        scorer = Camera.main.GetComponent<scoreScript> ();
        string header = "timestamp_write;";
        if (useeyetracker == true) {
            header = header + "timestamp_gotpupil;eyeTrackerTime;normPos;diameter;confidence;";
            //pupreader.clientPupil1.Client.Blocking=true;
        }
        if(usebitalino == true){
            header = header + "timestamp_gotbitdata;CRC;SEQ;AnalogOutp1;AnalogOutp2;AnalogOutp3;AnalogOutp4;AnalogOutp5;AnalogOutp6;DigitalOutp1;DigitalOutp2;DigitalOutp3;DigitalOutp4;";
        }
        myLog = new LogBitPupil(dataPath, fileName, header +
                                "nplanes;listofAirplanesonScreen;lastAction;lastActionDetails;lastActionAirplaneNumber;calculatedScore;positiveScore;negativeScore;collidedAirplaneNumbers;targetPositions;collisionPoint");
    }
Exemple #14
0
 // Use this for initialization
 void Start()
 {
     score = GameObject.FindGameObjectWithTag("Player").GetComponent <scoreScript>();
 }
Exemple #15
0
 public void Init(scoreScript score_script)
 {
     m_ScoreScript = score_script;
 }
Exemple #16
0
 void Start()
 {
     blockStartPoint  = blockGenerator.position;
     playerStartPoint = thePlayer.transform.position;
     thescoremanager  = FindObjectOfType <scoreScript>();
 }