private void Awake() { GunManager gunMan = GetComponentInParent <GunManager>(); damage = gunMan.Damage; knockbackDuration = gunMan.KnockBackDuration; }
// Use this for initialization private void Start() { if (_AIAirplane == null) { _AIAirplane = gameObject.GetComponent <Airplane>(); } if (sight == null) { sight = gameObject.GetComponentInChildren <Sight>(); } if (gunManager == null) { gunManager = gameObject.GetComponentInChildren <GunManager>(); } if (routeManager == null) { // 없으면 플레이어 무조건 따라가도록 함. routeManager = gameObject.AddComponent <AIAirplaneRouteManager>(); //Debug.LogError("AIAirplaneController: AI 비행기를 비행을 위해 routeManager 정보가 꼭 필요합니다."); } routeManager.targetController = this; }
private void Awake() { gm = FindObjectOfType <GameManager>(); gc = FindObjectOfType <GuyController>(); gunM = gc.GetComponent <GunManager>(); storeUI = FindObjectOfType <StoreUI>(); }
// Start is called before the first frame update void Awake() { _instance = this; // MachineGun Assignment MachineGun.damage = new int[] { 2, 3, 4 }; MachineGun.range = new int[] { 5, 5, 6 }; MachineGun.reloadSpeed = new float[] { 0.5f, 0.4f, 0.3f }; MachineGun.magazineSize = new int[] { 10, 20, 30 }; MachineGun.fireRate = new float[] { 0.2f, 0.15f, 0.1f }; //SniperRifle Assignment SniperRifle.damage = new int[] { 9, 19, 30 }; SniperRifle.range = new int[] { 5, 6, 7 }; SniperRifle.reloadSpeed = new float[] { 1.2f, 1.1f, 1.0f }; SniperRifle.magazineSize = new int[] { 5, 6, 7 }; SniperRifle.fireRate = new float[] { 0.65f, 0.6f, 0.55f }; //ShotGun Assignment ShotGun.damage = new int[] { 15, 20, 25 }; ShotGun.range = new int[] { 1, 1, 2 }; ShotGun.reloadSpeed = new float[] { 0.9f, 0.85f, 0.8f }; ShotGun.magazineSize = new int[] { 2, 3, 4 }; ShotGun.fireRate = new float[] { 0.5f, 0.4f, 0.3f }; //Pistol Assignment Pistol.damage = new int[] { 4, 8, 9 }; Pistol.range = new int[] { 3, 4, 5 }; Pistol.reloadSpeed = new float[] { 0.3f, 0.2f, 0.1f }; Pistol.magazineSize = new int[] { 7, 8, 9 }; Pistol.fireRate = new float[] { 0.3f, 0.25f, 0.2f }; }
// Use this for initialization void Start() { maxhealth = healthTiers[0]; curr_health = healthTiers[0]; gunManager = GetComponent <GunManager>(); scale = gameObject.transform.localScale.x; }
private void Start() { // Show the cursor Cursor.visible = true; Cursor.lockState = CursorLockMode.None; // Deactive the player pManager = FindObjectOfType <GunManager>(); pManager.gameObject.SetActive(false); // Fill the primary view foreach (WeaponPrefabData weapon in primaryGuns) { GameObject newWeapon = Instantiate(weaponPrefab, primaryView); newWeapon.GetComponentInChildren <TextMeshProUGUI>().text = weapon.Data.GunName; newWeapon.GetComponent <Button>().onClick.AddListener(delegate { SetGunSlot(1, weapon.Gun, newWeapon.GetComponent <Button>()); }); } // Fill the secondary view foreach (WeaponPrefabData weapon in secondaryGuns) { GameObject newWeapon = Instantiate(weaponPrefab, secondaryView); newWeapon.GetComponentInChildren <TextMeshProUGUI>().text = weapon.Data.GunName; newWeapon.GetComponent <Button>().onClick.AddListener(delegate { SetGunSlot(2, weapon.Gun, newWeapon.GetComponent <Button>()); }); } }
void Start() { itemDatabase = GameObject.Find("Databases").transform.Find("ItemDatabase").GetComponent <ItemDatabase> (); inventorySelector = GetComponent <InventorySelector> (); for (int i = 0; i < totalSlots; i++) { if (startingItemIds.Length > i) { Item newItem = itemDatabase.items [startingItemIds [i]]; inventory.Add(newItem); if (i == inventorySelector.CurrentSlot) { inventorySelector.ShowItemName(newItem.itemName); if (newItem.itemType == Item.Types.Weapon) { GunManager gunManager = GameObject.Find("GameManager").GetComponent <GunManager> (); gunManager.ammoUI.SetMaxAmmo(newItem.itemPrefab.GetComponent <Gun> ().clipSize); gunManager.ammoUI.SetCurrentAmmo(0); } } } else { inventory.Add(new Item()); // placeholder for future items } } }
//装备枪支 void AdornGun(GUN type, Text priceText) { GUN oldType; OwnList[type] = true; //储存为装备中 priceText.text = "装备中"; //标记为已装备 GunManager.SetUseGun(type, out oldType); //装备 if (OwnList.ContainsKey(oldType)) { OwnList[oldType] = false; //储存为装备中 } switch (oldType) { case GUN.ak47: akPriceText.text = "已拥有"; break; case GUN.m16: m16PriceText.text = "已拥有"; break; case GUN.m9: m9PriceText.text = "已拥有"; break; case GUN.mk12: mk12PriceText.text = "已拥有"; break; case GUN.mp5: mp5PriceText.text = "已拥有"; break; default: break; } }
public void OnTriggerEnter(Collider Other) { if (Other.tag == "Player") { gControl = Other.GetComponent <GunManager>(); Other.GetComponent <PlayerController>().StartCoroutine(Other.GetComponent <PlayerController>().Warner(objName)); if (!notGun) { gControl.m_WeaponList[gunID].owned = true; gControl.m_WeaponList[gControl.m_currentWeapon].isloaded = false; gControl.StartCoroutine(gControl.Unload(gunID + 1)); Debug.Log("Passed"); gControl.weaponChange = false; gControl.m_WeaponList[gunID].Load(); gControl.m_WeaponList[gControl.m_currentWeapon].isloaded = true; } gControl.m_WeaponList[gunID].ammo += ammoToAdd; Destroy(this.gameObject); } }
IEnumerator IntroStuffStart() { //Start of cutscene for level one //Need to get these variables GameObject.Find("Quad1").SetActive(false); _player = GameObject.FindWithTag("Player"); _crosshair = GameObject.Find("Crosshair").GetComponent <Image>(); _AudioListener = _player.GetComponentInChildren <AudioListener>(); _p1 = GameObject.Find("ObjectRenderer").GetComponent <Camera>(); _p2 = GameObject.Find("GunRenderer").GetComponent <Camera>(); _p3 = GameObject.Find("HUDRenderer").GetComponent <Camera>(); _pCC = _player.GetComponent <CharacterController>(); _pFPC = _player.GetComponent <FirstPersonController>(); _gm = GameObject.Find("GunManager").GetComponent <GunManager>(); _playerObject = GameObject.FindWithTag("Player"); _playerSpawn = GameObject.FindWithTag("Player").transform.position; _0 = new Vector3(0, 0, 0); _ct.TransitionIntroBeginning(); //Disables a bunch of stuff to prevent camera conflicts and such yield return(new WaitForFixedUpdate()); _isCutscene = true; _pCC.enabled = false; _pFPC.enabled = false; _p1.enabled = false; _p2.enabled = false; _p3.enabled = false; _crosshair.enabled = false; _AudioListener.enabled = false; _gm.enabled = false; _cam1.SetActive(true); _cam2.SetActive(false); _playerObject.transform.position = _0; yield break; }
// Use this for initialization void Start() { animatorController = this.GetComponent <Animator>(); firegun.SetActive(false); gunManager = gun.GetComponent <GunManager>(); fireManager = firegun.GetComponent <FireManager>(); }
public void GunAttribute() { string type = _other.gameObject.name; switch (type) { case "AssaultRifle09": _other.gameObject.AddComponent <GunA> (); gun = _other.GetComponent <GunA> (); gun.attribute(); break; case "AssaultRifle02": _other.gameObject.AddComponent <GunB> (); gun = _other.GetComponent <GunB> (); gun.attribute(); break; case "AssaultRifle08": _other.gameObject.AddComponent <GunC> (); gun = _other.GetComponent <GunC> (); gun.attribute(); break; } }
// Use this for initialization void Start() { player = FindObjectOfType <Player1Controller> (); anim = FindObjectOfType <Animator> (); cam = FindObjectOfType <CameraController> (); playerCollider = playerObj.GetComponent <Collider2D> (); gun = FindObjectOfType <GunManager> (); }
// Use this for initialization void Start () { player = FindObjectOfType<Player1Controller> (); anim = FindObjectOfType<Animator> (); cam = FindObjectOfType<CameraController> (); playerCollider = playerObj.GetComponent<Collider2D> (); gun = FindObjectOfType<GunManager> (); }
void Start() { singleton = this; Equipped = new Gun(); fireButton.GetComponentInChildren <Button>(true).interactable = false; }
private void Awake() { instance = this; if (transform.childCount == 0) { CreateGuns(); } }
// Use this for initialization void Start() { guiManager = GameObject.FindGameObjectWithTag("GUI Manager").GetComponent <GUIManager>(); gunManager = GameObject.FindGameObjectWithTag("Gun Manager").GetComponent <GunManager>(); player = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerData> (); SelectGunsForSale(); }
public static GunManager Constructor(GameObject player, Camera cam) { GunManager gunMan = player.AddComponent <GunManager>(); ball = player; ballCam = cam; return(gunMan); }
void Start() { pCon = GameObject.FindGameObjectWithTag("Player"); gManage = pCon.GetComponent <GunManager>(); line = this.GetComponent <LineRenderer>(); line.SetVertexCount(2); line.GetComponent <Renderer>().material = lineMaterial; line.SetWidth(0.2f, 0.5f); }
private void Awake() { store = FindObjectOfType <Store>(); gm = FindObjectOfType <GameManager>(); gunM = FindObjectOfType <GunManager>(); uiPre = FindObjectOfType <UIPreviewScreen>(); itemManagers = FindObjectsOfType <ItemManager>(); }
// Use this for initialization void Start() { firegun = gun.GetComponent <FireGun>(); player = GameObject.FindGameObjectWithTag("Player"); playerhealth = player.GetComponent <PlayerHealth>(); anim = gameObject.GetComponent <Animator>(); gun_manager_script = gun_manager.GetComponent <GunManager>(); Cursor.visible = false; }
private void Awake() { movement = GetComponent <ClientMovementDriver>(); shooting = GetComponent <ClientShooting>(); shotRayProvider = GetComponent <ShotRayProvider>(); fpsAnimator = GetComponent <FpsAnimator>(); currentGun = GetComponent <GunManager>(); controller = GetComponent <IControlProvider>(); }
private void Awake() { movement = GetComponent <ClientMovementDriver>(); shooting = GetComponent <ClientShooting>(); shotRayProvider = GetComponent <ShotRayProvider>(); fpsAnimator = GetComponent <FpsAnimator>(); currentGun = GetComponent <GunManager>(); CreateDirectionCache(); }
private void OnTriggerEnter2D(Collider2D collision) { if (collision.tag == "Player") { FindObjectOfType <AudioCreater>().PlayReload(); GunManager currentgun = collision.GetComponent <GunManager>(); currentgun.GetAmmos(ammoCount); Destroy(gameObject); } }
void Start() { mouseManager = GameObject.Find("GameManager").GetComponent <MouseManager> (); database = GameObject.Find("Databases").transform.Find("ItemDatabase").GetComponent <ItemDatabase> (); gunManager = GameObject.Find("GameManager").GetComponent <GunManager> (); if (startingGun != null) { EquipGun(startingGun); } }
public void DisableShoot() { GunManager shoot = GetComponent <GunManager>(); if (shoot) { shoot.isShooting = false; shoot.shootCanvas.SetActive(false); } }
void OnCollisionEnter(Collision other) { if (other.collider.tag == "Player") { guns = other.collider.GetComponent <GunManager>(); guns.isInfinite = true; pooledObject.returnToPool(); // Destroy(gameObject); } }
private void Start() { if (cam == null) { Debug.Log("PlayerShoot: No camera referenced"); this.enabled = false; } gunManager = GetComponent <GunManager>(); }
// Start is called before the first frame update void Start() { gm = FindObjectOfType <GameManager>(); gc = FindObjectOfType <GuyController>(); storeUI = FindObjectOfType <StoreUI>(); gs = gc.GetComponent <GuyShooting>(); gunM = gc.GetComponent <GunManager>(); SetUpItem(); }
void Start() { fpCam = this.transform.Find("FP Camera").GetComponent <Camera>(); currentGun = "Pistol"; float gunTimer = (float)getVariableValue(currentGun.ToLower() + "Timer"); setVariableValue("current" + currentGun + "Timer", gunTimer); GunManager.setSecondaryGun(startGun); }
// Use this for initialization protected override void Start () { base.Start (); weaponDispatcher = gameObject.AddComponent<WeaponDispatcher>(); weaponDispatcher.Init (); gunManager = gameObject.AddComponent<GunManager> (); gunManager.Init (transform); ScoreCtrl.OnLevelChange += OnLevelUp; screenHalfWidth = Camera.main.aspect * Camera.main.orthographicSize; originalColor = GetComponent<SpriteRenderer> ().color; }
// Use this for initialization void Start() { firegun = gun.GetComponent<FireGun>(); player = GameObject.FindGameObjectWithTag("Player"); playerhealth = player.GetComponent<PlayerHealth>(); anim = gameObject.GetComponent<Animator>(); gun_manager_script = gun_manager.GetComponent<GunManager>(); Cursor.visible = false; }