//destoryed player/object private void OnDisable() { Destroy(playerUIInstance); if (playerUIInstance == null) { Debug.Log("destroyed UI"); } else { Debug.Log("noooo"); } // Debug.Log((playerUIInstance.active=false)?"y":"n"); // NetworkServer.Destroy(playerUIInstance); if (sceneCamera != null) { sceneCamera.gameObject.SetActive(true); Debug.Log("sceneCam active"); } GameManager1.UnregisterPlayer(transform.name); // Destroy(this.gameObject); }
private void Start() { Instance = this; serverMenu.SetActive(false); connectMenu.SetActive(false); DontDestroyOnLoad(gameObject); }
void Damaging() { if (dmgTime == true) { GameManager1.WallDmg(10); } }
// Use this for initialization void Start() { _gm = GameObject.FindGameObjectWithTag("GameManager").GetComponent <GameManager1>(); _videoPlayer = GetComponent <VideoPlayer>(); if (_videoPlayer == null) { _videoPlayer = gameObject.AddComponent <VideoPlayer>(); } _audioSource = GetComponent <AudioSource>(); if (_audioSource == null) { _audioSource = gameObject.AddComponent <AudioSource>(); } _videoPlayer.playOnAwake = false; _videoPlayer.clip = goodClip; _videoPlayer.isLooping = true; _videoPlayer.renderMode = VideoRenderMode.MaterialOverride; _videoPlayer.targetMaterialRenderer = GetComponent <Renderer>(); _videoPlayer.targetMaterialProperty = "_MainTex"; _videoPlayer.audioOutputMode = VideoAudioOutputMode.AudioSource; _audioSource.spatialize = true; _audioSource.spatialBlend = 1; _audioSource.maxDistance = 50; _audioSource.minDistance = 2; _videoPlayer.SetTargetAudioSource(0, _audioSource); _currentFrame = 0; }
// Use this for initialization void Start() { _cm = GetComponent <ChildManager>(); _gm = GameObject.FindGameObjectWithTag("GameManager").GetComponent <GameManager1>(); GameManager1.kids.Add(this); }
// GetComponent Function //This Function is mainly used for Get Component void GetComponentFunction() { if (_Rgbd == null) { _Rgbd = GetComponent <Rigidbody>(); } if (_anim == null) { _anim = GetComponentInChildren <Animator>(); } if (_capCollider == null) { _capCollider = GetComponent <CapsuleCollider>(); } if (_navMeshAgent == null) { _navMeshAgent = GetComponent <NavMeshAgent>(); } if (_gameManager1 == null) { _gameManager1 = GameObject.FindGameObjectWithTag("GameManager1").GetComponent <GameManager1>(); } if (_PopUpDamage == null) { Debug.LogError("Please Added the Pop UP Damage Effect"); } if (_SwordEffectObject == null) { Debug.Log("Please Add The Effect Object to the Script"); } }
public void CmdPlayerShot(string _playerID, int _damage) { Debug.Log(_playerID + "has been shot"); Player _player = GameManager1.GetPlayer(_playerID); _player.RpcTakeDamage(_damage); }
void Awake() { if (instance == null) { instance = this; } }
// Use this for initialization void Start() { GAME = GameObject.Find("_GAMEMANAGER").gameObject.GetComponent <GameManager1> (); if (GAME == null) { Debug.LogError("GAME MANAGER NOT FOUND"); } }
// Start is called before the first frame update void Start() { lifes = 3; nextFire = 0.0f; canMoveAndShoot = false; playerRB = gameObject.GetComponent <Rigidbody>(); gameManager = GameObject.Find("GameManager1").GetComponent <GameManager1>(); }
public override void OnStartClient() { base.OnStartClient(); string netid = GetComponent <NetworkIdentity>().netId.ToString(); Player player = GetComponent <Player>(); GameManager1.RegisterPlayer(netid, player); }
// Start is called before the first frame update void Start() { button = GetComponent <Button>(); gameManager = GameObject.Find("GameManager").GetComponent <GameManager1>(); button.onClick.AddListener(clickStart); }
GameManager1 Game; //呼叫GameManager用? private void Start() { rb = GetComponent <Rigidbody2D>(); downRotation = Quaternion.Euler(0, 0, -90); forwardRotation = Quaternion.Euler(0, 0, 35); Game = GameManager1.Instance; rb.simulated = false; }
void Awake() { if (_instance == null) { _instance = this; } SettingResolutionProblem(); }
// Use this for initialization void Start() { bowl.SetActive(false); cube.SetActive(false); bear.SetActive(false); _player = GameObject.Find("Player").GetComponent <Player>(); _gm = GameObject.FindGameObjectWithTag("GameManager").GetComponent <GameManager1>(); }
void OnTriggerEnter2D(Collider2D hitInfo) { if (hitInfo.name == "ball2") { string wallName = transform.name; GameManager1.Score(wallName); hitInfo.gameObject.SendMessage("RestartGame", 1.0f, SendMessageOptions.RequireReceiver); } }
public void CmdPlayerShot(string _playerID, float _damage) { UnityEngine.Debug.Log(_playerID + " has been shot"); Player _player = GameManager1.GetPlayer(_playerID); _player.RpcTakeDamage(_damage); Destroy(this.gameObject); }
//初始化地图 public void InitMap() { gameManager1 = this.GetComponent <GameManager1>(); mapHolder = new GameObject("Map").transform; for (int i = 0; i < cols; i++) { for (int j = 0; j < rows; j++) { if (i == 0 || j == 0 || i == cols - 1 || j == rows - 1) //外墙 { int index = Random.Range(0, OutWallArray.Length); GameObject go = GameObject.Instantiate(OutWallArray[index], new Vector2(i, j), Quaternion.identity); go.transform.SetParent(mapHolder); } else //地板 { int index = Random.Range(0, FloorArray.Length); GameObject go = GameObject.Instantiate(FloorArray[index], new Vector2(i, j), Quaternion.identity); go.transform.SetParent(mapHolder); } } } positionList.Clear(); //清空positionList for (int i = 2; i < cols - 2; i++) { for (int j = 2; j < rows - 2; j++) { positionList.Add(new Vector2(i, j)); } } //创建障碍物 食物 敌人 //创建障碍物 int WallCount = Random.Range(minCountWall, maxCountWall + 1); InstantiateItems(WallCount, WallArray); //创建食物 2~level*2 int FoodCount = Random.Range(2, gameManager1.level * 2 + 1); InstantiateItems(FoodCount, FoodArray); //创建敌人 level/2+1 int EnemyCount = gameManager1.level / 2 + 1; InstantiateItems(EnemyCount, EnemyArray); //创建出口 GameObject go1 = Instantiate(ExitPrefab, new Vector2(cols - 2, rows - 2), Quaternion.identity) as GameObject; go1.transform.SetParent(mapHolder); }
// Start is called before the first frame update void Start() { gameManager = GameObject.Find("GameManager1").GetComponent <GameManager1>(); fireRate = 3.5f; moonLives = 100; moveRight = true; move = false; hasArrived = false; StartCoroutine(WaitAndShoot()); }
//public AudioClip[] audioClip; void Start() { spawn = transform.position; if (usesManager) { manager = manager.GetComponent <GameManager1>(); } FindObjectOfType <AudioManager>().Play("BackgroundMusic"); nextSceneToLoad = SceneManager.GetActiveScene().buildIndex + 1; }
void SpawnManagers() { if (gameManager == null && itemdex == null) { Debug.LogError("no itemdex or gameManager assigned"); return; } itemdexInstance = Instantiate(itemdex); gameManagerInstance = Instantiate(gameManager); Debug.Log("successfully instantiated itemdex and gameManager"); }
void Start() { //player = GetComponent<Rigidbody>(); player = GetComponent <Rigidbody2D>(); PowerUpTimer = 0; facingRight = true; theGameManager = FindObjectOfType <GameManager1>(); myAnimator = GetComponent <Animator>(); }
private void Awake() { if (instance != null) { Debug.LogError("More than one gamemanager" + transform.name); } else { instance = this; } }
void Spawn2() { if (Spawning == true) { Instantiate(Enemies [1], SpawnPos, this.transform.rotation); EnLeft--; GameManager1 gm1 = GameObject.Find("GameManager").GetComponent <GameManager1>(); gm1.EnemiesLeft = EnLeft; //SpawnPos = new Vector3 (this.transform.position.x + (Random.Range(-15,15)), this.transform.position.y, this.transform.position.z); } }
void _MakeInstance() { if (instance != null) { Destroy(gameObject); } else { instance = this; DontDestroyOnLoad(gameObject); } }
void Awake() { if (Instance == null) { DontDestroyOnLoad(gameObject); Instance = this; } else if (Instance != this) { Destroy(gameObject); } }
private void Awake() { if (_instance == null) { _instance = this; DontDestroyOnLoad(this); } else { Destroy(gameObject); } }
// Use this for initialization void Start() { _completeness = 0; _fullCompleteness = 100; _fallOffSpeed = 30; _increaseSpeed = 8; _player = GameObject.Find("Player").GetComponent <Player>(); _em = cleanParticle.emission; _em.rateOverTime = 0; gameManager = GameObject.FindGameObjectWithTag("GameManager").GetComponent <GameManager1>(); }
// Start is called before the first frame update void Start() { //load game manager gameManager = GameObject.Find("Pixel UI Canvas").GetComponent <GameManager1>(); //load animator animator = GetComponent <Animator>(); //load rigidbody rigidBody = GetComponent <Rigidbody2D>(); //load body size bodySize = GetComponent <BoxCollider2D>().size; //load body center bodyCenter = GetComponent <BoxCollider2D>().offset; }
// Update is called once per frame void Update() { SpawnPos = new Vector3(this.transform.position.x + (Random.Range(-30, 30)), this.transform.position.y, this.transform.position.z); if (EnLeftToKill <= 0) { if (EnLeft < 0) { EnLeft = 0; GameManager1 gm1 = GameObject.Find("GameManager").GetComponent <GameManager1> (); gm1.EnemiesLeft = EnLeft; } StartCoroutine(EndL()); } }
// Use this for initialization void Start() { if(autoSetup == true){ gameManager = GameObject.FindGameObjectWithTag("GameController").GetComponent<GameManager1>(); playerCtrlSetup = GameObject.FindGameObjectWithTag("GameController").GetComponent<PlayerCtrlSetup>(); } }