public BotControler(ConnectedHost host, Logger logg) { mLogg = logg; mHost = host; Login = new LoginControler(mHost); Game = new GameControler(mHost, logg); }
// Update is called once per frame void Update() { _TimeCount += Time.deltaTime; if (_TimeCount > 0.5f) { _TimeCount = 0; int ran = Random.Range(0, _PosParticle.Length); Instantiate(particle_cross, _PosParticle[ran].transform.position, Quaternion.identity); } _TimeAddHealth += Time.deltaTime; if (_TimeAddHealth > 0.2f && _Health > 0) { _TimeAddHealth = 0; _Health -= 2; Player player = gameObject.GetComponentInParent <Player>(); player._Health += 2; if (player._Health > 100) { player._Health = 100; } NumberText textHealth = player.gameObject.GetComponentInChildren <NumberText>(); textHealth.SetNumberText(player._Health); GameControler gameControler = FindObjectOfType <GameControler>(); if (_Health <= 0) { if (gameControler._GameObj.tag == "Enemy") { gameControler.ChangeTurn(); } Destroy(gameObject); } } }
// Start is called before the first frame update void Start() { ControladorDOJogo = GameObject.FindGameObjectWithTag("GameController").GetComponent <GameControler>(); if (ControladorDOJogo.InformaSom() == 1) { EstadoAudio = true; } else { EstadoAudio = false; } if (EstadoAudio == true) { MeuBotao.sprite = spriteligado; MeuMixer.SetFloat("MixerGeral", 0); } else { MeuBotao.sprite = spritedesligado; MeuMixer.SetFloat("MixerGeral", -80); } fontedesom = GetComponent <AudioSource>(); }
// Use this for initialization void Start() { _GameControler = FindObjectOfType <GameControler>(); _GameManager = FindObjectOfType <GameManager>(); _UIManager = FindObjectOfType <UIManager>(); _SoundControler = FindObjectOfType <SoundControler>(); }
void Start() { rb = GetComponent <Rigidbody> (); playerHealth = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerHealth> (); gameControler = GameObject.FindGameObjectWithTag("GameController").GetComponent <GameControler> (); Destroy(gameObject, destroy_after); }
private void OnTriggerEnter2D(Collider2D collision) { if (collision.gameObject.name == "PlayerCalabaza") { // PLAYERPREFS ES COMO UN DICIONARIO PlayerPrefs.SetFloat("X", this.transform.position.x); PlayerPrefs.SetFloat("Y", this.transform.position.y); // RECOGER LA PUNTUACION //int puntuacion = player.GetComponent<PlayerScript>().puntos; int puntuacion = collision.gameObject.GetComponent <PlayerScript>().GetPuntos(); // print("puntos cuando colisiona con player GUARDADOS "+puntuacion); // RECOGER LOS CARAMELOS txtCaramelo = GameObject.Find("TextoCaramelo").GetComponent <Text>(); // LO SALVAMOS PlayerPrefs.Save(); // LLAMAMOS AL GAMECONTROLER GameControler.StorePosicion(collision.gameObject.transform.position); GameControler.StorePuntos(puntuacion); GameControler.StoreCaramelos(txtCaramelo.text); // SONIDO CUANDO LE DA EL PLAYERCALABAZA gameObject.GetComponent <AudioSource>().Play(); // DESTRUIMOS EL OBJETO Destroy(this.gameObject); } }
private void OnTriggerStay2D(Collider2D collision) { if (collision.gameObject.GetComponent <Character>() && !collision.gameObject.GetComponent <Character>().isUnmatched) { GameControler.getInstance().gameOver(); } }
private void HandleStartGameResult(int id, JsonData msg) { int sceneType = msg.GetInt("m_SceneType"); uint key = msg.GetUint("m_Key"); string ip = msg.GetString("m_ServerIp"); int port = msg.GetInt("m_ServerPort"); int heroId = msg.GetInt("m_HeroId"); int campId = msg.GetInt("m_CampId"); int weaponId = msg.GetInt("m_WeaponId"); int sceneId = msg.GetInt("m_SceneType"); Data_SceneConfig cfg = SceneConfigProvider.Instance.GetSceneConfigById(sceneType); if (null == cfg || cfg.m_Type == (int)SceneTypeEnum.TYPE_PVE) { NetworkSystem.Instance.HeroId = heroId; NetworkSystem.Instance.CampId = campId; NetworkSystem.Instance.SceneId = sceneId; } else { NetworkSystem.Instance.Start(key, ip, port, heroId, campId, sceneId); } GameControler.ChangeScene((int)msg["m_SceneType"]); GfxSystem.GfxLog("HandleStartGameResult"); }
private void OnDestroy() { if (GameControler.instance == this) { GameControler.instance = null; } }
void Start() { float enemySpeedBoost; GameObject gameControlerObject = GameObject.FindWithTag("GameController"); if (gameControlerObject == null) { Debug.Log("coludent find game controller"); } gameControlerScript = gameControlerObject.GetComponent <GameControler> (); if (gameControlerScript == null) { Debug.Log("coludent find game script controler"); } rb = GetComponent <Rigidbody>(); if (CompareTag("Enemy")) { enemySpeedBoost = Random.Range(0, (gameControlerScript.waveCount - 1)) * gameControlerScript.waveSpeedFactor; } else { enemySpeedBoost = 0; } rb.velocity = transform.forward * (speed - enemySpeedBoost); }
private void Start() { gameControler = FindObjectOfType <GameControler>(); rb = GetComponent <Rigidbody2D>(); Accelerate(); }
// Use this for initialization void Start() { instance = this; countDownUpdate = Time.time; loadMap(); }
//取得旗子 public IEnumerator getFlag(Collider2D collision) { GameControler.getInstance().GameOver = true; collision.GetComponent <Rigidbody2D>().bodyType = RigidbodyType2D.Static; collision.GetComponentInChildren <Animator>().SetBool("isGetFlag", true); yield return(new WaitForSeconds(0.15f)); AudioControler.getInstance().stopAllBGM(); collision.GetComponent <Rigidbody2D>().bodyType = RigidbodyType2D.Dynamic; collision.GetComponent <Rigidbody2D>().constraints = RigidbodyConstraints2D.FreezePositionX | RigidbodyConstraints2D.FreezeRotation; AudioControler.getInstance().SE_SYS_GOAL_FLAG.Play(); yield return(new WaitForSeconds(1)); AudioControler.getInstance().SE_course_clear.Play(); playAnimSwitch = true; ob = collision; yield return(new WaitForSeconds(1.5f)); AudioControler.getInstance().SE_VOC_MA_CLEAR_NORMAL.Play(); //取分、取耗时 => 排行榜 GameControler.getInstance().countScoreTime(); yield return(new WaitForSeconds(3)); GameControler.getInstance().balanceScoreSwitch = true; }
private void CustomNetWorkThread(int pharse) { if (m_IsWaitStart) { return; } if (pharse == 1) { if (!m_IsQuited && !m_IsConnected && !m_IsWaitStart) { LogSystem.Debug("Connect ip:{0} port:{1} key:{2}\nNetPeer Statistic:{3}", m_Ip, m_Port, m_Key, m_NetClient.Statistics.ToString()); GameControler.NotifyRoomServerDisconnected(); try { m_NetClient.Connect(m_Ip, m_Port); } catch { } for (int ct = 0; ct < 10 && !m_IsConnected; ++ct) { OnRecvMessage(); LogSystem.Debug("Wait NetConnectionStatus.Connected ..."); if (!m_IsConnected) { Thread.Sleep(1000); } } } OnRecvMessage(); } }
void _MakeInstance() { if (instance == null) { instance = this; } }
// Use this for initialization void Start() { _GameControler = FindObjectOfType <GameControler>(); gameObject.transform.position = new Vector3(transform.position.x, transform.position.y, -1); _UIManager = FindObjectOfType <UIManager>(); _SoundControler = FindObjectOfType <SoundControler>(); }
private void Start() { gameController = FindObjectOfType <GameControler>(); gameController.trackingHandler.OnTrackFound += OnTrackFound; gameController.trackingHandler.OnTrackLost += OnTrackLost; SetActionsForButtons(); }
// Use this for initialization internal void Start() { Application.targetFrameRate = 60; QualitySettings.vSyncCount = 1; QualitySettings.SetQualityLevel(1); try { if (!GameControler.IsInited) { Application.runInBackground = true; string dataPath = Application.dataPath; string persistentDataPath = Application.persistentDataPath; string streamingAssetsPath = Application.streamingAssetsPath; string tempPath = Application.temporaryCachePath; LogicSystem.GfxLog("dataPath:{0} persistentDataPath:{1} streamingAssetsPath:{2} tempPath:{3}", dataPath, persistentDataPath, streamingAssetsPath, tempPath); #if UNITY_ANDROID GameControler.InitGame(tempPath, streamingAssetsPath); #elif UNITY_IPHONE GameControler.InitGame(tempPath, streamingAssetsPath); #else GameControler.InitGame(dataPath, streamingAssetsPath); #endif GlobalVariables.Instance.IsMobile = true; GameControler.StartGame(); LogicSystem.SetLoadingBarScene("LoadingBar"); //LogicSystem.PublishLogicEvent("ge_change_scene", "game", 6); Application.LoadLevel("Loading"); } } catch (Exception ex) { LogicSystem.GfxLog("GameLogic.Start throw exception:{0}\n{1}", ex.Message, ex.StackTrace); } }
void Awake() { instance = this; startPanel.SetActive(true); ship.SetActive(false); enemies.SetActive(false); }
/// <summary> /// Specific User Input Treatement /// </summary> /// <param name="gm"></param> public override void Update(GameControler gm) { Console.WriteLine("Press any key..."); Console.ReadKey(); Console.WriteLine(""); Console.WriteLine(""); Console.WriteLine("~~~~~~~~~~~~~~~~~~~~~~~~~~"); int playeronescore = gm.PlayerList[0].ReadWinCounter(); int playertwoscore = gm.PlayerList[1].ReadWinCounter(); if (playeronescore == playertwoscore) { Console.WriteLine("None...(Drawn Match)"); } else { Console.WriteLine(" " + ((playeronescore > playertwoscore) ? gm.PlayerList[0].GetName() : gm.PlayerList[1].GetName())); } Console.WriteLine("~~~~~~~~~~~~~~~~~~~~~~~~~~"); Console.WriteLine("Press any key..."); Console.ReadKey(); gm.RemoveAllPlayer(); gm.GoToScene("MainMenu"); }
public void fallDownDie() { if (transform.position.y < -15) { GameControler.getInstance().gameOver(); } }
// Start is called before the first frame update void Start() { gameControler = FindObjectOfType <GameControler>(); //encontra o objeto especificado //inicia gameObjects playerAnimator = GetComponent <Animator>(); playerRB = GetComponent <Rigidbody2D>(); playerSpriteRender = GetComponent <SpriteRenderer>(); //inicia arma, desativada foreach (GameObject o in armas) { o.SetActive(false); } foreach (GameObject o in arcos) { o.SetActive(false); } foreach (GameObject o in staffs) { o.SetActive(false); } //TrocarArma(); //inicia informações do GameControler ao trocar de cena vidaMaxima = gameControler.vidaMaxima; vidaAtual = vidaMaxima; //idArma = gameControler.idArma; }
static void Main(string[] args) { // Instanciate GameControler Screen MainMenu mainmenu = new MainMenu(); PlayMenu playmenu = new PlayMenu(); GameoverMenu gameovermenu = new GameoverMenu(); // Instanciate the GameControler Manager GameControler gamescreenControler = new GameControler(); // Add all scene in the GameControler Manager gamescreenControler.AddScene("MainMenu", mainmenu); gamescreenControler.AddScene("PlayMenu", playmenu); gamescreenControler.AddScene("GameoverMenu", gameovermenu); gamescreenControler.OnSceneEntry += new GameControler.SceneEntry(gameControlerOnScreenEntry); gamescreenControler.OnExit += new GameControler.Exit(gameControlerOnScreenExit); // Start with Main Menu (Root Menu) gamescreenControler.GoToScene("MainMenu"); while (GameRunning) { gamescreenControler.SceneUpdate(); } return; }
void Update() { if (Instance != this) { Instance = this; } if (roundOver) { CheckLevelRestart(); return; } time -= Time.deltaTime; if (time <= 0) { time = 0; CheckTimeWin(); } int minutes = (int)time / 60; int seconds = (int)time % 60; if (seconds >= 10) { timer.text = "" + minutes + ":" + seconds; } else { timer.text = "" + minutes + ": 0" + seconds; } }
// Use this for initialization void Start() { mGameControler = GetComponent <GameControler>(); // 当现实加注时,设置点击空白处使raiseHandle部分隐藏,betHandle部分显示 GameObject.Find("Desktop").GetComponent <Button>().onClick.AddListener(() => { if (raiseHandle.active) { currentType = BET_HANDLE; } if (menuList.active) { PopMenu(false); } if (cardBoardObj.active) { PopCardBoard(false); } if (mFuncOptionsObj.active) { PopupChatView(false); PopupPreGameView(false); } }); }
private IEnumerator contactFunc(Collider2D collision) { if (!isContact) { if (collision.GetComponent <Character>() && !collision.GetComponent <Character>().isUnmatched) { isContact = true; playAnim = true; Destroy(GetComponent <CircleCollider2D>()); Destroy(GetComponent <SpriteRenderer>()); Destroy(GetComponent <Rigidbody2D>()); StartCoroutine(GameControler.getInstance().ScoreUIControl(500, transform.position, 0)); collision.GetComponent <Character>().isUnmatched = true; AudioControler.getInstance().stopAllBGM(); AudioControler.getInstance().SE_PLY_CHANGE_BIG.Play(); yield return(new WaitForSeconds(.2f)); AudioControler.getInstance().SE_VOC_GET_STAR.Play(); yield return(new WaitForSeconds(.2f)); AudioControler.getInstance().BGM_MarioKartStar.Play(); yield return(new WaitForSeconds(17.5f)); if (!GameControler.getInstance().GameOver) { AudioControler.getInstance().SE_STAR_FINISH.Play(); } yield return(new WaitForSeconds(1)); if (!GameControler.getInstance().GameOver) //加判断 { AudioControler.getInstance().stopAllBGM(); AudioControler.getInstance().BGM_Ground.Play(); } collision.GetComponent <Character>().isUnmatched = false; ob_light.GetComponent <Light>().color = Color.white; Destroy(gameObject); } else if (collision.GetComponent <Character>() && collision.GetComponent <Character>().isUnmatched) //无敌不会附加 { isContact = true; Destroy(GetComponent <CircleCollider2D>()); Destroy(GetComponent <SpriteRenderer>()); Destroy(GetComponent <Rigidbody2D>()); AudioControler.getInstance().SE_VOC_GET_STAR.Play(); StartCoroutine(GameControler.getInstance().ScoreUIControl(1000, transform.position, 0)); Destroy(gameObject, 3); } } }
void Start() { gameControler = FindObjectOfType <GameControler>(); LoadBlocks(); Pathfind(); //ColorStartAndEnd(); StartEnemyMovement(); }
void Awake() { Move = GetComponent <Move> (); Fire = GetComponentInChildren <Fire> (); currentHealth = startingHealth; restart.text = ""; gameControler = GameObject.FindGameObjectWithTag("GameController").GetComponent <GameControler> (); }
// Start is called before the first frame update void Start() { gameControler = FindObjectOfType(typeof(GameControler)) as GameControler; rigidbody2D = GetComponent <Rigidbody2D>(); animator = GetComponent <Animator>(); // gameControler.player = this.transform; StartCoroutine("warrioWalk"); }
public void SaltoAlVacio() { // OBTENEMOS LA POSICION DEL PLAYER Vector2 posicion = GameControler.GetPosition(); // PONEMOS LA POSICION QUE TENIA ANTERIORMENTE EN EL JUEGO gameObject.transform.position = posicion; }
void Awake () { if (control == null){ DontDestroyOnLoad(gameObject); control = this; } else if (control != this){ Destroy(gameObject); } }
void Start() { GameObject gameControlerObject = GameObject.FindWithTag ("GameController"); if (gameControlerObject != null) { gameControler = gameControlerObject.GetComponent <GameControler>(); } if (gameControler == null) { Debug.Log ("Cannot find 'GameController' script"); } }
void Start() { //OBIEKT DO ODSZUKANIA GameController GameObject gameControlerComponent = GameObject.FindWithTag("GameController") ; //JESLI SZUKANIE SIE POWIODLO TO PRZYPISUJEMY COMPONENT DO OBIEKTU if( gameControlerComponent != null ) { gameController = gameControlerComponent.GetComponent<GameControler>() ; } //JESLI NIE ZNALEZLISMY LUB PRZYPISANIE SIE NIE POWIODLO WYSWIETLAMY TEKST if(gameController == null) { Debug.Log( "gameControler can't find Component GameControler" ) ; } }
void Awake() { _levelStarted = false; _instance = this; _spaceShip = GameObject.FindGameObjectWithTag("Player"); }
public void SetPlayerState(ActorState newState, GameControler.PlayerEventArgs e) { if (canChangeState) { FacingDirection = e.Direction.GetVector(FacingDirection); State = newState; } else if (newState.Name == JumpingState.Name || newState.Name == WalkingState.Name) { if (e.Direction.GetName() != GameControler.Directions.Static.GetName()) { FacingDirection = e.Direction.GetVector(FacingDirection); var s = Math.Sign(PolyBody.Velocity.X); var t = s * MaxFlySpeed - PolyBody.Velocity.X; if (Math.Abs(t) <= MaxFlySpeed) // { PolyBody.Velocity += FacingDirection * new Vector2(MaxFlySpeed / 10, 0); // move.f = WalkForce * FacingDirection * Vector2.UnitX; } else if (Math.Abs(PolyBody.Velocity.X) >= MaxFlySpeed) { PolyBody.Velocity = new Vector2(FacingDirection.X * MaxFlySpeed, PolyBody.Velocity.Y); } } } else { changeToDirection = e.Direction.GetVector(FacingDirection); changeToState = newState; } }
void Start() { StartDamage = false ; //USTAWIAMY ZYCIE ORAZ ILOSC ODEJMOWANEGO ZYCIA PO TRAFIENIU healthCurrent = 1.0f ; removeHealth = healthCurrent / health ; //Debug.Log ( "healthCurrent " + healthCurrent + " removeHealth " + removeHealth ) ; //OBIEKT DO ODSZUKANIA GameController GameObject gameControlerComponent = GameObject.FindWithTag("GameController") ; //JESLI SZUKANIE SIE POWIODLO TO PRZYPISUJEMY COMPONENT DO OBIEKTU if( gameControlerComponent != null ) { gameController = gameControlerComponent.GetComponent<GameControler>() ; } //JESLI NIE ZNALEZLISMY LUB PRZYPISANIE SIE NIE POWIODLO WYSWIETLAMY TEKST if(gameController == null) { Debug.Log( "gameControler can't find Component GameControler" ) ; } if( (Random.Range(0 , 100)) % 2 == 0 ) { Drop = true ; //LOSUJEMY ITEMA int numberBonus = Random.Range( 0 , BonusItem.Length ) ; //USTAWIAMY WYLOSOWANEGO ITEMA DropItem = BonusItem[numberBonus] ; } else Drop = false ; }
void Start() { HealtText = health ; UpdateText() ; //USTAWIAMY ZYCIE ORAZ ILOSC ODEJMOWANEGO ZYCIA PO TRAFIENIU healthCurrent = 1.0f ; removeHealth = healthCurrent / health ; //USTAWIAMY NABOJE shot = shotBolt ; //CZYM OBECNIE STRZELAMY Sphere = false ; TwoBolt = false ; ThreeBolt = false ; //OBIEKT DO ODSZUKANIA GameController GameObject gameControlerComponent = GameObject.FindWithTag("GameController") ; //JESLI SZUKANIE SIE POWIODLO TO PRZYPISUJEMY COMPONENT DO OBIEKTU if( gameControlerComponent != null ) { gameController = gameControlerComponent.GetComponent<GameControler>() ; } //JESLI NIE ZNALEZLISMY LUB PRZYPISANIE SIE NIE POWIODLO WYSWIETLAMY TEKST if(gameController == null) { Debug.Log( "gameControler can't find Component GameControler" ) ; } }