Exemplo n.º 1
0
    public float BurstRate   = 0.1f; //Время между выстрелами

    void Start()
    {
        //anim = GetComponent<Animator>();//получаем анимацию выстрела
        _gunMode = GunMode.single; // режим стрельбы одиночный
    }
Exemplo n.º 2
0
    public override void Update()
    {
        base.Update();

        // Primary Firing Modes
        if (Input.GetButton( "Fire1" ))
        {
            previousPosition = Input.mousePosition;
            base.fired = true;
            currentMode = GunMode.Grab;
        }
        if (Input.GetButtonUp( "Fire1" ))
        {
            base.fired = false;
            if (affectedBlock != null)
            {
                affectedBlock.Lock();
                affectedBlock = null;
                transform.parent.gameObject.GetComponent<CharacterMovement>().enabled = true;
            }
        }

        // Secondary Firing Modes
        if (Input.GetButton( "Fire2" ))
        {
            base.fired = true;
            currentMode = selectedMode;
        }
        if (Input.GetButtonUp( "Fire2" ))
        {
            base.fired = false;
            hit_object = false;
            if (affectedBlock != null)
            {
                affectedBlock.Lock();
                affectedBlock = null;
                line.enabled = false;
                renderedLine.SetActiveRecursively(false);
            }
        }

        // MouseWheel Scroll (selecting the modes for Attract and Repel)
        if (Input.GetAxis("Mouse ScrollWheel") != 0.0f)
        {
            if (selectedMode == GunMode.Attract)
                selectedMode = GunMode.Repel;
            else
                selectedMode = GunMode.Attract;
        }
    }
Exemplo n.º 3
0
    // Update is called once per frame
    void Update()
    {
        ScreenPos = Camera.main.WorldToViewportPoint(transform.position);
        //CONTROL BLIND
        {
            // Jumping part
            if (Input.GetKeyDown(btn_Jump))
            {
                Hop_jump = true;

                //! TEST
                //FindObjectOfType<TextGenerator>().CreateText(transform.position, "JUMP!", DisplayDamage.TextState.Green, 54);
            }

            if (Input.GetKeyUp(btn_Jump))
            {
                Hop_jump   = false;
                Hover_Jump = false;
            }

            // Shooting part
            if (Input.GetKeyDown(btn_SwitchGun))
            {
                CurrentGunMode += 1;
            }

            switch ((GunMode)((int)CurrentGunMode % GunModeCount))
            {
            case GunMode.NormalBullet:
                if (Input.GetKeyDown(btn_Attack1))
                {
                    Shoot1();
                }
                if (Input.GetKey(btn_Attack1))
                {
                    if (DecayBeforeAutoShoot_fix <= DecayBeforeAutoShoot)
                    {
                        DecayBeforeAutoShoot_fix += Time.deltaTime;
                    }
                    if (DecayBeforeAutoShoot_fix >= DecayBeforeAutoShoot)
                    {
                        ShootAuto();
                    }
                }
                if (Input.GetKeyUp(btn_Attack1))
                {
                    DecayBeforeAutoShoot_fix = 0;
                }
                break;

            case GunMode.Flame:
                //Debug.Log("HasShotFlame  PressedAttack");
                //Debug.Log(HasShotFlame + " " + PressedAttack);

                if (Input.GetKey(btn_Attack1))
                {
                    PressedAttack = true;
                }
                else
                {
                    PressedAttack = false;
                }

                if (!HasShotFlame && PressedAttack)
                {
                    flame = ShootFlame();
                }

                if (HasShotFlame && !PressedAttack)
                {
                    PS = flame.GetComponent <ParticleSystem>();
                    var main = PS.main;
                    main.loop = false;

                    HasShotFlame = false;
                }
                break;
            }
        }

        if (transform.position.y <= -8)
        {
            transform.position = new Vector3(transform.position.x, 0);
            rb.velocity        = new Vector2(rb.velocity.x, 0);
        }

        if (ScreenPos.x < -0.1)
        {
            IsAlive = false;
            Instantiate(Explosion, transform.position, Quaternion.identity);

            //Trigger GameOver script
            Gameover_script().IsGameEnd = true;
            Destroy(gameObject);
        }
    }
Exemplo n.º 4
0
 public Gun(int pistolCapacity, GunMode mode)
 {
     this.PistolCapacity = pistolCapacity;
     this.Mode           = mode;
 }
Exemplo n.º 5
0
 public void SetGunMode(string mode)
 {
     gunMode = (GunMode)System.Enum.Parse(typeof(GunMode), mode, true);
 }
Exemplo n.º 6
0
 public void SetGunMode(GunMode mode)
 {
     gunMode = mode;
 }
Exemplo n.º 7
0
 public void SetGunMode(GunMode mode)
 {
     this.gunMode = mode;
 }
Exemplo n.º 8
0
        public void Update(GameTime gameTime)
        {
            float elapsedTime = (float)gameTime.ElapsedGameTime.TotalMilliseconds;
            var   kstate      = Keyboard.GetState();

            if (kstate.IsKeyDown(Keys.F))
            {
                if (canChangeMode)
                {
                    canChangeMode = false;
                    switch (mode)
                    {
                    case GunMode.Default:
                        mode = GunMode.Cannon;
                        break;

                    case GunMode.Cannon:
                        mode = GunMode.Sniper;
                        break;

                    default:
                        mode = GunMode.Default;
                        break;
                    }
                }
            }
            else
            {
                canChangeMode = true;
            }

            //Remove any bullets that collided in the last update
            RemoveCollidedBullets();
            UpdateSnipePoints(elapsedTime);
            MoveBullets(elapsedTime, bullets, cannonballs, snipes);

            var mstate = Mouse.GetState();

            timeBetweenShots += elapsedTime;
            if (mstate.LeftButton == ButtonState.Pressed)
            {
                if (timeBetweenShots > 100 && !justShot)
                {
                    Shoot(mstate.Position.ToVector2());

                    //soundEffectGunshot.CreateInstance().Play();

                    if (countingRhythm)
                    {
                        if (shotRhythm == 0)
                        {
                            shotRhythm = timeBetweenShots;
                        }
                        else if (Math.Abs(timeBetweenShots - shotRhythm) < 60)
                        {
                            rhythmReady = true;
                        }
                        else
                        {
                            rhythmReady    = false;
                            countingRhythm = false;
                        }
                    }
                    else
                    {
                        countingRhythm = true;
                        shotRhythm     = 0;
                    }

                    timeBetweenShots = 0;
                    justShot         = true;
                }
            }
            else
            {
                justShot = false;
            }

            if (rhythmReady && timeBetweenShots >= .5 * shotRhythm && rhythmReady)
            {
                soundEffectRhythmClick.CreateInstance().Play();
                rhythmReady = false;
            }
        }
Exemplo n.º 9
0
    //private Transform dummyCam;
    //private Vector3 oldMousePos = Vector3.zero;
    void Awake()
    {
        var wTransform = transform.Find ("weapon Transform");
        anim = GetComponent<Animator>();

        aud = wTransform.Find("Audio").GetComponent<AudioSource>();
        //aud.clip = hgSFX;
        ammoDisp = GameObject.Find("ammoClipTXT").GetComponent<Text>();
        // Setting up the references.

        playerT = GameObject.FindGameObjectWithTag("Player").transform;
        playerCtrl = playerT.GetComponent<PlayerControl>();
        playerHealth = playerT.GetComponent<PlayerHealth>();

        //print (playerT.name);

        playerCtrl.gunCS = this;
        playerAnim = playerT.GetComponent<Animator>();
        kickHit = playerT.Find ("kickHit").GetComponent<KickHit>();

        grabEnemyHitGO = playerT.Find ("grabEnemyHit").gameObject;
        //gehCS = grabEnemyHitGO.GetComponent<GrabEnemyHit> ();
        grabEnemyHitGO.GetComponent<GrabEnemyHit> ().gunCS = this;

        //yellSFX = playerCtrl.jumpFX;//make kick yell SFX same as jump from player control

        head = playerT.Find("head Transform");
        headSR = head.transform.Find ("head").GetComponent<SpriteRenderer>();

        psychoEye = head.Find("head").Find("psychoEye").gameObject;

        SliderJoint2D jnt = playerT.gameObject.AddComponent<SliderJoint2D>();
        jnt.connectedBody = GetComponent<Rigidbody2D>();
        jnt.anchor = new Vector2(0,0.6f);
        jnt.useLimits = true;
        jnt.angle = 90f;
        JointTranslationLimits2D l = new JointTranslationLimits2D();
        l.max = 1.2f;
        jnt.limits = l;

        //WEAPONS STUFF

        handGunWeapon = new Weapon(GunMode.HANDGUN,transform.Find("weapon Transform"));
        handGunWeapon.bulletShell = bulletShells [0];
        machineGunWeapon = new Weapon(GunMode.MACHINEGUN,transform.Find("weapon Transform"));
        machineGunWeapon.bulletShell = bulletShells [0];
        grenadeWeapon = new Weapon (GunMode.GRENADE,transform.Find("weapon Transform"));
        flameWeapon = new Weapon (GunMode.FLAME,transform.Find("weapon Transform"));
        rpgWeapon = new Weapon (GunMode.ROCKET,transform.Find("weapon Transform"));
        punchWeapon = new Weapon (GunMode.PUNCH,transform.Find("weapon Transform"));
        shotGunWeapon = new Weapon (GunMode.SHOTGUN,transform.Find("weapon Transform"));
        shotGunWeapon.bulletShell = bulletShells [1];
        stratWeapon = new Weapon (GunMode.STRAT,transform.Find("weapon Transform"));

        activeWeapon = handGunWeapon;

        weapons[0]=new Weapon(GunMode.UNARMED,transform.Find("weapon Transform"));
        weapons[1]=handGunWeapon;
        weapons[2]=machineGunWeapon;
        weapons[3]=grenadeWeapon;
        weapons[4]=flameWeapon;
        weapons[5]=rpgWeapon;
        weapons[6]=punchWeapon;
        weapons [7] = shotGunWeapon;
        weapons[8] = stratWeapon;

        weaponsForAmmo[0] = machineGunWeapon;
        weaponsForAmmo[1] = grenadeWeapon;
        weaponsForAmmo[2] = flameWeapon;
        weaponsForAmmo[3] = rpgWeapon;
        weaponsForAmmo[4] = punchWeapon;
        weaponsForAmmo [5] = shotGunWeapon;

        gunModes[0]=GunMode.UNARMED;
        gunModes[1]=GunMode.HANDGUN;
        gunModes[2]=GunMode.MACHINEGUN;
        gunModes[3]=GunMode.GRENADE;
        gunModes[4]=GunMode.FLAME;
        gunModes[5]=GunMode.ROCKET;
        gunModes[6]=GunMode.PUNCH;
        gunModes[7]=GunMode.SHOTGUN;
        gunModes[8]=GunMode.STRAT;

        //unarmLGO = playerT.Find ("body").Find("psycho bob_armL").gameObject;//unarmed arms, animated separately
        //unarmRGO = playerT.Find ("body").Find("psycho bob_armR").gameObject;

        handGunGO = wTransform.Find ("handGun3D").gameObject;
        bazookaGO = wTransform.Find ("bazooka3D").gameObject;
        machineGunGO = wTransform.Find ("machineGun3D").gameObject;
        flameThrowerGO = wTransform.Find ("flameThrower3D").gameObject;
        shotGunGO = wTransform.Find ("shotGun3D").gameObject;
        stratGO  = wTransform.Find ("stratGun3D").gameObject;
        rpgGO    = wTransform.Find("bazooka3D").Find("rocket3D").gameObject;
        punchGO  = wTransform.Find("bazooka3D").Find("punch3D").gameObject;

        weaponWheel = transform.Find("UIweaponWheel").gameObject;//GameObject.Find ("UI").transform.Find("UIweaponWheel").gameObject;//playerT.Find("weaponSelect").gameObject;
        weaponWheel.transform.SetParent (GameObject.Find ("UI").transform, false);

        bulletShell_ShotPos =wTransform. transform.Find ("bulletShell_spot");

        handGunFlare = wTransform.Find ("handGun3D").Find ("handGunFlare").GetComponent<ParticleSystem>();
        handGunFlareLight = wTransform.Find ("handGun3D").Find("handGunFlare light").GetComponent<Light>();
        //handGunFlareLight2 = wTransform.Find ("handGun3D").Find("handGunFlare light2").GetComponent<Light>();

        gunFlare = wTransform.Find ("machineGun3D").Find ("gunFlare").GetComponent<ParticleSystem>();
        gunFlareLight = wTransform.Find ("machineGun3D").Find("gunFlare light").GetComponent<Light>();
        //gunFlareLight2 = wTransform.Find ("machineGun3D").Find("gunFlare light2").GetComponent<Light>();

        shotGunFlare = wTransform.Find ("shotGun3D").Find ("gunFlare").GetComponent<ParticleSystem>();
        shotGunFlareLight = wTransform.Find ("shotGun3D").Find("gunFlare light").GetComponent<Light>();
        //shotGunFlareLight2 = wTransform.Find ("shotGun3D").Find("gunFlare light2").GetComponent<Light>();

        flame = wTransform.Find ("flameThrower3D").Find("flame").GetComponent<ParticleSystem>();
        smoke = wTransform.Find ("flameThrower3D").Find("flameSmoke").GetComponent<ParticleSystem>();
        flameLight =  wTransform.Find ("flameThrower3D").Find("flameFX").GetComponent<Light>();
        flameAud = flameLight.gameObject.GetComponent<AudioSource>();

        rpgSmoke = wTransform.Find ("bazooka3D").Find("rpgSmoke").GetComponent<ParticleSystem>();

        stratLightning = transform.Find ("lightning").gameObject;
        stratLightning.transform.parent = null;
        lightningCS = stratLightning.GetComponent<Lightning> ();
        stratLightning.SetActive(false);

        armIK[0] = playerT.Find ("body").Find ("psycho bob_armL").GetComponent<SimpleCCD>();
        armIK[1] = playerT.Find ("body").Find("psycho bob_armR").GetComponent<SimpleCCD>();

        armTargets[0]= transform.Find("weapon Transform").Find ("fArmB_L_IK");//for flipping when gun flips
        armTargets[1]= transform.Find("weapon Transform").Find ("fArmB_R_IK");
        armTargets[2]= playerT.Find ("handL_IK");//for unarmed IK targets
        armTargets[3]= playerT.Find ("handR_IK");
        armTargets[4]= stratGO.transform.Find("handLmg");//for strat
        armTargets[5]= stratGO.transform.Find ("handRmg");
        armTargets[6]= playerT.Find ("handL_IK_grab"); //for grabbing enemies;
        armTargets[7]= playerT.Find ("handR_IK_grab");

        fArmR_SR = armIK[1].transform.Find("psycho bob_fArmR").GetComponent<SpriteRenderer>();
        fArmL_SR = armIK[0].transform.Find("psycho bob_fArmL").GetComponent<SpriteRenderer>();
        armL_SR = armIK[0].transform.parent.Find("psycho bob_armL").GetComponent<SpriteRenderer>();

        //elbowTargets [0] = playerT.Find ("body").Find ("Skeleton").Find ("armB_L_IK");
        //elbowTargets [1] = playerT.Find ("body").Find ("Skeleton").Find ("armB_R_IK");

        armTargetPos[0] = armTargets[0].localPosition;//handgun machine gun L
        armTargetPos[1] = armTargets[1].localPosition;//R
        armTargetPos[2] = new Vector3(-0.8f,-0.4f,armTargets[0].localPosition.z);//flamethrower
        armTargetPos[3] = new Vector3(1.2f,-0.2f,armTargets[1].localPosition.z);
        armTargetPos[4] = new Vector3(-0.6f,-0.1f,armTargets[1].localPosition.z);//bazooka
        armTargetPos[5] = new Vector3(2f,1.57f,armTargets[0].localPosition.z);
        armTargetPos[6] = new Vector3(-.75f,-0.3f,armTargets[0].localPosition.z);//shotgun
        armTargetPos[7] = new Vector3(1.5f,0.5f,armTargets[0].localPosition.z);
        //armTargetPos[8] = new Vector3(-1f,0.8f,armTargets[0].localPosition.z);//strat
        //armTargetPos[9] = new Vector3(1.8f,-0.5f,armTargets[0].localPosition.z);

        hudGun =GameObject.FindGameObjectWithTag("HUD").transform.Find ("gunHUD").Find ("weaponIMG").GetComponent<UI_WeaponDisplay>();

        rightHands[0] = wTransform.Find("handGun3D").Find ("hands2").GetComponent<SpriteRenderer>();
        rightHands[1] = wTransform.Find("machineGun3D").Find ("handRmg").GetComponent<SpriteRenderer>();
        rightHands[2] = wTransform.Find("shotGun3D").Find ("shotgun_grip").Find ("handR").GetComponent<SpriteRenderer>();
        rightHands[3] = wTransform.Find("stratGun3D").Find ("handRmg").GetComponent<SpriteRenderer>();
        rightHands[4] = wTransform.Find("flameThrower3D").Find ("handR").GetComponent<SpriteRenderer>();
        rightHands[5] = wTransform.Find("bazooka3D").Find ("handRbz").GetComponent<SpriteRenderer>();
        //rightHands[6] = wTransform.Find("").Find ("handR").gameObject;
        //rightHands[7] = wTransform.Find("").Find ("handR").gameObject;
        //rightHands[8] = wTransform.Find("").Find ("handR").gameObject;
        //hero = transform.root.gameObject.transform;
        bazookaGO.SetActive(false);
        machineGunGO.SetActive(false);
        //flameThrowerGO.SetActive(false);
        //camera = Camera.main;
        var xhairGO = (GameObject)Instantiate (xhairRef,transform.position  , Quaternion.identity);
        xhair = xhairGO.transform;
        xhair.name = "xhair";
        Cursor.visible = false;

        xhairHUD =GameObject.FindGameObjectWithTag("HUD").transform.Find ("xhairHUD");

        gunMode = GunMode.UNARMED;

        SwitchWeapons();

        cameraXmaxMin = Camera.main.transform.GetComponent<CameraFollow>().GetCameraMaxMin();

        //dummyCam = Camera.main.transform.Find ("dummyCam");
    }
Exemplo n.º 10
0
    private void SwitchWeapons()
    {
        //Color white = Color.white;
        //foreach(Transform child in weaponWheel.transform){
            //child.GetComponent<Toggle>().colors.normalColor = white;
        //}
        if (reloading) {
            anim.SetTrigger("StopReloading");
            StopCoroutine("Reloading");
            reloading = false;
            canShoot = true;
        }

        handGunGO.SetActive(false);
        machineGunGO.SetActive(false);
        flameThrowerGO.SetActive(false);
        //punchGO.SetActive(false);
        //rpgGO.SetActive(false);
        bazookaGO.SetActive(false);
        punchGO.SetActive(false);
        shotGunGO.SetActive (false);
        stratGO.SetActive(false);
        //print (gunMode);
        if(lastGunMode == GunMode.UNARMED || lastGunMode == GunMode.STRAT){
            armIK[0].transform.Find ("psycho bob_fArmL").Find ("psycho bob_handL").gameObject.SetActive(false);//GetComponent<SpriteRenderer>().enabled = false;
            armIK[1].transform.Find ("psycho bob_fArmR").Find ("psycho bob_handR").gameObject.SetActive(false);//GetComponent<SpriteRenderer>().enabled = false;
            armIK[0].target = armTargets[0];
            armIK[1].target = armTargets[1];
            aud.Stop();
            playerAnim.SetTrigger("stopCharge");
            stratWeapon.chargeCount = 0;
        }

        if(gunMode == GunMode.UNARMED){
            armIK[0].transform.Find ("psycho bob_fArmL").Find ("psycho bob_handL").gameObject.SetActive(true);//GetComponent<SpriteRenderer>().enabled = true;
            armIK[1].transform.Find ("psycho bob_fArmR").Find ("psycho bob_handR").gameObject.SetActive(true);//GetComponent<SpriteRenderer>().enabled = true;
            armIK[0].target = armTargets[2];
            armIK[1].target = armTargets[3];
            hudGun.switchWeapon(0);
            gunMode = GunMode.UNARMED;

        }else if(gunMode == GunMode.HANDGUN){                      //handGun
            //weaponWheel.transform.Find("1").GetComponent<Toggle>().isOn = true;//colors.normalColor = new Color(.6,.7,.2,1);
            //aud.clip = hgSFX;

            StopCoroutine("canShootAgain");
            canShoot = true;
            handGunGO.SetActive(true);

            gunMode = GunMode.HANDGUN;

            hudGun.switchWeapon(1);
            armTargets[0].localPosition = armTargetPos[0];
            armTargets[1].localPosition = armTargetPos[1];
            activeWeapon = handGunWeapon;

        }else if (gunMode == GunMode.MACHINEGUN){             //machine gun
            //aud.clip = mgSFX;
            canShoot = true;
            //bazookaRen.sprite = m4;
            machineGunGO.SetActive(true);

            machineGunGO.transform.Find ("handLmg").gameObject.SetActive(true);
            machineGunGO.transform.Find ("handL2mg").gameObject.SetActive(false);

            gunMode = GunMode.MACHINEGUN;
            hudGun.switchWeapon(2);
            //var v = new Vector3(armTargetPos[0].x - 1,armTargetPos[0].y,armTargetPos[0].z);
            armTargets[0].localPosition = armTargetPos[0];//v;
            armTargets[1].localPosition = armTargetPos[1];
            activeWeapon = machineGunWeapon;

        }else if (gunMode == GunMode.GRENADE){             // m240 grenade laucnher
            aud.clip = bSFX;
            machineGunGO.SetActive(true);
            machineGunGO.transform.Find ("handLmg").gameObject.SetActive(false);
            machineGunGO.transform.Find ("handL2mg").gameObject.SetActive(true);

            armTargets[0].localPosition = new Vector3(armTargetPos[0].x + .5f,armTargetPos[0].y - .25f,armTargets[0].localPosition.z);
            armTargets[1].localPosition = armTargetPos[1];
            gunMode = GunMode.GRENADE;
            hudGun.switchWeapon(3);
            activeWeapon = grenadeWeapon;

        }else if (gunMode == GunMode.FLAME){         ///flame
            aud.clip = fSFX;

            flameThrowerGO.SetActive(true);

            gunMode = GunMode.FLAME;
            hudGun.switchWeapon(4);
            armTargets[0].localPosition = armTargetPos[2];
            armTargets[1].localPosition = armTargetPos[3];
            activeWeapon = flameWeapon;
        }else if(gunMode == GunMode.ROCKET){        //bazoooooooooka
            //aud.clip = rpgSFX;

            bazookaGO.SetActive(true);
            rpgGO.SetActive(true);
            punchGO.SetActive(false);
            gunMode = GunMode.ROCKET;
            hudGun.switchWeapon(5);
            armTargets[0].localPosition = armTargetPos[4];
            armTargets[1].localPosition = armTargetPos[5];
            activeWeapon = rpgWeapon;
        }else if(gunMode == GunMode.PUNCH){ //PUNCH
            aud.clip = bSFX;
            StopCoroutine("canShootAgain");
            canShoot = true;
            gunMode = GunMode.PUNCH;
            bazookaGO.SetActive(true);
            rpgGO.SetActive(false);
            punchGO.SetActive(true);
            hudGun.switchWeapon(6);
            armTargets[0].localPosition = armTargetPos[4];
            armTargets[1].localPosition = armTargetPos[5];
            activeWeapon = punchWeapon;
        }else if(gunMode == GunMode.SHOTGUN){ //SHOTGUN
            StopCoroutine("canShootAgain");
            canShoot = true;
            gunMode = GunMode.SHOTGUN;
            shotGunGO.SetActive(true);
            bazookaGO.SetActive(false);
            rpgGO.SetActive(false);
            punchGO.SetActive(true);
            hudGun.switchWeapon(7);
            armTargets[0].localPosition = armTargetPos[6];
            armTargets[1].localPosition = armTargetPos[7];
            activeWeapon = shotGunWeapon;
        }else if(gunMode == GunMode.STRAT){
            StopCoroutine("canShootAgain");
            canShoot = true;
            gunMode = GunMode.STRAT;
            stratGO.SetActive(true);
            hudGun.switchWeapon(8);
            //print(armTargetPos[8]);
            armIK[0].target = armTargets[4];
            armIK[1].target = armTargets[5];
            activeWeapon = stratWeapon;
        }

        UpdateAmmoDisp();

        lastGunMode = gunMode;
        if(activeWeapon.clip <=0){
            Reload();
        }
    }
Exemplo n.º 11
0
 //used by event triggers on weapon wheel
 //SWITCHING WEAPONS
 public void SwitchWeaponMode(int mode)
 {
     if (weapons [mode].hasGun) {
         gunMode = gunModes [mode];
     }
 }
Exemplo n.º 12
0
 //to switch automatically, ie out of ammo switch to handgun
 public void SwitchToWeapon(GunMode gm)
 {
     gunMode = gm;
     SwitchWeapons();
 }
Exemplo n.º 13
0
    //pickup guns or ammo
    public void PickupItem(global::PickupTrigger.PickupMode pickupMode, GunMode gMode, int howMuch)
    {
        //print (pickup);
        AudioSource.PlayClipAtPoint(reloadFX[0], transform.position);
        if(pickupMode == global::PickupTrigger.PickupMode.WEAPON){
            GetComponent<Gun>().SwitchToWeapon(gMode);
            //AudioSource.PlayClipAtPoint(pickupFX[0], transform.position);
            switch(gMode){
            case Gun.GunMode.HANDGUN:
                handGunWeapon.hasGun = true;
                weaponWheel.transform.Find("1").GetComponent<Toggle>().interactable = true;
                break;
            case Gun.GunMode.MACHINEGUN:
                machineGunWeapon.hasGun = true;
                weaponWheel.transform.Find("2").GetComponent<Toggle>().interactable = true;

                break;
            case Gun.GunMode.GRENADE:
                grenadeWeapon.hasGun = true;
                weaponWheel.transform.Find("3").GetComponent<Toggle>().interactable = true;
                transform.Find ("weapon Transform").Find ("machineGun3D").Find("grenadeLauncher").gameObject.SetActive(true);
                transform.Find ("weapon Transform").Find ("machineGun3D").Find("handRmg").localPosition = new Vector3(1.1f,-0.25f,-0.2f);//move hand down for launcher//had to make separate hands once I animated for reload they wouldnt move

                break;
            case Gun.GunMode.FLAME:
                flameWeapon.hasGun = true;
                weaponWheel.transform.Find("4").GetComponent<Toggle>().interactable = true;
                break;
            case Gun.GunMode.ROCKET:
                rpgWeapon.hasGun = true;
                weaponWheel.transform.Find("5").GetComponent<Toggle>().interactable = true;

                break;
            case Gun.GunMode.PUNCH:
                punchWeapon.hasGun = true;
                weaponWheel.transform.Find("6").GetComponent<Toggle>().interactable = true;

                break;
            case Gun.GunMode.SHOTGUN:
                shotGunWeapon.hasGun = true;
                weaponWheel.transform.Find("7").GetComponent<Toggle>().interactable = true;

                break;
            case Gun.GunMode.STRAT:
                stratWeapon.hasGun = true;
                weaponWheel.transform.Find("8").GetComponent<Toggle>().interactable = true;

                break;
            }

        }else{//ammo
            Weapon whichAmmo= handGunWeapon;//new Weapon(gunMode,transform);
            switch(gMode){

                case Gun.GunMode.MACHINEGUN:
                    whichAmmo = machineGunWeapon;
                break;
                case Gun.GunMode.GRENADE:
                    whichAmmo = grenadeWeapon;
                break;
                case Gun.GunMode.FLAME:
                    whichAmmo = flameWeapon;
                break;
                case Gun.GunMode.ROCKET:
                    whichAmmo = rpgWeapon;
                break;
                case Gun.GunMode.PUNCH:
                    whichAmmo = punchWeapon;
                break;
                case Gun.GunMode.SHOTGUN:
                whichAmmo = shotGunWeapon;
                break;
            }
            whichAmmo.ammo += howMuch;
            if(whichAmmo.ammo > whichAmmo.maxAmmo){
                whichAmmo.ammo = whichAmmo.maxAmmo;
            }
            UpdateAmmoDisp();
        }
    }
Exemplo n.º 14
0
    // Use this for initialization
    void Start()
    {
        InitiliseAmmo();

        CurrentGunMode = GunMode.Standard;
        CurrentGunType = GunType.SingleShot;
    }
Exemplo n.º 15
0
	void Update()
	{
		// TEMP
		if(Input.GetKeyDown(KeyCode.E) && gunMode == GunMode.suck)
		{
			gunMode = GunMode.blow;
			if(!gunEffect.isPlaying)gunEffect.Play();
		}
		else if (Input.GetKeyDown(KeyCode.E) && gunMode == GunMode.blow) 
		{
			gunMode = GunMode.suck;
			if(!gunEffect.isPlaying)gunEffect.Play();
		}
		// TEMP
		if(Input.GetMouseButton(0))
		{
			ActivateGun();
			GunInUse = true;
		}
		else 
			GunInUse = false;
		SilenceSound();
		if(oxygen < 0) 
			oxygen = 0;
		if(!GunInUse) 
			ResetSpecialTargetValues();
	}