当前位置: 首页>>代码示例>>C#>>正文


C# Weapon.setType方法代码示例

本文整理汇总了C#中Weapon.setType方法的典型用法代码示例。如果您正苦于以下问题:C# Weapon.setType方法的具体用法?C# Weapon.setType怎么用?C# Weapon.setType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Weapon的用法示例。


在下文中一共展示了Weapon.setType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: FirstLoad

    /// <summary>
    /// Called when a new game is started. Sets all fields to default.
    /// </summary>
    public void FirstLoad()
    {
        _score = Camera.main.GetComponent<Score>();
        currentWeapon = weaponFactory.getPistol ();
        currentWeaponInt = 1;
        unlocked [0] = true;
        for (int i = 1; i < unlocked.Length; i++) {
            unlocked [i] = false;
        }
        setUnActive ();
        setActive ();
        setTextOfLockUnlock ();
        for (int i = 0; i < 8; i ++) {
            unitCostWeaponTexts[i].text = weaponCost[i] + " Units";
        }
        playerAnimator = gameObject.GetComponent<Animator> ();
        pSys1.enableEmission = false;
        pSys2.enableEmission = false;

        PlayerSounds = gameObject.GetComponent<SoundsPlayer>();
        WeaponsSounds = gameObject.GetComponent<SoundsWeapons>();

        WeaponsSounds.loadGunSounds(gameObject);
        if (currentWeaponInt == 1)
        {
            currentWeapon = weaponFactory.getPistol();
            playerAnimator.SetInteger("weapon", 1);
            currentWeaponInt = 1;
            setAllWeaponsUnactive();
            weapons[0].SetActive(true);
        }
        if (currentWeaponInt == 2)
        {
            currentWeapon = weaponFactory.getShrimpPistol();
            currentWeaponInt = 2;
            playerAnimator.SetInteger("weapon", 1);
            setAllWeaponsUnactive();
            weapons[1].SetActive(true);
        }
        if (currentWeaponInt == 3)
        {
            currentWeapon = weaponFactory.getStingerGun();
            currentWeaponInt = 3;
            playerAnimator.SetInteger("weapon", 1);
            setAllWeaponsUnactive();
            weapons[2].SetActive(true);
        }
        if (currentWeaponInt == 4)
        {
            currentWeapon = weaponFactory.getWeaponizedEel();
            currentWeaponInt = 4;
            playerAnimator.SetInteger("weapon", 3);
            setAllWeaponsUnactive();
            weapons[3].SetActive(true);
        }
        if (currentWeaponInt == 5)
        {
            currentWeapon = weaponFactory.getWunderwuffen();
            currentWeapon.setType(new Type(1));
            currentWeaponInt = 5;
            playerAnimator.SetInteger("weapon", 1);
            setAllWeaponsUnactive();
            weapons[4].SetActive(true);
        }
        if (currentWeaponInt == 6)
        {
            currentWeapon = weaponFactory.getBatteringRam();
            currentWeaponInt = 6;
            playerAnimator.SetInteger("weapon", 3);
            setAllWeaponsUnactive();
            weapons[5].SetActive(true);
        }
        if (currentWeaponInt == 7)
        {
            currentWeapon = weaponFactory.getSwordfish();
            currentWeaponInt = 7;
            playerAnimator.SetInteger("weapon", 2);
            setAllWeaponsUnactive();
            weapons[6].SetActive(true);
        }
        if (currentWeaponInt == 8)
        {
            currentWeapon = weaponFactory.getBaseballBat();
            currentWeaponInt = 8;
            playerAnimator.SetInteger("weapon", 2);
            setAllWeaponsUnactive();
            weapons[7].SetActive(true);
        }
    }
开发者ID:wroel,项目名称:MinorProjectGr8,代码行数:92,代码来源:PlayerAttacker.cs

示例2: Update


//.........这里部分代码省略.........
            if ((Input.GetKeyDown(KeyCode.Keypad1) || Input.GetKeyDown(KeyCode.Alpha1) || currentWeaponInt == 1) && unlocked[0]){
                currentWeapon = weaponFactory.getPistol();
                playerAnimator.SetInteger ("weapon", 1);
                currentWeaponInt = 1;
                setAllWeaponsUnactive ();
                weapons [0].SetActive (true);
            }
            if ((Input.GetKeyDown(KeyCode.Keypad2) || Input.GetKeyDown(KeyCode.Alpha2) || currentWeaponInt == 2) && unlocked[1]){
                currentWeapon = weaponFactory.getShrimpPistol();
                currentWeaponInt = 2;
                playerAnimator.SetInteger ("weapon", 1);
                setAllWeaponsUnactive ();
                weapons [1].SetActive (true);
            }
            if ((Input.GetKeyDown(KeyCode.Keypad3) || Input.GetKeyDown(KeyCode.Alpha3)  || currentWeaponInt == 3) && unlocked[2]){
                currentWeapon = weaponFactory.getStingerGun();
                currentWeaponInt = 3;
                playerAnimator.SetInteger ("weapon", 1);
                setAllWeaponsUnactive ();
                weapons [2].SetActive (true);
            }
            if ((Input.GetKeyDown(KeyCode.Keypad4) || Input.GetKeyDown(KeyCode.Alpha4)  || currentWeaponInt == 4) && unlocked[3]){
                currentWeapon = weaponFactory.getWeaponizedEel();
                currentWeaponInt = 4;
                playerAnimator.SetInteger ("weapon", 3);
                setAllWeaponsUnactive ();
                weapons [3].SetActive (true);
            }
            if ((Input.GetKeyDown(KeyCode.Keypad5) || Input.GetKeyDown(KeyCode.Alpha5)  || currentWeaponInt == 5) && unlocked[4]){
                bool getIfWunderwaffen = currentWeapon.getIfChangeable ();
                Type type = currentWeapon.getType ();
                currentWeapon = weaponFactory.getWunderwuffen();
                if (getIfWunderwaffen) {
                    currentWeapon.setType (type);
                }
                currentWeaponInt = 5;
                playerAnimator.SetInteger ("weapon", 1);
                setAllWeaponsUnactive ();
                weapons [4].SetActive (true);
            }
            if ((Input.GetKeyDown(KeyCode.Keypad6) || Input.GetKeyDown(KeyCode.Alpha6)  || currentWeaponInt == 6) && unlocked[5]){
                currentWeapon = weaponFactory.getBatteringRam();
                currentWeaponInt = 6;
                playerAnimator.SetInteger ("weapon", 3);
                setAllWeaponsUnactive ();
                weapons [5].SetActive (true);
            }
            if ((Input.GetKeyDown(KeyCode.Keypad7) || Input.GetKeyDown(KeyCode.Alpha7) || currentWeaponInt == 7) && unlocked[6]){
                currentWeapon = weaponFactory.getSwordfish();
                currentWeaponInt = 7;
                playerAnimator.SetInteger ("weapon", 2);
                setAllWeaponsUnactive ();
                weapons [6].SetActive (true);
            }
            if ((Input.GetKeyDown(KeyCode.Keypad8) || Input.GetKeyDown(KeyCode.Alpha8)  || currentWeaponInt == 8) && unlocked[7]){
                currentWeapon = weaponFactory.getBaseballBat();
                currentWeaponInt = 8;
                playerAnimator.SetInteger ("weapon", 2);
                setAllWeaponsUnactive ();
                weapons [7].SetActive (true);
            }
            if(currentWeapon.getIfChangeable() && Input.GetMouseButtonDown(1)){
                if(currentWeapon.getType().getType() < 3){
                    currentWeapon.setType(new Type(currentWeapon.getType().getType() + 1));
                    typeOfWunderWaffenText.text = currentWeapon.getType().toString();
                }
开发者ID:wroel,项目名称:MinorProjectGr8,代码行数:67,代码来源:PlayerAttacker.cs


注:本文中的Weapon.setType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。