void Awake () { OurUIScript = GetComponent<UIScript> (); OurPlayerSpawner = GameObject.Find("PlayerSpawn").GetComponent<Player> (); enemyGenerator = GameObject.Find("Enemy Generator").GetComponent<EnemyGenerate> (); itemSpawner = GameObject.Find ("Item Spawner").GetComponent<ItemSpawn> (); }
void changeLayer() //GameScene 넘어가기 전 무기 Layer 변경: Touchable -> weapon { layerChange = GM.gameObject.GetComponent <LayerChange>(); s_itemSpawn = GameObject.Find("itemSpawn").GetComponent <ItemSpawn>(); int itemSpawnLens = s_itemSpawn.itemSpawn.Length; GameObject[] Items = GameObject.FindObjectsOfType(typeof(GameObject)) as GameObject[]; int len = Items.Length; touchableItems = new GameObject[itemSpawnLens]; int idx = 0; for (int i = 0; i < len; i++) { if (Items[i].layer == (int)eLAYER.TOUCHABLE) { touchableItems[idx] = Items[i]; if (touchableItems[idx].tag == "weapon") { layerChange.InputWeaponArr(touchableItems[idx]); } idx++; } } }
public void Interact() { InteractableElement skript = _current_collided_object.GetComponent <InteractableElement>(); if (skript) { if (skript.Type == "Table") { Table table = _current_collided_object.GetComponent <Table>(); if (!table.isOccupied) { //leave item if (_current_item) { table.SpawnObject(_current_item); _current_item = null; _holding_item = null; Item item = GetComponentInChildren <Item>(); Destroy(item.gameObject); } } else { //take item if (!_current_item) { takeItem(table.TakeObject()); } } } if (skript.Type == "spawn") { ItemSpawn spawn = _current_collided_object.GetComponent <ItemSpawn>(); if (spawn._canSpawn && !_current_item) { takeItem(spawn.getItem()); } } //Machine if (_curr_machine) { if (!_curr_machine.is_occupied) { _curr_machine.PutItem(_holding_item.gameObject); _current_item = null; _holding_item = null; Item item = GetComponentInChildren <Item>(); Destroy(item.gameObject); } else { takeItem(_curr_machine.RemoveItem()); } } } }
void Awake() { highlightBox = transform.Find("chkHighlight").gameObject; playerRigid = GetComponent <Rigidbody>(); nowRot = transform.localRotation; playerCamera = GameObject.Find("Camera").GetComponent <Camera>(); cameraAni = playerCamera.GetComponent <Animator>(); playerAniCon = GetComponent <AnimationController>(); sceneName = SceneManager.GetActiveScene().name; if (sceneName == "ItemCollectScene") { playerSpeed = 3; s_itemBtn = GameObject.Find("itemBtnCanvas/btn_GetItem").GetComponent <ItemBtn>(); canvas = GameObject.Find("Canvas"); Block = null; } else if (sceneName == "GameScene") { DontDestroyOnLoad(transform.parent); GM = GameObject.Find("GameMgr2/itemFieldCntrl").GetComponent <ItemFieldCntrl>(); sockServObj = GameObject.Find("GameMgr2/MatchingCntrl"); playerInfo = sockServObj.GetComponent <GameEnterScript>(); weaponNum = playerInfo.savCharInfo.weapon; spawnInfo = sockServObj.GetComponent <SpawnScript>(); shotMgr = GetComponentInChildren <ShotManager>(); shotMgr.ShotPosChange(weaponNum); shotMgr.point = GameObject.Find("PointPrefab"); shotMgr.point.SetActive(false); StartCoroutine(MoveDelay()); //플레이어의 정보 전송하는 코루틴 hpText = GameObject.Find("Canvas").transform.GetChild(0).GetComponent <Text>(); playerHPBar = GameObject.Find("Canvas").transform.GetChild(3).GetComponent <HpBar>(); Block = GameObject.Find("Canvas").transform.GetChild(4).gameObject; s_itemSpawn = GameObject.Find("itemSpawnArr").GetComponent <ItemSpawn>(); s_hitEffect = GameObject.Find("HitEffect").GetComponent <hitEffect>(); ChinkEffect = GameObject.Find("ChinkEffect"); ItemImg = new GameObject[4]; ItemImg[(int)eITEM.em_HP_POTION] = GameObject.Find("HpPotionImg").gameObject; ItemImg[(int)eITEM.em_SPEED_POTION] = GameObject.Find("SpdPotionImg").gameObject; ItemImg[(int)eITEM.em_DAMAGE_UP_POTIOM] = GameObject.Find("AtkPotionImg").gameObject; ItemImg[(int)eITEM.em_DEFENCE_UP_POTION] = GameObject.Find("DefPotionImg").gameObject; for (int i = 0; i < 4; i++) { ItemImg[i].SetActive(false); } sound = GameObject.Find("GameMgr").GetComponent <BgmController>(); effSound = gameObject.GetComponentInChildren <EffSoundController>(); } }
/** * Receive the items from the server and call a random ItemSpawn-er to spawn them client-side. * */ public unsafe void ReceiveItems(IntPtr pkt) { ItemShip shipment = (ItemShip)Marshal.PtrToStructure(pkt, typeof(ItemShip)); ItemSpawn spawner = FindObjectOfType <ItemSpawn>(); byte[] itemType = new byte[shipment.numItems]; float[] rotVelocity = new float[shipment.numItems]; Marshal.Copy((IntPtr)shipment.itemType, itemType, 0, shipment.numItems); // thank stack: https://stackoverflow.com/a/17569560 Marshal.Copy((IntPtr)shipment.rotVelocity, rotVelocity, 0, shipment.numItems); StartCoroutine(spawner.Spawn(shipment.numItems, shipment.location, itemType, shipment.trajectory, rotVelocity)); }
void Start() { PV = FindObjectOfType <PlayerValue>(); trafficManager = FindObjectOfType <TrafficLightsScripts>(); itemsSpawn = FindObjectOfType <ItemSpawn>(); time = 0f; PV.colorOfPlayer = PlayerPrefs.GetInt("colorOfPlayer"); charGWalking.SetActive(false); charYWalking.SetActive(false); charRWalking.SetActive(false); ChooseColor(); }
void Start() { DontDestroyOnLoad(transform.parent); playerAniCon = GetComponent <AnimationController>(); weaponType = GetComponent <HeroCustomize>().IndexWeapon.CurrentType; shotMgr = GetComponentInChildren <ShotManager>(); shotMgr.ShotPosChange(weaponType); hpText = GameObject.Find("Canvas").transform.GetChild(1).GetComponent <Text>(); enemyHpBar = transform.Find("Canvas").transform.GetChild(0).GetComponent <HpBar>(); s_itemSpawn = GameObject.Find("itemSpawnArr").GetComponent <ItemSpawn>(); effSound = gameObject.GetComponentInChildren <EffSoundController>(); }
private void Start() { _shipCondition = GetComponentInParent <ShipCondition>(); _particleSystem = GetComponentsInChildren <ParticleSystem>(); _spawnPos = GetComponentInChildren <ItemSpawn>(); _audioPool = FindObjectOfType <AudioSourcePoolManager>(); if (_spawnPos == null) { Debug.LogError("Missing spawn position script on children objects. You need to create a child game object and assign ItemSpawn script to it"); } }
void Start() { // get the ScoreText scores = (ScoreText)GetComponent("ScoreText"); // get the Spawner spawner = (ItemSpawn)GetComponent("ItemSpawn"); // Have the winner text displayed be nothing winner = ""; // The game is not over at the start gameOver = false; shovel = GameObject.FindGameObjectWithTag("Shovel"); }
// Start is called before the first frame update void Start() { item = gameObject.GetComponent <ItemSpawn>(); if (PlayerPrefs.HasKey("Inv1")) { int1 = PlayerPrefs.GetInt("Inv1"); } else { PlayerPrefs.SetInt("Inv1", int1); } }
void Awake() { highlightBox = transform.Find("chkHighlight").gameObject; playerRigid = GetComponent <Rigidbody>(); nowRot = transform.localRotation; playerCamera = GameObject.Find("Camera").GetComponent <Camera>(); cameraAni = playerCamera.GetComponent <Animator>(); playerAniCon = GetComponent <AnimationController>(); sceneName = SceneManager.GetActiveScene().name; if (sceneName == "ItemCollectScene") { playerSpeed = 3; s_itemBtn = GameObject.Find("itemBtnCanvas/btn_GetItem").GetComponent <ItemBtn>(); canvas = GameObject.Find("Canvas"); block = null; } else if (sceneName == "GameScene") { DontDestroyOnLoad(transform.parent); GM = GameObject.Find("GameMgr2/itemFieldCntrl").GetComponent <ItemFieldCntrl>(); sockServObj = GameObject.Find("GameMgr2/MatchingCntrl"); playerInfo = sockServObj.GetComponent <GameEnterScript>(); weaponNum = playerInfo.savCharInfo.weapon; spawnInfo = sockServObj.GetComponent <SpawnScript>(); usedItemEff = GameObject.Find("usedItemEff").GetComponent <Image>(); usedItemEff.gameObject.SetActive(false); Info = GameObject.Find("Info"); Info.transform.GetChild(weaponNum + 1).gameObject.SetActive(true); shotMgr = GetComponentInChildren <ShotManager>(); shotMgr.ShotPosChange(weaponNum); shotMgr.point = GameObject.Find("PointPrefab"); shotMgr.point.SetActive(false); StartCoroutine(MoveDelay()); //플레이어의 정보 전송하는 코루틴 playerHPBar = GameObject.Find("Canvas/playerHP").GetComponent <HpBar>(); block = GameObject.Find("Canvas/Block").gameObject; block.SetActive(false); s_itemSpawn = GameObject.Find("itemSpawnArr").GetComponent <ItemSpawn>(); s_hitEffect = GameObject.Find("HitEffect").GetComponent <hitEffect>(); ChinkEffect = GameObject.Find("ChinkEffect"); usedItemParticle = transform.Find("ItemEffect").GetComponentInChildren <ParticleSystem>(); usedItemParticleRender = transform.Find("ItemEffect").GetComponentInChildren <ParticleSystemRenderer>(); sound = GameObject.Find("GameMgr").GetComponent <BgmController>(); effSound = gameObject.GetComponentInChildren <EffSoundController>(); } }
void RpcItemDestroy_(int id) { GameObject[] items = GameObject.FindGameObjectsWithTag("Item"); foreach (GameObject item in items) { if (item.GetComponent <ItemInformation>().number == id) { ItemSpawn Item_Manager = GameObject.Find("SpawnManager").GetComponent <ItemSpawn>(); StartCoroutine(Item_Manager.Spawn(item.transform.position, UnityEngine.Random.Range(0, Item_Manager.ItemObject.Length))); Destroy(item); break; } } }
void OnTriggerEnter2D(Collider2D other) { if (other.tag == "Player") { PV.sumGetItem += 1; ItemSpawn.PushUsedItem(gameObject); if (itemtype == ItemType.police) { PV.policePoint = 1; SoundManager.Play(SoundType.ItemEquip); } else if (itemtype == ItemType.sunglass) { PV.sunglassPoint = 1; SoundManager.Play(SoundType.ItemEquip); } else if (itemtype == ItemType.ion) { PV.burningPoint += 12; SoundManager.Play(SoundType.ItemBurning); //Debug.Log ("버닝 포인트 12 증가"); } else if (itemtype == ItemType.energy) { PV.burningPoint += 30; SoundManager.Play(SoundType.ItemBurning); //Debug.Log ("버닝 포인트 30 증가"); } else if (itemtype == ItemType.water) { //PV.scrollSpeed *= 0.8f; SoundManager.Play(SoundType.ItemSpeed); SlowSpeedTemp(0.8f, 3f); } else if (itemtype == ItemType.coffee) { //PV.scrollSpeed *= 0.6f; SoundManager.Play(SoundType.ItemSpeed); //ChangeInitTime(0.0f); SlowSpeedTemp(0.6f, 3f); } } }
// Update is called once per frame void Update() { foreach (GameObject item in ItemList) { ItemSpawn spawn = item.GetComponent <ItemSpawn> (); if (spawn.canBeInstantiate(Time.deltaTime) == true) { if (spawn.spawnPatern == ItemSpawn.SpawnPatern.SINGLE) { SpawnSingle(item); } else if (spawn.spawnPatern == ItemSpawn.SpawnPatern.WALL) { SpawnWall(item); } } } }
// Start is called before the first frame update void Start() { //set Spawn's mesh components spawnMeshF = Spawn.GetComponent <MeshFilter>(); spawnMeshR = Spawn.GetComponent <MeshRenderer>(); nameList = GameObject.FindGameObjectWithTag("GameController").GetComponent <Gameplayloop>().allItems; iS = GameObject.FindGameObjectWithTag("GameController").GetComponent <ItemSpawn>(); playerNumber = GetComponent <MovementTest>().playerNumber; foreach (string str in localItems) { AlllocalItems.Add(str); } foreach (RawImage basketIcon in basketListIcons) { basketIcon.texture = null; basketIcon.color = Color.clear; } }
void Start() { if (scene.name == "ItemCollectScene") // touchable layer(10)인 오브젝트 정보 저장 { fullItem = canvas.transform.Find("fullItemMSG").gameObject; ItemSpawn s_itemSpawn = GameObject.Find("itemSpawn").GetComponent <ItemSpawn>(); int itemSpawnLens = s_itemSpawn.itemSpawn.Length; GameObject[] Items = GameObject.FindObjectsOfType(typeof(GameObject)) as GameObject[]; int len = Items.Length; touchableItems = new GameObject[itemSpawnLens]; int idx = 0; for (int i = 0; i < len; i++) { if (Items[i].layer == 10) { touchableItems[idx] = Items[i]; idx++; } } } }
public void StartNewRound(bool showRules, string teamScored) { roundStarted = false; allPlayers.ForEach(p => { p.Reset(); p.frozen = true; }); flag.Reset(); (GameObject.FindObjectsOfType(typeof(Turret)) as Turret[]) .ToList() .ForEach(t => t.Deactivate()); (GameObject.FindGameObjectsWithTag("ItemPickup") as GameObject[]) .ToList() .ForEach(Destroy); timePassed = 0; foreach (GameObject spawnpt in GameObject.FindGameObjectsWithTag("ItemSpawn")) { ItemSpawn its = spawnpt.GetComponent <ItemSpawn>(); its.spawned = false; } StartCoroutine(CountdownCoroutine(showRules, teamScored)); }
void Start() { if (!isServer) { GetComponent <ItemSpawn>().enabled = false; } Spawner = GameObject.Find("ItemSpawnPoint").transform; if (m_Instance != null) { Debug.LogError("More than one GameManager in scene"); } else { m_Instance = this; } if (isServer) { for (int i = 0; i < Spawner.childCount; i++) { StartCoroutine(Spawn(Spawner.GetChild(i).transform.position, Random.Range(0, ItemObject.Length))); } } }
/// <summary> /// Adds the specified message. /// </summary> /// <param name="message">The message.</param> /// <param name="vector3">The vector3.</param> /// <param name="stackPosition">The stack position.</param> /// <param name="itemSpawn">The item spawn.</param> public static void Add(NetworkMessage message, Vector3 vector3, byte stackPosition, ItemSpawn itemSpawn) { message.AddPacketType(GamePacketType.TileArtifactTransform); message.AddVector3(vector3); message.AddByte(stackPosition); message.AddItemSpawn(itemSpawn); }
void Start() { playerStats = GameObject.FindGameObjectWithTag("Player").GetComponent <playerStatScript>(); itemSpawn = GameObject.FindGameObjectWithTag("SpawnSystem").GetComponent <ItemSpawn>(); }