示例#1
0
    //
    void switchWeapon()
    {
        if (++i >= equips.Count)
        {
            i = 0;
        }

        // DEBUG
        Debug.Log(i);
        Debug.Log(equips[i].getMaterial());
        Debug.Log(equips[i].getMesh());
        Debug.Log(equips[i].getRotation());

        // Switch Weapon type
        weaponType = (WeaponType)weaponNum;

        // Change mesh and material
        renderer.material = equips[i].getMaterial();
        this.GetComponent<MeshFilter>().mesh  = equips[i].getMesh();
        // correctly orient the weapon
        this.transform.localEulerAngles = equips[i].getRotation();
        currentEquippedWeapon = equips[i];
        currentEquippedWeapon.setTransform(this.transform);
    }
示例#2
0
    /// 
    /// 
    /// 
    // Use this for initialization
    void Start()
    {
        WeaponManager wm = this.GetComponent<WeaponManager>();
        Debug.Log("WeaponHand");
        wm.setUpForPlay();
        wm.loadUnlockedWeapons(ref equips);

        currentEquippedWeapon = equips[0];
        fired = false;

        player = GameObject.FindWithTag("Player");
        rightHand = GameObject.Find("Beta/Beta:Hips/Beta:Spine/Beta:Spine1/Beta:Spine2/Beta:RightShoulder/Beta:RightArm/Beta:RightForeArm/Beta:RightHand");

        // Draw the initial weapons mat and mes
        renderer.material = currentEquippedWeapon.getMaterial();
        this.GetComponent<MeshFilter>().mesh  = currentEquippedWeapon.getMesh();
        this.transform.localEulerAngles = currentEquippedWeapon.getRotation();
        currentEquippedWeapon.setTransform(this.transform);
        // Load List of available weapons from InventoryManager

        //Debug.Log(reloadTime);
        // For rigidBody Ammo
        // Default is grenade launcher, this code will be changed once we have a filesystem or database to load from
        reloadTime = currentEquippedWeapon.getReloadTime();
        currentEquippedWeapon.setReloadTimer(reloadTime+1.0f);
        reloadTimer = currentEquippedWeapon.getReloadTimer();
        currentEquippedWeapon.setReloadTime(0.5f);
        //equips[0].setShotPower(1000);
        currentEquippedWeapon.setShotOffset(2);
        currentEquippedWeapon.setShotPower(900);

        /*************************************/
        // Add Weapons to equips
        // equips[i] = new Laser();
    }