Ejemplo n.º 1
0
	void Start () {
		gameControl = GameObject.Find("GameControl").GetComponent("GameControl") as GameControl;
		gp			= GameObject.Find("GameControl").GetComponent<GamePlay>();
		speedControl = gameControl.speedControl;
		CountSpeedUp = gp.countSpeedUp;
		SpeedUp = gp.speedUp;
	}
Ejemplo n.º 2
0
	// Use this for initialization
	void Start () {
		Application.targetFrameRate = 60;
		highScore = PlayerPrefs.GetInt("HighScore");
		coinAll = PlayerPrefs.GetInt("Coin");
		gp = gameObject.GetComponent<GamePlay>();
		SetSpeed(speedtime);
	}
Ejemplo n.º 3
0
	// Use this for initialization
	void Start () {
		box = new GameObject[texture.Length];
		gameControl = GameObject.Find("GameControl").GetComponent("GameControl") as GameControl; 
		gp = GameObject.Find("GameControl").GetComponent<GamePlay>(); 

		endPoint = gameControl.stopCharacterX + 2.2F;
	}
Ejemplo n.º 4
0
	// Use this for initialization
	void Start () {
		gc = gco.GetComponent<GameControl>();
		gp = gco.GetComponent<GamePlay>();

		pos.y = -3.5F;
		pos.z = -2;
	}
Ejemplo n.º 5
0
	void Start () {			
        

		instance = this;
		//
        PanelMainMenu.SetActive(true);
        PanelInGame.SetActive(false);
        PanelOverGame.SetActive(false);
        GamePlay.instance.PanelRaking.SetActive(false);

        currentState = STATE_MENU;
		restart ();

       
       
        ScoreControl.init();
		FixedBackground ();
		if (timeShowAds > 90 || !firstShowAdsAtBegin)
		{
			
			ShowADS();
			
		}
		
		timeBegin = 3;
	}
Ejemplo n.º 6
0
	// Use this for initialization
	void Start () {
		lv = PlayerPrefs.GetInt("LV_Rocket");
		if(lv == 0)
			time = 8;
		else if(lv == 1)
			time = 10;
		else if(lv == 2)
			time = 14;
		else if(lv == 3)
			time = 18;
		else
			time = 24;
		//////////////////////////////////////////////////
		gp = GameObject.Find("GameControl").GetComponent<GamePlay>();
		gc = GameObject.Find("GameControl").GetComponent<GameControl>();
		gc.Rocket = true;
		gp.checkrungame = false;
		speed = gc.speedControl;
		if(GameObject.Find("CharacterControl") != null) {
			_character = GameObject.Find("CharacterControl");
			_character.transform.name = "CC";
			Debug.Log("CharacterControl");
		}else
			_character = GameObject.Find("CC");
		cc = _character.GetComponent<CharacterControl>();
		pos.x = gc.stopCharacterX+2;
		pos.y = -3.5F;
		pos.z = -2;

		posY.z = -2;
	}
Ejemplo n.º 7
0
	public void StartPattern() {
		gameControl = (GameControl)GameObject.Find("GameControl").GetComponent("GameControl");
		gp			= GameObject.Find("GameControl").GetComponent<GamePlay>();
		gp.PatterOn = true;
		
		float flowY = (int)Random.Range(0F,1.9F);
		transform.position = new Vector3(transform.position.x, transform.position.y + flowY, transform.position.z);
		
		int i = 0;
		while(i < stone.Length) {
			StoneRealTime s = stone[i].GetComponent("StoneRealTime") as StoneRealTime;
			s.StartEvent(stone[i].transform.position.x, stone[i].transform.position.y, stone[i].transform.position.z);
			i++;
		}
		i = 0;
		while(i < ice.Length) {
			IceRealTime s = ice[i].GetComponent("IceRealTime") as IceRealTime;
			s.StartEvent(ice[i].transform.position.x, ice[i].transform.position.y);
			i++;
		}
		i = 0;
		while(i < pricker.Length) {
			PrickerRealTime s = pricker[i].GetComponent("PrickerRealTime") as PrickerRealTime;
			s.StartEvent(pricker[i].transform.position.x, pricker[i].transform.position.y);
			i++;
		}
		i = 0;
		while(i < stalactite.Length) {
			StalactiteRealTime s = stalactite[i].GetComponent("StalactiteRealTime") as StalactiteRealTime;
			s.StartEvent(stalactite[i].transform.position.x, stalactite[i].transform.position.y, flowY);
			i++;
		}
	}
	// Use this for initialization
	void Start () {
		DEF.Init();
        
		GameObject hand = GameObject.Find("BackGround");
		
		//BirdObject  =  GameObject.Find("BirdObject");
		//BirdObject.GetComponent<Rigidbody2D>().gravityScale = 0f;
		//GUI.matrix = Matrix4x4.TRS(new Vector3(0, 0, 0), Quaternion.identity,new  Vector3(DEF.scaleX, DEF.scaleY, 1));
		if(hand!= null)
		{
			//	DEF.ResizeBySize(hand,DEF.DISPLAY_WIDTH,DEF.DISPLAY_HEIGHT);
			hand.transform.localScale = new Vector3 (DEF.sx_ortho, DEF.sy_ortho, 1);
			
		}
        mpreStareState = -1;//none
        mcurrentState = STATE_MENU;
		instance = this;
        
		//ScoreControl.setDefaultScore ();
		DEF.ScaleAnchorGui();

        ScoreControl.loadGame();

        if (ScoreControl.mLevelUnblock < 3)
            ButtonRate.SetActive(false);
        Level.loadTextData();
        SetUIText();
        ChangeScreenChoose(STATE_MENU, false);
	}
Ejemplo n.º 9
0
    //List<Cannon> Cannons = new List<Cannon>();
    void Start()
    {
        player = GameObject.FindGameObjectWithTag("Player");

        GetComponentInChildren<LookAtSLerp>().Target = player.transform;
        GetComponent<Destroyable>().OnDie += Turret_OnDie;

        gamePlay = FindObjectOfType<GamePlay>();
    }
Ejemplo n.º 10
0
	// Use this for initialization
	void Start () {
		//cc = GameObject.Find("CharacterControl").GetComponent<CharacterControl>();
		gc = GameObject.Find("GameControl").GetComponent<GameControl>();
		gp = GameObject.Find("GameControl").GetComponent<GamePlay>();
		if(!gc.ghost) {
			_Character = GameObject.Find("CharacterControl").transform;
			_do = true;
		}
		down = -2.5F + gp.lastFlowY;
	}
Ejemplo n.º 11
0
    // Use this for initialization
    void Start()
    {
        _gamePlay = DataFactory.GetGamePlay();
        Debug.Log("当前选择势力: "+_gamePlay.MyKingdom.Name);

        cities = DataFactory.GetAllCities();
        _flags = Resources2.LoadAll<Sprite>("Flags");

        //把所有城市按钮加入当前场景
        _addAllCities();
    }
Ejemplo n.º 12
0
	// Use this for initialization
	void Start () {
		gameControl = GameObject.Find("GameControl").GetComponent("GameControl") as GameControl;
		gp 			= GameObject.Find("GameControl").GetComponent<GamePlay>();
		mod 		= gameObject.GetComponent<Modifier>();
		boot_rocket = PlayerPrefs.GetInt("Boot_Rocket");
		if(AudioListener.volume > 0){
			SoundIndex = 0;
		}else{
			SoundIndex = 1;
		}
		_fb = gameObject.GetComponent<GUIFB>();
	}
Ejemplo n.º 13
0
	// Update is called once per frame
	void Update () {
		if(!end)
		if(transform.position.x < (size*18)*-1){
				Destroy(transform.gameObject);
				end = true;
			}else if(transform.position.x + ((size-1)*18) <= 0.25F && check) {
				gp = GameObject.Find("GameControl").GetComponent<GamePlay>();
				gp.PatterOn = false;
				check = false;	
			}else {
				transform.position = Vector3.Lerp(transform.position, transform.position+Vector3.left,gameControl.SpeedFlow()*Time.deltaTime);
			}	
	}
Ejemplo n.º 14
0
	public void StartPattern() {
		gameControl = GameObject.Find("GameControl").GetComponent("GameControl") as GameControl;
		gp = GameObject.Find("GameControl").GetComponent<GamePlay>();
		gp.Bonus = false;
		
		transform.position = new Vector3(18, gp.lastFlowY, transform.position.z);
		gp.LastP = transform.gameObject;
		
		c = transform.FindChild("Coin").GetComponent("CoinSet") as CoinSet;
		c.TurnCoin(true);
			
		check = true;
		end = false;
	}
Ejemplo n.º 15
0
	public void StartPattern() {
		if(gp == null)
			gp = GameObject.Find("GameControl").GetComponent<GamePlay>();

		startPos = transform.position;
		startPos.x = 17.8F+gp.nextHop;
		transform.position = startPos;

		gp.nextHop = transform.position.x;

		gp.PatterOn = true;
		//check = true;
		//end = false;
	}
Ejemplo n.º 16
0
	public void DestroyMe(){
		if(!damage && control.enabled)
		{
			damage = true;
			if(gamePlay == null)
				gamePlay = GameObject.Find("Scripts").GetComponent<GamePlay>();
			gamePlay.AddLog("Enemy Hit " + GamePlay.myPlayer.getName);
			if(--health < 1)
			{
				control.enabled = false;
				GetComponent<PlayerAnimation>().PlayAnime("IsDeath");
				Invoke("Death", 2f);
			}
		}
	}
	void Start () {
        DEF.Init();
        DEF.ScaleAnchorGui();
        timeleft = updateInterval;  

        //Application.targetFrameRate = 30;
        timeNextRebound = Random.Range(0.8f, 1.2f);
        timePlay = 0;
        timeReBound = 0;
       // Debug.Log(Time.captureFramerate);
       // Time.captureFramerate = 30;
        state = STATE_WAITTING;
        instance = this;
        score = 0;
        statePre = -1;
      //  SoundEngine.stopSound("SoundBgMusic");
	}
Ejemplo n.º 18
0
	void Start () {			
        
		instance = this;
        ReadyAnim.SetActive(true);
        PanelMainMenu.SetActive(true);
        PanelInGame.SetActive(false);
        PanelOverGame.SetActive(false);
        GamePlay.instance.PanelRaking.SetActive(false);

        currentState = STATE_MENU;
		restart ();
	

        timeBegin = 3;
        sliderbar.value = timeBegin;
        ScoreControl.init();
       
		
	}
Ejemplo n.º 19
0
	public void BombMe(Player player){
		if(!damage && control.enabled)
		{
			damage = true;
			if(gamePlay == null)
				gamePlay = GameObject.Find("Scripts").GetComponent<GamePlay>();
			gamePlay.AddLog(player.getName + " Bomb " + GamePlay.myPlayer.getName);
			if(--health < 1)
			{
				control.enabled = false;
				GetComponent<PlayerAnimation>().PlayAnime("IsDeath");
				//Debug.LogWarning(player.getNumber);
				if(player.getNumber != playerNumber){
					gamePlay.AddPoint(player, 200);
					gamePlay.AddLog(player.getName + " Get 200P");
				}
				Invoke("Death", 2);
			}
		}
	}
Ejemplo n.º 20
0
        static void Main(string[] args)
        {

            PlayerInfo player1 = new PlayerInfo();
            PlayerInfo player2 = new PlayerInfo();


            StartMenu menu = new StartMenu();

            //assign turns
            player1.UserTurn = 1;
            player2.UserTurn = 2;

          //assign userName
            player1.UserName = menu.Execute(player1.UserTurn);
            player2.UserName = menu.Execute(player2.UserTurn);

            //create gameboard
            GameBoard gameBoard = new GameBoard();

        //allow users to place ships -- player1
            gameBoard.PrintGameBoard();
            ShipSetUp setUpShips = new ShipSetUp();
            setUpShips.AllowUserToPlace5Ships(gameBoard,player1);

            //allow users to place ships -- player2
            gameBoard.PrintGameBoard();
            setUpShips.AllowUserToPlace5Ships(gameBoard,player2); 
        
 
            GamePlay playGame = new GamePlay();
            playGame.PlayTheGame(player1, player2, gameBoard);
            Console.ReadLine();



        }
Ejemplo n.º 21
0
	public void StartPattern() {
		if(gp == null)
			gp = GameObject.Find("GameControl").GetComponent<GamePlay>();
		
		flowY = (int)Random.Range(-1.5F,1.5F);
		if(gp.lastFlowY > 0 && flowY > 0)
			flowY = 0;
		else if(gp.lastFlowY < 1 && flowY == -1)
			flowY = 0;
		gp.lastFlowY += flowY;

		transform.position = new Vector3(17.7F+gp.nextHop,gp.lastFlowY,transform.position.z);
		gp.nextHop = transform.position.x + ((size-1)*18);

		if(transform.FindChild("Coin") != null) {
			if(c == null)
				c = transform.FindChild("Coin").GetComponent("CoinSet") as CoinSet;
			c.TurnCoin(true);
		}
			
		gp.PatterOn = true;
		//check = true;
		//end = false;
	}
Ejemplo n.º 22
0
 private void Awake()
 {
     gs = GamePlay.GetGamePlayScript();
 }
Ejemplo n.º 23
0
 public void playersTurn(string nickname, GamePlay.GameState state, bool playerAlive)
 {
     setState(nickname, state, playerAlive);
 }
Ejemplo n.º 24
0
	// Use this for initialization
	void Start () {
		posY = transform.position;
		gp = GameObject.Find("GameControl").GetComponent<GamePlay>();
		gc = GameObject.Find ("GameControl").GetComponent<GameControl>();
	}
Ejemplo n.º 25
0
 private void OnDestroy()
 {
     instance = null;
 }
Ejemplo n.º 26
0
 void Awake()
 {
     gp = GameObject.FindGameObjectWithTag("GamePlay").GetComponent <GamePlay>();
 }
Ejemplo n.º 27
0
 private void Start()
 {
     gamePlay = FindObjectOfType <GamePlay>();
     _camera  = FindObjectOfType <Camera>();
 }
    public void OnExtensionResponse(BaseEvent evt)
    {
        try
        {
            string     text       = (string)evt.Params["cmd"];
            ISFSObject iSFSObject = (SFSObject)evt.Params["params"];
            switch (text)
            {
            case "pingAck":
                break;

            case "spawnPlayerAck":
                break;

            case "findRoom":
                Logger.trace("[OnExtensionResponse] found room");
                break;

            case "findRoomAck":
                Logger.trace("[OnExtensionResponse]  room found " + evt.Params.ToString());
                break;

            case "startGame":
                Logger.trace("[OnExtensionResponse]  Receiving Message startGame");
                break;

            case "stopGame":
                Logger.trace("[OnExtensionResponse] Receiving stop game");
                break;

            case "sendEvents":
            {
                SFSArray sFSArray = (SFSArray)iSFSObject.GetSFSArray("events");
                for (int j = 0; j < sFSArray.Size(); j++)
                {
                    SFSObject sFSObject2 = (SFSObject)sFSArray.GetSFSObject(j);
                    int       int3       = sFSObject2.GetInt("playerId");
                    PassEventToPlayerObject(sFSObject2, int3);
                }
                break;
            }

            case "queueTime":
                m_qTime = iSFSObject.GetInt("queueTime");
                break;

            case "sendSummary":
            {
                Debug.Log("\n");
                Debug.Log("\n");
                Debug.Log("\n");
                Debug.Log("### receiving summary");
                Debug.Log("\n");
                Debug.Log("\n");
                Logger.trace("Battle Summary Received");
                Logger.traceError("Summary:" + iSFSObject.GetDump());
                int @int = iSFSObject.GetInt("BanzaiTotal");
                int int2 = iSFSObject.GetInt("AtlasTotal");
                Debug.Log("banzai total: " + @int);
                Debug.Log("atlas total: " + int2);
                GameData.BanzaiHacks = @int;
                GameData.AtlasHacks  = int2;
                string[] keys  = iSFSObject.GetKeys();
                string[] array = keys;
                foreach (string text2 in array)
                {
                    if (!text2.Equals("BanzaiTotal") && !text2.Equals("AtlasTotal"))
                    {
                        SFSObject sFSObject = (SFSObject)iSFSObject.GetSFSObject(text2);
                        Logger.traceError("statData: " + sFSObject.GetDump());
                        int playerId = Convert.ToInt32(text2);
                        GameData.addPlayerStats(playerId, sFSObject);
                    }
                }
                GameObject gameObject = GameObject.Find("Game");
                GamePlay   gamePlay   = gameObject.GetComponent("GamePlay") as GamePlay;
                if (gamePlay != null)
                {
                    gamePlay.BattleSummaryReceived();
                }
                else
                {
                    Debug.Log("cant find gameplay");
                }
                break;
            }

            default:
                Logger.trace("[OnExtensionResponse] unhandled event: " + text);
                break;
            }
        }
        catch (Exception ex)
        {
            Logger.traceError("Exception handling response: " + ex.Message + " >>> " + ex.StackTrace);
        }
    }
    public void OnUpdateRoomVariables(BaseEvent evt)
    {
        Room        room       = (Room)evt.Params["room"];
        ArrayList   arrayList  = (ArrayList)evt.Params["changedVars"];
        IEnumerator enumerator = arrayList.GetEnumerator();

        try
        {
            while (enumerator.MoveNext())
            {
                switch ((string)enumerator.Current)
                {
                case "stop":
                    if (room.GetVariable("stop").GetStringValue().Equals("capturelimit"))
                    {
                        Debug.Log("<< Game ended because of " + room.GetVariable("stop").GetStringValue());
                        DynamicOptions.bDrawCursor = true;
                        GameData.CurPlayState      = GameData.PlayState.GAME_IS_OVER;
                        GameData.setGameEndCondition(2);
                    }
                    else if (room.GetVariable("stop").GetStringValue().Equals("timeout"))
                    {
                        DynamicOptions.bDrawCursor = true;
                        GameData.CurPlayState      = GameData.PlayState.GAME_IS_OVER;
                        GameData.setGameEndCondition(3);
                    }
                    else if (room.GetVariable("stop").GetStringValue().Equals("banzaileft"))
                    {
                        GameObject gameObject2 = GameObject.Find("localPlayer");
                        if (gameObject2 != null)
                        {
                            Player player = gameObject2.GetComponent("Player") as Player;
                            player.gs.QuitGame(4);
                        }
                    }
                    else if (room.GetVariable("stop").GetStringValue().Equals("atlasleft"))
                    {
                        GameObject gameObject3 = GameObject.Find("localPlayer");
                        if (gameObject3 != null)
                        {
                            Player player2 = gameObject3.GetComponent("Player") as Player;
                            player2.gs.QuitGame(5);
                        }
                    }
                    else if (room.GetVariable("stop").GetStringValue().Equals("playersleft"))
                    {
                        GameObject gameObject4 = GameObject.Find("localPlayer");
                        if (gameObject4 != null)
                        {
                            Player player3 = gameObject4.GetComponent("Player") as Player;
                            player3.gs.QuitGame(3);
                        }
                    }
                    else if (room.GetVariable("stop").GetStringValue().Equals("teamimbalance"))
                    {
                        DynamicOptions.bDrawCursor = true;
                        GameData.CurPlayState      = GameData.PlayState.GAME_IS_OVER;
                        GameData.setGameEndCondition(6);
                    }
                    Logger.trace("<< game is halted for reason: " + room.GetVariable("stop").GetStringValue());
                    break;

                case "time":
                {
                    int        intValue   = room.GetVariable("time").GetIntValue();
                    GameObject gameObject = GameObject.Find("Game");
                    if (gameObject != null)
                    {
                        GamePlay gamePlay = gameObject.GetComponent("GamePlay") as GamePlay;
                        if (gamePlay != null)
                        {
                            gamePlay.mGameTimer = gamePlay.mTotalGameTime - (float)intValue;
                        }
                    }
                    break;
                }

                case "mapId":
                    Logger.traceAlways("[NetworkManager::OnUpdateRoomVariables]  - mapId received");
                    break;
                }
            }
        }
        finally
        {
            IDisposable disposable = enumerator as IDisposable;
            if (disposable != null)
            {
                disposable.Dispose();
            }
        }
    }
Ejemplo n.º 30
0
 void Start()
 {
     gamePlayScript = GameObject.Find("GamePlay").GetComponent <GamePlay>();
 }
Ejemplo n.º 31
0
 void Start()
 {
     game = FindObjectOfType <GamePlay>();
     cam  = Camera.main.GetComponent <CamFollow>();
     map  = GetComponent <MapEdit>();
 }
Ejemplo n.º 32
0
    public void ReceiveEvent(SFSObject data)
    {
        Logger.trace(string.Empty);
        Logger.trace("::::::::: ReceiveEvent ::::::::::::");
        Logger.trace(data.GetDump());
        Logger.trace(string.Empty);
        GamePlay gamePlayScript = GamePlay.GetGamePlayScript();
        Player   player         = GetComponent("Player") as Player;
        int      num            = Convert.ToInt32(data.GetInt("playerId"));
        int      num2           = Convert.ToInt32(data.GetInt("msgType"));

        switch (num2)
        {
        case 21:
        case 120:
        case 200:
            break;

        case 1:
            ReceiveSuitWeapon(data);
            break;

        case 101:
            gamePlayScript.serverReady = true;
            Logger.trace("<<  <<  should start game >> >>");
            break;

        case 40:
            Logger.trace("<<  <<  ignoring spawn message for player:" + num.ToString() + " >> >>");
            break;

        case 23:
        {
            if (!player.mIsLocal)
            {
                break;
            }
            int    num15        = Convert.ToInt32(data.GetInt("oppId"));
            int    num16        = Convert.ToInt32(data.GetInt("currHealth"));
            int    num17        = Convert.ToInt32(data.GetInt("boost"));
            int    mNumCaptures = Convert.ToInt32(data.GetInt("captures"));
            int    idx          = Convert.ToInt32(data.GetInt("weaponIdx"));
            Player player3      = gamePlayScript.players[num15 - 1].GetComponent("Player") as Player;
            player3.healthCurrent = num16;
            player3.mNumCaptures  = mNumCaptures;
            player3.changeWeapon(idx);
            if (num17 > 0)
            {
                int num18 = num17 >> 16;
                if ((num18 & 0x8000) > 0)
                {
                    num18 &= 0x7FFF;
                    player3.activateBoostsInProgress(num18);
                }
                num18 = (num17 & 0xFFFF);
                if ((num18 & 0x8000) > 0)
                {
                    num18 &= 0x7FFF;
                    player3.activateBoostsInProgress(num18);
                }
            }
            break;
        }

        case 25:
            if (player.mIsLocal)
            {
                int   puIdx2 = Convert.ToInt32(data.GetInt("boostIdx"));
                float puTime = Convert.ToSingle(data.GetFloat("boostTime"));
                gamePlayScript.setPickupActive(puIdx2, puTime);
            }
            break;

        case 4:
        {
            Logger.trace("<< myPlayer name: " + player.name);
            float   shotAngle      = Convert.ToSingle(data.GetFloat("angle"));
            float   angleIncrement = Convert.ToSingle(data.GetFloat("inc"));
            int     bnum           = Convert.ToInt32(data.GetInt("bnum"));
            Vector3 startPt        = new Vector3(Convert.ToSingle(data.GetFloat("x")), Convert.ToSingle(data.GetFloat("y")) + yAdjust, 0f);
            Logger.trace("<< " + base.gameObject.name + " weapon: " + player.weaponIdx);
            player.remoteShoot(startPt, shotAngle, angleIncrement, bnum);
            break;
        }

        case 5:
        {
            float ang   = Convert.ToSingle(data.GetFloat("angle"));
            int   isGun = Convert.ToInt32(data.GetInt("type"));
            int   num19 = Convert.ToInt32(data.GetInt("num"));
            if (num != GameData.MyPlayerId)
            {
                Logger.trace("<< someone else telling me to throw");
            }
            Vector3 pos = new Vector3(Convert.ToSingle(data.GetFloat("x")), Convert.ToSingle(data.GetFloat("y")) + yAdjust, 0f);
            player.ThrowGrenade(pos, ang, isGun, num19);
            break;
        }

        case 9:
        {
            Logger.trace("received explode message");
            int num14 = Convert.ToInt32(data.GetInt("num"));
            Logger.trace("<< trying to find grenade num " + num14);
            GameObject gameObject6 = GameObject.Find("grenade_" + num14.ToString());
            if (gameObject6 != null)
            {
                Grenade grenade = gameObject6.GetComponent("Grenade") as Grenade;
                grenade.Explode();
            }
            break;
        }

        case 24:
            if (player.mIsLocal)
            {
                gamePlayScript.mGameTimer  = Convert.ToSingle(data.GetFloat("time"));
                gamePlayScript.serverReady = true;
            }
            break;

        case 6:
        {
            int num10 = Convert.ToInt32(data.GetInt("idx"));
            Logger.trace("<< need to change weapon " + num10);
            if (player != null)
            {
                player.changeWeapon(num10);
            }
            break;
        }

        case 18:
        {
            float x2 = Convert.ToSingle(data.GetFloat("xstart"));
            float y2 = Convert.ToSingle(data.GetFloat("ystart"));
            float x3 = Convert.ToSingle(data.GetFloat("xend"));
            float y3 = Convert.ToSingle(data.GetFloat("yend"));
            gamePlayScript.DrawSniperLine(x2, y2, x3, y3);
            break;
        }

        case 8:
        {
            int num6  = Convert.ToInt32(data.GetInt("myIdx"));
            int num7  = Convert.ToInt32(data.GetInt("pType"));
            int puIdx = Convert.ToInt32(data.GetInt("pIdx"));
            Logger.trace("<< receiving pickup " + num6 + "  of type " + num7);
            gamePlayScript.activatePickup(puIdx, num7, num6);
            break;
        }

        case 10:
        {
            float damage     = Convert.ToSingle(data.GetFloat("damage"));
            int   num11      = Convert.ToInt32(data.GetInt("playerId"));
            int   attackerId = Convert.ToInt32(data.GetInt("uAttackerID"));
            int   num12      = Convert.ToInt32(data.GetInt("bnum"));
            int   num13      = Convert.ToInt32(data.GetInt("hs"));
            float health     = Convert.ToSingle(data.GetFloat("health"));
            if (num13 == 1)
            {
                Logger.trace("<< shot was a HEADSHOT!");
            }
            string text2 = "bullet_" + num12;
            Debug.Log("<< damage done by bullet " + text2);
            if (num12 >= 0)
            {
                GameObject gameObject4 = GameObject.Find(text2);
                Debug.Log("<< should destroy bullet " + num12);
                if (gameObject4 != null)
                {
                    Debug.Log("<< should be destroying bullet " + text2);
                    UnityEngine.Object.Destroy(gameObject4);
                }
                else
                {
                    Debug.Log("<< Couldn't find Bullet " + text2);
                    gamePlayScript.addBulletNotToAdd(num12);
                }
            }
            GameObject gameObject5 = gamePlayScript.players[num11];
            if (!(gameObject5 != null))
            {
                break;
            }
            Player player2 = gameObject5.GetComponent("Player") as Player;
            if (player2 != null)
            {
                player2.ApplyDamage(damage, health, num13 == 1, attackerId);
                if (gamePlayScript != null && !(gamePlayScript.mHUD != null))
                {
                }
            }
            break;
        }

        case 16:
        {
            Logger.trace("received rocket explode message");
            int    num9 = Convert.ToInt32(data.GetInt("num"));
            float  x    = Convert.ToSingle(data.GetFloat("x"));
            float  y    = Convert.ToSingle(data.GetFloat("y"));
            string text = "bullet_" + num9;
            Logger.trace("<< trying to find  " + text);
            GameObject gameObject2 = GameObject.Find(text);
            if (gameObject2 == null)
            {
                Debug.Log("couldn't find bullet");
                GameObject gameObject3 = UnityEngine.Object.Instantiate(gamePlayScript.rocket, new Vector3(x, y, 0f), Quaternion.identity) as GameObject;
                Projectile projectile  = gameObject3.GetComponent("Projectile") as Projectile;
                projectile.transform.position = new Vector3(x, y, 0f);
                projectile.Explode();
            }
            else
            {
                Projectile projectile2 = gameObject2.GetComponent("Projectile") as Projectile;
                projectile2.transform.position = new Vector3(x, y, 0f);
                projectile2.Explode();
            }
            break;
        }

        case 17:
        {
            int num8 = Convert.ToInt32(data.GetInt("num"));
            player.ShowTaunt(num8);
            break;
        }

        case 20:
        {
            int num3 = Convert.ToInt32(data.GetInt("uAttackerID"));
            int num4 = Convert.ToInt32(data.GetInt("playerId"));
            int num5 = Convert.ToInt32(data.GetInt("bnum"));
            if (num5 >= 0)
            {
                GameObject gameObject = GameObject.Find("bullet_" + num5);
                if (gameObject != null)
                {
                    Logger.trace("<< killing bullet " + num5 + " because it collided with player");
                    UnityEngine.Object.Destroy(gameObject);
                }
            }
            gamePlayScript.mHUD.AddMessage(GameData.trimDisplayName(gamePlayScript.m_networkManager.getNameByID(num3 + 1)) + " hacked " + GameData.trimDisplayName(gamePlayScript.m_networkManager.getNameByID(num4 + 1)));
            break;
        }

        case 50:
            if (!(base.gameObject.name != "localPlayer"))
            {
                Logger.trace("<< play beep because can't perform action");
            }
            break;

        case 22:
        {
            int pickupType = Convert.ToInt32(data.GetInt("uPickup"));
            player.deactivatePickupOnPlayer(pickupType);
            break;
        }

        default:
            Logger.traceError("<< UNHANDLED MESSAGE : " + num2);
            break;
        }
    }
Ejemplo n.º 33
0
 // Start is called before the first frame update
 void Start()
 {
     gamePlay = GameObject.Find("SpawnManager").GetComponent <GamePlay>();
 }
Ejemplo n.º 34
0
        private void joinGame(GamePlay.Player.playerColor color)
        {
            try
            {
                if (proxy == null)
                {
                    proxy = new GamePlay.GamePlayClient(new InstanceContext(this));
                }

                // check that nickname doesn't already exist
                string nickname = tbNickName.Text;

                // use correct color
                bool result = proxy.signIntoGame(gameId, nickname, color);
                if (result)
                {
                    tbNickName.Enabled = false;
                    updateChatListBox();
                }
                else
                {
                    MessageBox.Show("logging into the game failed. Might be that the game is full. That you forgot to type in a nickname or that the nickname is already taken. (Remember that the nickname should be between 3 and 20 characters!");
                }

            }
            catch (Exception error)
            {
                MessageBox.Show(error.Message);
            }

            getTerritoriesFromService();
            getPlayersFromService();
            updatePlayers();
            updateTerritories();
        }
Ejemplo n.º 35
0
        public static void DrawDungeon(Node node)
        {
            bool hasCrystal       = false;
            bool hasHealingPotion = false;

            if (game.player.location == game.dungeon.getExitnode())
            {
                Console.WriteLine("You win!");
                Console.ReadLine();
                GamePlay.save(commands);
                Environment.Exit(0);
            }
            else
            {
                Console.WriteLine("Current location: " + node.ID);
                Console.Write("Players bag content: ");
                foreach (Item i in game.player.bag)
                {
                    if (i is Crystal)
                    {
                        Console.Write("C ");
                    }
                    if (i is HealingPotion)
                    {
                        Console.Write("HP ");
                    }
                }
                Console.WriteLine();
                if (game.player.boosted)
                {
                    Console.WriteLine("Player is boosted!");
                }
                Console.WriteLine("Kills: " + game.player.KP);
                Console.WriteLine("HP: " + game.player.HP + "/" + game.player.HPmax);

                if (node.neighbors.Count > 1)
                {
                    Console.WriteLine("xxxxxxxxxxxxxx  xxxxxxxxxxxxxx");
                }
                else
                {
                    Console.WriteLine("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
                }

                Console.WriteLine("x                            x");
                Console.WriteLine("x    P                       x");
                Console.WriteLine("x                            x");
                if (node.neighbors.Count > 2)
                {
                    Console.WriteLine("                              ");
                    Console.WriteLine("                              ");
                }
                else
                {
                    Console.WriteLine("                             x");
                    Console.WriteLine("                             x");
                }

                int monsters = node.monsters.Count;
                for (int i = 1; i <= monsters; i++)
                {
                    Console.WriteLine("x                   M        x");
                }
                for (int i = 1; i < (node.capacity - monsters); i++)
                {
                    Console.WriteLine("x                            x");
                }
                if (node.neighbors.Count > 3)
                {
                    Console.WriteLine("xxxxxxxxxxxxxx  xxxxxxxxxxxxxx");
                }
                else
                {
                    Console.WriteLine("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
                }
                if (game.player.inCombat)
                {
                    Console.WriteLine("Type A to attack");
                }
                foreach (Item i in game.player.bag)
                {
                    if (i is Crystal)
                    {
                        hasCrystal = true;
                    }
                    if (i is HealingPotion)
                    {
                        hasHealingPotion = true;
                    }
                }
                if (hasCrystal)
                {
                    Console.WriteLine("Type C to use a crystal");
                }
                if (hasHealingPotion)
                {
                    Console.WriteLine("Type H to use a healingpotion");
                }
            }
        }
Ejemplo n.º 36
0
 private void updatePlayerInformation(GamePlay.Player p)
 {
     // update the sign into game buttons
     switch (p.color)
     {
         case client.GamePlay.Player.playerColor.blue:
             btnJoinGameBlue.Enabled = false;
             btnJoinGameBlue.Text = p.nickname;
             break;
         case client.GamePlay.Player.playerColor.yellow:
             btnJoinGameYellow.Enabled = false;
             btnJoinGameYellow.Text = p.nickname;
             break;
         case client.GamePlay.Player.playerColor.red:
             btnJoinGameRed.Enabled = false;
             btnJoinGameRed.Text = p.nickname;
             break;
         case client.GamePlay.Player.playerColor.green:
             btnJoinGameGreen.Enabled = false;
             btnJoinGameGreen.Text = p.nickname;
             break;
         case client.GamePlay.Player.playerColor.gray:
             break;
         case client.GamePlay.Player.playerColor.orange:
             break;
         default:
             break;
     }
 }
Ejemplo n.º 37
0
        private void setState(string nickname, GamePlay.GameState state, bool playerAlive)
        {
            if (tbNickName.Text == nickname)
            {
                yourTurn = true;
            }
            else
            {
                yourTurn = false;
            }

            // check if player is dead, if so display "game over"
            if (state != GamePlay.GameState.select && state != GamePlay.GameState.placeOne)
            {
                if (playerAlive == false)
                {
                    lblWonOrLost.Visible = true;
                    lblState.Text = "Game is Over!";
                    lblActivePlayer.Text = "Winner: " + nickname;
                    return;
                }
            }

            switch (state)
            {
                case client.GamePlay.GameState.waiting:
                    lblState.Text = "Waiting for players...";
                    break;
                case client.GamePlay.GameState.select:

                    // check if current client is active player
                    if (yourTurn)
                    {
                        //MessageBox.Show("it is your turn!");
                        lblState.Text = "Your turn!";
                        lblActivePlayer.Text = "Select a territory";
                    }
                    else
                    {
                        lblState.Text = "Waiting for " + nickname;
                        lblActivePlayer.Text = "to select a territory";
                    }

                    break;
                case client.GamePlay.GameState.placeOne:

                    // check if current client is active player
                    if (yourTurn)
                    {
                        lblState.Text = "Your turn!";
                        lblActivePlayer.Text = "place a troop";
                    }
                    else
                    {
                        // new state for placing the first troops
                        // after the selection phase
                        lblState.Text = "Waiting for " + nickname;
                        lblActivePlayer.Text = "placing troop";
                    }

                    break;
                case client.GamePlay.GameState.reinforce:

                    // check if current client is active player
                    if (yourTurn)
                    {
                        lblState.Text = "Your turn!";
                        lblActivePlayer.Text = "Reinforce! /nYou have x extra troops";
                    }
                    else
                    {
                        lblState.Text = "Waiting for " + nickname;
                        lblActivePlayer.Text = "placing troop";
                    }

                    break;
                case client.GamePlay.GameState.attack:

                    if (yourTurn)
                    {
                        lblState.Text = "Your turn!";
                        lblActivePlayer.Text = "Attack!";
                    }
                    else
                    {
                        lblState.Text = "Waiting for " + nickname;
                        lblActivePlayer.Text = "finishing attacking";
                    }
                    break;
                case client.GamePlay.GameState.fortify:

                    if (yourTurn)
                    {
                        lblState.Text = "Your turn!";
                        lblActivePlayer.Text = "Fortify!";
                    }
                    else
                    {
                        lblState.Text = "Waiting for " + nickname;
                        lblActivePlayer.Text = "finishing fortifying";
                    }
                    break;
                case client.GamePlay.GameState.end:

                    if (yourTurn)
                    {
                        // you won!
                        lblWonOrLost.Text = "YOU WIN";
                        lblWonOrLost.Visible = true;
                    }
                    else
                    {
                        // you lost
                        lblWonOrLost.Visible = true;

                    }

                    lblState.Text = "Game is Over!";
                    lblActivePlayer.Text = "Winner: " + nickname;
                    break;
                default:
                    break;
            }
        }
Ejemplo n.º 38
0
	// Use this for initialization
	void Start () {
		gc = GameObject.Find("GameControl").GetComponent<GameControl>();
		gp = GameObject.Find("GameControl").GetComponent<GamePlay>();
	}
Ejemplo n.º 39
0
	//private bool check,end;

	// Use this for initialization
	void Start () {
	//	gameControl = GameObject.Find("GameControl").GetComponent("GameControl") as GameControl;
		gp			= GameObject.Find("GameControl").GetComponent<GamePlay>();
		_camera		= GameObject.Find("Main Camera");
	}
Ejemplo n.º 40
0
 // Use this for initialization
 void Start()
 {
     Instance = this;
 }
Ejemplo n.º 41
0
Archivo: AI.cs Proyecto: MizzKii/WarB
	public void BombMe(Player player)
	{
		if(gamePlay == null)
			gamePlay = GameObject.Find("Scripts").GetComponent<GamePlay>();
		player.point += 100;
		if (--heart < 1 && !IsDie) {
			Death ();
		} else {
			IsDie = true;
			_animator.SetTrigger("IsShock");
			Invoke("ReShock",1f);
		}
		if(GamePlay.IsSingle || Network.isServer){
			gamePlay.AddLog(player.getName + " Bomb Enemy");
			if(heart == 0)
				gamePlay.AddLog("Enemy's Death");
			else
				gamePlay.AddLog("Enemy Heart x"+heart);
			gamePlay.AddLog(player.getName + " Get 100P");
		}
	}
Ejemplo n.º 42
0
 public void Throw()
 {
     gs = GamePlay.GetGamePlayScript();
     Logger.trace("<< Player " + thrower + " threw a grenade");
     step = Countdown;
 }
Ejemplo n.º 43
0
        /// <summary>
        /// Initializes GUI components, connections to the Heads Up Display, the video analysis,
        /// the game client, and the hardware components throught Unity.
        /// Connects
        /// </summary>
        public ClientUi()
        {
            InitializeComponent();
            _allPlayers = new List<IPlayer>();
            _analyzer = new BlobDetectionAnalysis(45, 45, 800, 800, 15, .3f, 0.5f);
            _dispMan = new DisplayManager { DisplayTimer = true, DisplaySignalStrength = true };
            _client = new GameClient();
            _player = _client.GetPlayer();
            _guid = _client.GetGuid();
            _client.PlayerEventHandler += PlayerUpdateHandler;
            _client.AllPlayersEventHandler += AllPlayersUpdateHandler;
             var config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
            UnityConfigurationSection section = (UnityConfigurationSection)config.GetSection("unity");
            _container = new UnityContainer();
            section.Configure(_container, "container");

            _gamePlay = new GamePlay(_player);
            _gameEngine = new GameEngine(_container.Resolve<IWirelessStrengthMonitor>(), _container.Resolve<IGps>(), _player, _container.Resolve<IVideoInput>());

            _signal = _container.Resolve<IWirelessStrengthMonitor>();

            _running = true;

            /* // Threads for timer and positioning updating
            _timeThread = new Thread(TimeUpdateLoop) {IsBackground = true};
            _timeThread.Start();
            _positionThread = new Thread(PositionUpdateLoop);
            _positionThread.Start();
            */

            _gameTime = new TimeSpan(0,5,0);

            _timer = new Timer(1000);
            _timer.Elapsed += gameTimeSim;
        }
Ejemplo n.º 44
0
 private void Awake()
 {
     spawnPoint = new Vector3(Random.RandomRange(0, 3), 2, Random.RandomRange(0, 3));
     instance   = this;
 }