コード例 #1
0
    private void Awake()
    {
        GunManager gunMan = GetComponentInParent <GunManager>();

        damage            = gunMan.Damage;
        knockbackDuration = gunMan.KnockBackDuration;
    }
コード例 #2
0
    // 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;
    }
コード例 #3
0
 private void Awake()
 {
     gm      = FindObjectOfType <GameManager>();
     gc      = FindObjectOfType <GuyController>();
     gunM    = gc.GetComponent <GunManager>();
     storeUI = FindObjectOfType <StoreUI>();
 }
コード例 #4
0
    // 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 };
    }
コード例 #5
0
 // Use this for initialization
 void Start()
 {
     maxhealth   = healthTiers[0];
     curr_health = healthTiers[0];
     gunManager  = GetComponent <GunManager>();
     scale       = gameObject.transform.localScale.x;
 }
コード例 #6
0
    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>()); });
        }
    }
コード例 #7
0
ファイル: Inventory.cs プロジェクト: ReesMorris/black-earth
    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
            }
        }
    }
コード例 #8
0
ファイル: ShopManager.cs プロジェクト: syfx/3DShootingGame
    //装备枪支
    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;
        }
    }
コード例 #9
0
    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);
        }
    }
コード例 #10
0
    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;
    }
コード例 #11
0
 // Use this for initialization
 void Start()
 {
     animatorController = this.GetComponent <Animator>();
     firegun.SetActive(false);
     gunManager  = gun.GetComponent <GunManager>();
     fireManager = firegun.GetComponent <FireManager>();
 }
コード例 #12
0
ファイル: TakeGuns.cs プロジェクト: Qishihao1994/sence
    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;
        }
    }
コード例 #13
0
 // Use this for initialization
 void Start()
 {
     player         = FindObjectOfType <Player1Controller> ();
     anim           = FindObjectOfType <Animator> ();
     cam            = FindObjectOfType <CameraController> ();
     playerCollider = playerObj.GetComponent <Collider2D> ();
     gun            = FindObjectOfType <GunManager> ();
 }
コード例 #14
0
ファイル: LevelManager.cs プロジェクト: GooeyJooey/PewPewRUN
	// Use this for initialization
	void Start () {
	
		player = FindObjectOfType<Player1Controller> ();
		anim = FindObjectOfType<Animator> ();
		cam = FindObjectOfType<CameraController> ();
		playerCollider = playerObj.GetComponent<Collider2D> ();
		gun = FindObjectOfType<GunManager> ();
	}
コード例 #15
0
ファイル: GunManager.cs プロジェクト: clkennedy008/RobotGame
    void Start()
    {
        singleton = this;

        Equipped = new Gun();

        fireButton.GetComponentInChildren <Button>(true).interactable = false;
    }
コード例 #16
0
 private void Awake()
 {
     instance = this;
     if (transform.childCount == 0)
     {
         CreateGuns();
     }
 }
コード例 #17
0
    // 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();
    }
コード例 #18
0
    public static GunManager Constructor(GameObject player, Camera cam)
    {
        GunManager gunMan = player.AddComponent <GunManager>();

        ball    = player;
        ballCam = cam;

        return(gunMan);
    }
コード例 #19
0
 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);
 }
コード例 #20
0
    private void Awake()
    {
        store = FindObjectOfType <Store>();
        gm    = FindObjectOfType <GameManager>();
        gunM  = FindObjectOfType <GunManager>();
        uiPre = FindObjectOfType <UIPreviewScreen>();

        itemManagers = FindObjectsOfType <ItemManager>();
    }
コード例 #21
0
ファイル: HUDManager.cs プロジェクト: anthrax3/FPS-8
 // 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;
 }
コード例 #22
0
 private void Awake()
 {
     movement        = GetComponent <ClientMovementDriver>();
     shooting        = GetComponent <ClientShooting>();
     shotRayProvider = GetComponent <ShotRayProvider>();
     fpsAnimator     = GetComponent <FpsAnimator>();
     currentGun      = GetComponent <GunManager>();
     controller      = GetComponent <IControlProvider>();
 }
コード例 #23
0
 private void Awake()
 {
     movement        = GetComponent <ClientMovementDriver>();
     shooting        = GetComponent <ClientShooting>();
     shotRayProvider = GetComponent <ShotRayProvider>();
     fpsAnimator     = GetComponent <FpsAnimator>();
     currentGun      = GetComponent <GunManager>();
     CreateDirectionCache();
 }
コード例 #24
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.tag == "Player")
     {
         FindObjectOfType <AudioCreater>().PlayReload();
         GunManager currentgun = collision.GetComponent <GunManager>();
         currentgun.GetAmmos(ammoCount);
         Destroy(gameObject);
     }
 }
コード例 #25
0
 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);
     }
 }
コード例 #26
0
ファイル: Health.cs プロジェクト: swet-s/Dark
    public void DisableShoot()
    {
        GunManager shoot = GetComponent <GunManager>();

        if (shoot)
        {
            shoot.isShooting = false;
            shoot.shootCanvas.SetActive(false);
        }
    }
コード例 #27
0
 void OnCollisionEnter(Collision other)
 {
     if (other.collider.tag == "Player")
     {
         guns            = other.collider.GetComponent <GunManager>();
         guns.isInfinite = true;
         pooledObject.returnToPool();
         // Destroy(gameObject);
     }
 }
コード例 #28
0
    private void Start()
    {
        if (cam == null)
        {
            Debug.Log("PlayerShoot: No camera referenced");
            this.enabled = false;
        }

        gunManager = GetComponent <GunManager>();
    }
コード例 #29
0
ファイル: ShopItem.cs プロジェクト: JNaeder/WaveShooterTest
    // 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();
    }
コード例 #30
0
    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);
    }
コード例 #31
0
	// 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;
	}
コード例 #32
0
ファイル: HUDManager.cs プロジェクト: gotitmemorize/FPS
 // 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;
 }