Inheritance: MonoBehaviour
	void Start () {
		player = GameObject.FindGameObjectWithTag ("Player").GetComponent<PlayerMovement> ();
        gun = player.GetComponentInChildren<Gun> ();
        missiles = player.GetComponentInChildren<MissileLauncher> ();
		participants = GameObject.FindGameObjectWithTag ("Participants").GetComponent<ParticipantManager> ();
		targetHold = targetLookDelay;
	}
	public void Spawn(GameObject player)
	{
		if (HUDComps)
			Destroy(HUDComps.gameObject);

		playerStats = player.GetComponent<PlayerStats>();
		playerCont = player.GetComponent<PlayerController>();

		if (playerCont.team == PlayerTeam.TeamYellow)
			HUDComps = Instantiate(yellowHud).GetComponent<HUDcomps>();
		else
			HUDComps = Instantiate(blueHud).GetComponent<HUDcomps>();

		maxHP = playerStats.maxHealth;

		if (player.GetComponent<Gun>())
		{
			hasGun = true;
			playerGun = player.GetComponent<Gun>();
		}
		else
		{
			hasGun = false;
			HUDComps.AmmoImage.enabled = false;
			HUDComps.AmmoText.enabled = false;
		}

		startCrosshairSize = HUDComps.CrosshairImg.rectTransform.sizeDelta;

		startDamageColour = HUDComps.DamageImg.color;
		damageColour = startDamageColour;
		damageTime = 0;

		StartCrosshailColour = HUDComps.CrosshairImg.color;
	}
Exemple #3
0
    protected override void Start()
    {
        for (int i = 0; i < transform.childCount; i++)
        {
            if (transform.GetChild(i).name == "hoverslug01Mesh")
            {
                var temp = transform.GetChild(i);
                for (int j = 0; j < temp.childCount; j++)
                {
                    if(temp.GetChild(j).tag == "EquippedGun")
                    {
                        gunModel = temp.GetChild(j).gameObject;
                        break;
                    }
                }
            }
        }

        var test = rangeWeaponFactory.Create(WeaponTypes.SLUG_GUN);
        test.Character = Character;
        messageDispatcher.DispatchMessage(new Telegram(test, null, true));

        Character.CharacterType = CharacterTypes.ENEMY;
        Character.AddWeapon((RangeWeaponBase)slugGun);
        Character.Equip(slugGun);
        gun = gameObject.GetComponentInChildren<Gun>();

        base.Start();
    }
Exemple #4
0
 // Use this for initialization
 void Start()
 {
     machineGun = GetComponent<MachineGun>();
     rocketLauncher = GetComponent<RocketLauncher>();
     gun = GetComponent<Gun>();
     shotgun = GetComponent<Shotgun>();
 }
	void revertState( Gun gun ) 
	{ 
		gun.capacity = gun.loadedAmmo.magSize;
		gun.isReloading = false; 
		
		gun.reloadFinished();
	}
 public void DropWeapon(Gun weaponToDrop)
 {
     Vector3 dropPosition = transform.position;
     dropPosition.y = 0f;
     ItemDisplay itemDisplay = (Instantiate(Resources.Load("Prefabs/ItemDisplay"), dropPosition, Quaternion.identity) as GameObject).GetComponent<ItemDisplay>();
     itemDisplay.Init(weaponToDrop.gameObject, 30f, true);
 }
Exemple #7
0
    public void ApplyDamage(Gun gun, int damage)
    {
      if (damage < 1 || damage >= MaxDamage)
      {
        throw new ArgumentOutOfRangeException("damage", "Damage must be 1-4.");
      }

      if (gun == Gun.Left)
      {
        if (IsLeftGunDead)
        {
          throw new InvalidOperationException("Cannot shoot left gun, it is already dead.");
        }

        LeftGun += damage;
      }
      else if (gun == Gun.Right)
      {
        if (IsRightGunDead)
        {
          throw new InvalidOperationException("Cannot shoot right gun, it is already dead.");
        }

        RightGun += damage;
      }
      else
      {
        throw new InvalidOperationException("Can only be called with gun set to Left or Right.");
      }
    }
Exemple #8
0
    // Currently will just create a Penny
    // public Player()
    // {
    //
    //
    // }
    public void Start()
    {
        pGun = (GameObject)Instantiate((GameObject)(Resources.Load("Prefabs/Guns/TestGun"))) ;
        pGun.transform.parent = gameObject.transform ;

        gun = pGun.GetComponent<Gun>() ;
    }
 // Use this for initialization
 void Start()
 {
     enable_control = false;
     g = null;
     pp = null;
     checkForControl();
 }
Exemple #10
0
	public void EquipGun(Gun gunToEquip) {
		if (equippedGun != null) {    //????????????
			Destroy(equippedGun.gameObject);
		}
		equippedGun = Instantiate (gunToEquip, weaponHold.position, weaponHold.rotation) as Gun;  // создаем оружие используя точку появления
		equippedGun.transform.parent = weaponHold; //????????????
	}
	void onUIUpdate( Gun gun, PlayerController._GameState state, GameObject clicked, EnemyStats stats )
	{
		if( clicked == gameObject && state != PlayerController._GameState.None )
		{
			if( Application.platform == RuntimePlatform.IPhonePlayer )
				ChartBoostBinding.trackEvent( "Health Pack Use" );
			
			switch( name )
			{
			case "HPackTiny":
				DBAccess.instance.userPrefs.useHealthPack(0);
				tweenScale();
				break;
			case "HPackSmall":
				DBAccess.instance.userPrefs.useHealthPack(1);
				tweenScale();
				break;
			case "HPackMedium":
				DBAccess.instance.userPrefs.useHealthPack(2);
				tweenScale();
				break;
			case "HPackLarge":
				DBAccess.instance.userPrefs.useHealthPack(3);
				tweenScale();
				break;
			case "HPackHuge":
				DBAccess.instance.userPrefs.useHealthPack(4);
				tweenScale();
				break;
			default:
				break;
			}
		}
	}
        protected override void Start()
        {
            // TODO remove player checks from this class once a better solution than flipping the elbo is found
            if (this is Player)
            {
                playerWrist = GameObject.FindGameObjectWithTag("GunRotator");
                gunFlip = playerWrist.GetComponent<Gun>();
            }

            var boxCollider = gameObject.GetComponent<BoxCollider>();
            rotationBox = new AABB3D(Vector3.zero,
                boxCollider.size.x * transform.lossyScale.x,
                boxCollider.size.y * transform.lossyScale.y,
                boxCollider.size.z * transform.lossyScale.z);
            if (transform.GetChild(preventDeformation).name == "PreventDeformedObject")
            {
                findModelWithDeformationProtection();
            }
            else
            {
                findModelWithoutDeformationProtection();
            }

            base.Start();
        }
Exemple #13
0
    void Handle_GunFire(Player p, Gun g, int score)
    {
        //Debug.Log("Handle_GunFire");
        Bullet prefabBullet = ModuleBullet.Get_PrefabBullet_Used(g);
        //tk2dAnimatedSprite ani;

        if (prefabBullet == null)
            return;
        GunLevelType gLvType = g.GetLevelType();
        GunPowerType gPowerType = g.GetPowerType();
        int NumInstance = 2 + (int)gLvType;//���ɵ�����
        float widthBullet = WidthBulletNormal[(int)g.GetLevelType()];
        Vector3 posOffset = new Vector3(-widthBullet * NumInstance / 2F, 0F);
        for (int i = 0; i != NumInstance; ++i)
        {
            Bullet b = Pool_GameObj.GetObj(prefabBullet.gameObject).GetComponent<Bullet>();
            b.Prefab_GoAnisprBullet = Prefab_AniBullet;
            b.Prefab_SpriteNameSet = gPowerType == GunPowerType.Normal ? nameSetAniBulletNor : nameSetAniBulletLizi;

            BulletEx_Splitor bEx_Splitor = b.gameObject.AddComponent<BulletEx_Splitor>();
            bEx_Splitor.FactorSplit = NumInstance;

            b.transform.position = g.local_GunFire.position + g.AniSpr_GunPot.transform.rotation * posOffset;
            posOffset.x += widthBullet;
            b.Score = score;
            b.Fire(p, null, g.AniSpr_GunPot.transform.rotation);
        }
    }
Exemple #14
0
	void onUIUpdate( Gun gun, PlayerController._GameState state, GameObject clicked, EnemyStats stats )
	{	
		if( clicked == gameObject )
		{			
			if( onPause != null )
				onPause();
		}
		
		/*if( state == PlayerController._GameState.Reload )
		{	
			iTween.MoveTo( PARENT, iTween.Hash(
				"y", TWEEN_POS,
				"islocal", true,
				"time", 0.4f,
				"easetype", iTween.EaseType.easeOutBack
				)
			);
		}
		if( state == PlayerController._GameState.Active || state == PlayerController._GameState.IsReloading )
		{
			iTween.MoveTo( PARENT, iTween.Hash(
				"y", RESET_POS,
				"islocal", true,
				"time", 0.4f,
				"easetype", iTween.EaseType.easeInBack
				)
			);
		}*/
	}
	public void EquipGun(Gun gunToEquip) {
		if (equippedGun != null) {
			Destroy(equippedGun.gameObject);
		}
		equippedGun = Instantiate (gunToEquip, weaponHold.position,weaponHold.rotation) as Gun;
		equippedGun.transform.parent = weaponHold;
	}
Exemple #16
0
 public override void OnInspectorGUI()
 {
     targetGun = (Gun)target;
     base.OnInspectorGUI();
     EditorGUILayout.LabelField("Damage Per Shot", string.Format("{0:f2}", targetGun.GetDamagePerShot()));
     EditorGUILayout.LabelField("Damage Per Second", string.Format("{0:f2}", targetGun.GetDamagePerSecond()));
 }
	void onUIUpdate( Gun gun, PlayerController._GameState state, GameObject clicked, EnemyStats stats )
	{
		if( state == PlayerController._GameState.Results && stats != null && canPress )
		{
			canPress = false;
			
			expLabel.text = "0";
			goldLabel.text = DBAccess.instance.userPrefs.Gold.ToString();
			
			iTween.MoveTo( windowPanel.gameObject, iTween.Hash(
				"position", RESET_POS,
				"islocal", true,
				"time", 0.4f,
				"delay", 2f,
				"easetype", iTween.EaseType.easeOutExpo
				)
			);
			
			float expEarned = ( ( (float)stats.level / (float)DBAccess.instance.userPrefs.Level ) * (float)DBAccess.instance.userPrefs.Level ) * 3;
			float goldEarned = expEarned / 2f;
			
			
			
			iTween.ValueTo( gameObject, iTween.Hash(
				"from", 0,
				"to", expEarned,
				"delay", 3f,
				"time", 1f,
				"onupdatetarget", gameObject,
				"onupdate", "expValueTo",
				"easetype", iTween.EaseType.easeOutExpo
				)
			);
			
			iTween.ValueTo( gameObject, iTween.Hash(
				"from", DBAccess.instance.userPrefs.Gold,
				"to", goldEarned,
				"delay", 3f,
				"time", 1f,
				"onupdatetarget", gameObject,
				"onupdate", "goldValueTo",
				"oncompletetarget", gameObject,
				"oncomplete", "setExpAndGold",
				"oncompleteparams", expEarned,
				"easetype", iTween.EaseType.easeOutExpo
				)
			);
		}
		else if( state == PlayerController._GameState.Dead )
			StartCoroutine( deathRoutine(stats) );
		
		if( clicked != null && state != PlayerController._GameState.Dead ) 
		{
			if( clicked == gameObject )
			{
				moveGridTo(curPos+1);
			}
		}
	}
 void Start()
 {
     gun = Gun.gameObject.GetComponent<Gun>();
     if(gun == null)
     {
         Debug.LogWarning(Gun.gameObject.name + " does not have a Gun script attached to it!");
     }
 }
 private void Start()
 {
     theTransform = transform;
     GameObject gO = GameObject.FindWithTag("Player");
     player = gO.transform;
     gun = gO.GetComponentInChildren<Gun>();
     custom = GameObject.FindWithTag("Scripts").GetComponent<CustomPlayClipAtPoint>();
 }
Exemple #20
0
    // Use this for initialization
    void Start()
    {
        Debug.Log ("Initializing Soldier");
        lastShot = 0;

        gun = this.transform.GetChild (0).GetChild(0);
        gunObj = GetComponentInChildren<Gun> ();
    }
Exemple #21
0
 public SpaceShip(GameCore gameRef, Sprite sprite)
 {
     this.game = gameRef;
     this.sprite = sprite;
     health = new Health(10);
     guns = new Gun[1];
     guns[0] = new Gun(game,77,27);
 }
    void checkForControl()
    {
        pp = GameObject.Find("Mathius").GetComponent("PaulPlayer") as PaulPlayer;
        g = GameObject.Find("Gun").GetComponent("Gun") as Gun;

        if(pp==null || g == null) enable_control = false;
        else enable_control = true;
    }
Exemple #23
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetButton ("Fire1") && Time.time > nextFire) {
                        nextFire = Time.time + fireRate;
                        activeGun.Shoot ();

                        activeGun = activeGun == leftGun ? rightGun : leftGun;
                }
    }
Exemple #24
0
	public void EquipGun(Gun gunToEquip) {
		if (equippedGun != null) {
			Destroy(equippedGun.gameObject);
		}
		equippedGun = Instantiate (gunToEquip, weaponHold.position,weaponHold.rotation) as Gun;
		equippedGun.transform.parent = weaponHold;
		equippedGun.transform.localEulerAngles = new Vector3(0,180,0);
		equippedGun.tag = "bow";
	}
Exemple #25
0
    void Start()
    {
        /*primaryGun = GetComponent<Gun_Terraformer>();
        if (primaryGun == null)
            primaryGun = GetComponent<Gun_MagnetGun>();*/

        primaryGun = GetComponent<Gun_Terraformer>();
        pulseGun = GetComponent<Gun_PulseGun>();
    }
 public void BuyGun(Gun g, int price)
 {
     if (player.Gold >= price)
     {
         SoundManager.PlaySound("purchase");
         player.Gold -= price;
         player.Guns.Add(g);
     }
 }
Exemple #27
0
    public void EquipGun(Gun gunToEquip)
    {
        if(equippedGun!=null){
            Destroy(equippedGun.gameObject);
        }

        equippedGun = Instantiate (gunToEquip, armaCarregada.position, armaCarregada.rotation) as Gun;
        equippedGun.transform.parent = armaCarregada;
    }
Exemple #28
0
 public int GetGunDamage(Gun gun)
 {
   switch (gun)
   {
     case Gun.Left: return LeftGun;
     case Gun.Right: return RightGun;
     default: throw new ArgumentOutOfRangeException("gun");
   }
 }
	public void GunEquip (Gun gunToEquip)
	{
		if (EquippedGun != null)
		{
			Destroy(EquippedGun.gameObject);
		}
		EquippedGun = Instantiate (gunToEquip, GunHold.position, GunHold.rotation) as Gun;
		EquippedGun.transform.parent = GunHold;
	}
Exemple #30
0
    // Currently will just create a Penny
    // public Player()
    // {
    //
    //
    // }
    public void Start()
    {
        pGun = (GameObject)Instantiate((GameObject)(Resources.Load("Prefabs/Guns/TestGun"))) ;
        //pGun.transform.position = gameObject.transform.position ;
        pGun.transform.parent = gameObject.transform ;
        pGun.transform.localPosition = new Vector3(0,0,0) ;

        gun = pGun.GetComponent<Gun>() ;
    }
Exemple #31
0
 public override void OnPostFired(PlayerController player, Gun gun)
 {
     gun.PreventNormalFireAudio = true;
     AkSoundEngine.PostEvent("Play_WPN_seriouscannon_shot_01", gameObject);
 }
 private void Start()
 {
     gun = gameObject.GetComponent <Gun>();
 }
 private void HandleGunChanged(Gun oldGun, Gun newGun, bool arg3)
 {
     this.RemoveGunShader(oldGun);
     this.ProcessGunShader(newGun);
 }
 public override void OnPostFired(PlayerController player, Gun gun)
 {
     gun.PreventNormalFireAudio = true;
 }
Exemple #35
0
        public static void Init()
        {
            Gun pistol = ETGMod.Databases.Items.NewGun("Bootleg Pistol", "bootleg_pistol");

            Game.Items.Rename("outdated_gun_mods:bootleg_pistol", "ex:bootleg_pistol");
            pistol.SetShortDescription("Of questionable quality...");
            pistol.SetLongDescription("It's a counterfeit gun.\n\nDue to low quality standards, this weapon may be prone to exploding under certain circumstances...");
            GunExt.SetupSprite(pistol, null, "bootleg_pistol_idle_001", 18);
            pistol.AddProjectileModuleFrom("Magnum", true, false);
            pistol.DefaultModule.ammoCost = 1;
            pistol.PreventOutlines        = true;
            pistol.Volley          = (PickupObjectDatabase.GetById(38) as Gun).Volley;
            pistol.singleModule    = (PickupObjectDatabase.GetById(38) as Gun).singleModule;
            pistol.RawSourceVolley = (PickupObjectDatabase.GetById(38) as Gun).RawSourceVolley;
            pistol.alternateVolley = (PickupObjectDatabase.GetById(38) as Gun).alternateVolley;
            pistol.reloadTime      = 1;
            pistol.gunClass        = GunClass.PISTOL;
            pistol.ammo            = 140;
            pistol.SetBaseMaxAmmo(140);
            pistol.quality        = ItemQuality.D;
            pistol.UsesCustomCost = true;
            pistol.CustomCost     = 10;
            pistol.encounterTrackable.EncounterGuid = "baad9dd6d005458daf02933f6a1ba926";
            pistol.gameObject.AddComponent <ExpandRemoveGunOnAmmoDepletion>();
            pistol.gameObject.AddComponent <ExpandMaybeLoseAmmoOnDamage>();
            ETGMod.Databases.Items.Add(pistol);

            BootlegPistolID = pistol.PickupObjectId;


            Gun machinepistol = ETGMod.Databases.Items.NewGun("Bootleg Machine Pistol", "bootleg_machinepistol");

            Game.Items.Rename("outdated_gun_mods:bootleg_machine_pistol", "ex:bootleg_machine_pistol");
            machinepistol.SetShortDescription("Of questionable quality...");
            machinepistol.SetLongDescription("It's a counterfeit machine gun.\n\nDue to low quality standards, this weapon may be prone to exploding under certain circumstances...");
            GunExt.SetupSprite(machinepistol, null, "bootleg_machinepistol_idle_001", 30);
            machinepistol.AddProjectileModuleFrom("Magnum", true, false);
            machinepistol.Volley          = (PickupObjectDatabase.GetById(43) as Gun).Volley;
            machinepistol.singleModule    = (PickupObjectDatabase.GetById(43) as Gun).singleModule;
            machinepistol.RawSourceVolley = (PickupObjectDatabase.GetById(43) as Gun).RawSourceVolley;
            machinepistol.alternateVolley = (PickupObjectDatabase.GetById(43) as Gun).alternateVolley;
            machinepistol.PreventOutlines = true;
            machinepistol.reloadTime      = 1.2f;
            machinepistol.gunClass        = GunClass.FULLAUTO;
            machinepistol.ammo            = 600;
            machinepistol.SetBaseMaxAmmo(600);
            machinepistol.quality        = ItemQuality.D;
            machinepistol.gunSwitchGroup = "Uzi";
            machinepistol.UsesCustomCost = true;
            machinepistol.CustomCost     = 15;
            machinepistol.encounterTrackable.EncounterGuid = "e56adda5081347e5b9e0cf2556689b0e";
            machinepistol.gameObject.AddComponent <ExpandRemoveGunOnAmmoDepletion>();
            machinepistol.gameObject.AddComponent <ExpandMaybeLoseAmmoOnDamage>();

            ETGMod.Databases.Items.Add(machinepistol);

            BootlegMachinePistolID = machinepistol.PickupObjectId;


            Gun shotgun = ETGMod.Databases.Items.NewGun("Bootleg Shotgun", "bootleg_shotgun");

            Game.Items.Rename("outdated_gun_mods:bootleg_shotgun", "ex:bootleg_shotgun");
            shotgun.SetShortDescription("Of questionable quality...");
            shotgun.SetLongDescription("It's a counterfeit shotgun.\n\nDue to low quality standards, this weapon may be prone to exploding under certain circumstances...");
            GunExt.SetupSprite(shotgun, null, "bootleg_shotgun_idle_001", 18);
            shotgun.AddProjectileModuleFrom("AK-47", true, false);
            shotgun.Volley          = (PickupObjectDatabase.GetById(51) as Gun).Volley;
            shotgun.singleModule    = (PickupObjectDatabase.GetById(51) as Gun).singleModule;
            shotgun.RawSourceVolley = (PickupObjectDatabase.GetById(51) as Gun).RawSourceVolley;
            shotgun.alternateVolley = (PickupObjectDatabase.GetById(51) as Gun).alternateVolley;
            shotgun.PreventOutlines = true;
            shotgun.reloadTime      = 1.8f;
            shotgun.gunClass        = GunClass.SHOTGUN;
            shotgun.ammo            = 150;
            shotgun.SetBaseMaxAmmo(150);
            shotgun.quality        = ItemQuality.D;
            shotgun.gunSwitchGroup = "Shotgun";
            shotgun.UsesCustomCost = true;
            shotgun.CustomCost     = 18;
            shotgun.encounterTrackable.EncounterGuid = "fa0575b4cf0140ddb6b0ed6d962bff47";
            shotgun.gameObject.AddComponent <ExpandRemoveGunOnAmmoDepletion>();
            shotgun.gameObject.AddComponent <ExpandMaybeLoseAmmoOnDamage>();

            ETGMod.Databases.Items.Add(shotgun);

            BootlegShotgunID = shotgun.PickupObjectId;


            BootlegPistol        = pistol;
            BootlegMachinePistol = machinepistol;
            BootlegShotgun       = shotgun;
        }
Exemple #36
0
        public static void Add()
        {
            // Get yourself a new gun "base" first.
            // Let's just call it "Basic Gun", and use "jpxfrd" for all sprites and as "codename" All sprites must begin with the same word as the codename. For example, your firing sprite would be named "jpxfrd_fire_001".
            Gun gun = ETGMod.Databases.Items.NewGun("Lich's Trigger Hand", "hand");

            // "kp:basic_gun determines how you spawn in your gun through the console. You can change this command to whatever you want, as long as it follows the "name:itemname" template.
            Game.Items.Rename("outdated_gun_mods:lich's_trigger_hand", "ski:lich's_trigger_hand");
            gun.gameObject.AddComponent <Za_hando>();

            //These two lines determines the description of your gun, ".SetShortDescription" being the description that appears when you pick up the gun and ".SetLongDescription" being the description in the Ammonomicon entry.
            gun.SetShortDescription("I'll scrape you away!");
            gun.SetLongDescription("The lich was infamous for scooping up the gundead to use as ammunitions. Though the trigger finger has been torn off, much of its original power still remains.\n\n" +
                                   "_____________________________________________________\n\n" +
                                   "This weapon consumes all entities in a ~3 meter range when reloading, EXCEPT for Major Bosses, Mimics, NPcs and Companions." +
                                   "\n\n\n - Knife_to_a_Gunfight");
            // This is required, unless you want to use the sprites of the base gun.
            // That, by default, is the pea shooter.
            // SetupSprite sets up the default gun sprite for the ammonomicon and the "gun get" popup.
            // WARNING: Add a copy of your default sprite to Ammonomicon Encounter Icon Collection!
            // That means, "sprites/Ammonomicon Encounter Icon Collection/defaultsprite.png" in your mod .zip. You can see an example of this with inside the mod folder.
            gun.SetupSprite(null, "hand_idle_001", 8);
            // ETGMod automatically checks which animations are available.
            // The numbers next to "shootAnimation" determine the animation fps. You can also tweak the animation fps of the reload animation and idle animation using this method.
            gun.SetAnimationFPS(gun.shootAnimation, 8);
            gun.SetAnimationFPS(gun.reloadAnimation, 8);
            // Every modded gun has base projectile it works with that is borrowed from other guns in the game.
            // The gun names are the names from the JSON dump! While most are the same, some guns named completely different things. If you need help finding gun names, ask a modder on the Gungeon discord.
            gun.AddProjectileModuleFrom("balloon_gun", true, true);
            for (int i = 0; i < 3; i++)
            {
                gun.AddProjectileModuleFrom(PickupObjectDatabase.GetById(520) as Gun, true, false);
                gun.gunSwitchGroup = (PickupObjectDatabase.GetById(520) as Gun).gunSwitchGroup;
            }
            foreach (ProjectileModule projectileModule in gun.Volley.projectiles)
            {
                projectileModule.ammoCost            = 1;
                projectileModule.shootStyle          = ProjectileModule.ShootStyle.SemiAutomatic;
                projectileModule.sequenceStyle       = ProjectileModule.ProjectileSequenceStyle.Random;
                projectileModule.cooldownTime        = .01f;
                projectileModule.angleVariance       = 23f;
                projectileModule.numberOfShotsInClip = 1;
                Projectile projectile = UnityEngine.Object.Instantiate <Projectile>(projectileModule.projectiles[0]);
                projectile.gameObject.SetActive(false);
                projectileModule.projectiles[0]      = projectile;
                projectile.baseData.damage          *= 0f;
                projectile.baseData.speed           *= 1f;
                projectile.baseData.range            = 3.5f;
                projectile.baseData.force            = -3;
                projectile.AppliedStunDuration       = .5f;
                projectile.StunApplyChance           = 100f;
                projectile.AppliesStun               = true;
                projectile.HasDefaultTint            = true;
                projectile.DefaultTintColor          = UnityEngine.Color.blue;
                projectile.collidesWithProjectiles   = true;
                projectile.projectileHitHealth       = 1000;
                projectile.baseData.damage           = 2f;
                projectile.AdditionalScaleMultiplier = .4f;
                FakePrefab.MarkAsFakePrefab(projectile.gameObject);
                UnityEngine.Object.DontDestroyOnLoad(projectile);

                bool flag = projectileModule != gun.DefaultModule;
            }
            gun.gunHandedness = GunHandedness.HiddenOneHanded;
            gun.reloadTime    = 1f;
            gun.DefaultModule.cooldownTime        = .01f;
            gun.DefaultModule.numberOfShotsInClip = 1;
            gun.SetBaseMaxAmmo(100);
            // Here we just set the quality of the gun and the "EncounterGuid", which is used by Gungeon to identify the gun.
            gun.quality = PickupObject.ItemQuality.S;
            gun.encounterTrackable.EncounterGuid = "Oi Josuke!";



            ETGMod.Databases.Items.Add(gun, null, "ANY");
        }
 public override void UseGun(Gun gun)
 {
     Console.WriteLine(this.GetType().Name + " uses " + gun.GetType().Name);
 }
Exemple #38
0
 public void OnShoot(Vector2 direction, GameObject shooter, Gun weapon, BodyPartType targetZone = BodyPartType.Chest)
 {
     this.shooter    = shooter;
     this.targetZone = targetZone;
 }
Exemple #39
0
    TankInitSystem InitTankPrefabs()
    {
        #region Collision Detect
        if (vehicleData.modelData.MainModel.GetComponentsInChildren <BoxCollider> ().Length == 0)
        {
            if (EditorUtility.DisplayDialog("Error", "Collision should be set.We will redirct you to it.", "OK,l will set it now!", "No,l will choose another one"))
            {
                EditorGUIUtility.PingObject(vehicleData.modelData.MainModel.GetInstanceID());
                OpenEditorScene();

                GameObject EditColliderInstance = Instantiate <GameObject> (vehicleData.modelData.MainModel);
                EditColliderInstance.name = vehicleData.modelData.MainModel.name;

                string TempPath       = System.IO.Path.GetDirectoryName(AssetDatabase.GetAssetPath(vehicleData.modelData.MainModel.GetInstanceID()));
                string PrefabStoreDir = System.IO.Directory.CreateDirectory(string.Format(TempPath + "/Collisions_{0}", vehicleData.modelData.MainModel.name)).FullName;

                AssetDatabase.Refresh();
                return(null);
                //PrefabUtility.CreatePrefab (string.Format (PrefabStoreDir + "/{0}.prefab", vehicleData.modelData.MainModel.name),EditColliderInstance);
            }
            else
            {
                return(null);
            }
        }
        #endregion

        #region Init
        GameObject TankPrefabs  = new GameObject();
        GameObject InstanceMesh = Instantiate(vehicleData.modelData.MainModel);
        InstanceMesh.name = vehicleData.modelData.MainModel.name;
        #endregion

        TankPrefabs.name = InstanceMesh.name + "_Pre";

        InstanceMesh.transform.parent = TankPrefabs.transform;

        GameObject TankTransform = new GameObject("TankTransform");
        TankTransform.transform.parent = InstanceMesh.transform;

        Transform RightWheel, LeftWheel, RightUpperWheels, LeftUpperWheels, Turret, Gun, GunDym;
        #region Find Dumps
        RightWheel = InstanceMesh.transform.Find("RightWheel");
        LeftWheel  = InstanceMesh.transform.Find("LeftWheel");
        Turret     = InstanceMesh.transform.Find("Turret");
        Gun        = Turret.transform.Find("Gun");
        GunDym     = Gun.GetChild(0);


        RightUpperWheels = InstanceMesh.transform.Find("RightUpperWheel");
        LeftUpperWheels  = InstanceMesh.transform.Find("LeftUpperWheel");
        #endregion
        RightWheel.parent       = TankTransform.transform;
        LeftWheel.parent        = TankTransform.transform;
        LeftUpperWheels.parent  = TankTransform.transform;
        RightUpperWheels.parent = TankTransform.transform;


        GameObject TurretTransform = new GameObject("TurretTransform");
        GameObject GunTransform    = new GameObject("GunTransform");
        GameObject GunDymTransform = new GameObject("GunDym");

        VehicleComponentsReferenceManager referenceManager = InstanceMesh.AddComponent <VehicleComponentsReferenceManager>();

        TurretTransform.transform.SetParent(InstanceMesh.transform);
        TurretTransform.transform.position = Turret.transform.position;

        GunTransform.transform.position = Gun.transform.position;
        Turret.parent = TurretTransform.transform;

        Gun.parent = GunTransform.transform;
        GunTransform.transform.SetParent(TurretTransform.transform);

        GunDymTransform.transform.position = GunDym.transform.position;
        GunDymTransform.transform.SetParent(GunTransform.transform);
        GunDym.SetParent(GunDymTransform.transform);

        #region Add fire animation
        Animator FireAnimator = GunDymTransform.AddComponent <Animator> ();
        FireAnimator.runtimeAnimatorController = vehicleData.vehicleTextData.TFParameter.GymAnimation;
        #endregion

        AddDumpNode("FFPoint", GunTransform.transform, true, referenceManager);
        AddDumpNode("EffectStart", GunTransform.transform, true, referenceManager);
        AddDumpNode("FireForceFeedbackPoint", InstanceMesh.transform, true, referenceManager);
        AddDumpNode("EngineSmoke", InstanceMesh.transform, true, referenceManager);
        AddDumpNode("EngineSound", InstanceMesh.transform, true, referenceManager);
        AddDumpNode("MainCameraFollowTarget", InstanceMesh.transform, true, referenceManager);
        AddDumpNode("MainCameraGunner", GunTransform.transform, true, referenceManager);
        AddDumpNode("MachineGunFFPoint", TurretTransform.transform, true, referenceManager);
        AddDumpNode("CenterOfGravity", InstanceMesh.transform, true, referenceManager);

        referenceManager.LeftTrack  = InstanceMesh.transform.Find("LeftTrack").gameObject;
        referenceManager.RightTrack = InstanceMesh.transform.Find("RightTrack").gameObject;

        GameObject HitBoxInstance = Instantiate <GameObject> (vehicleData.modelData.HitBox.HitBoxPrefab);
        HitBoxInstance.transform.Find("Main").name = "MainHitBox";
        HitBoxInstance.transform.Find("MainHitBox").SetParent(InstanceMesh.transform);

        HitBoxInstance.transform.Find("Turret").name = "TurretHitBox";
        HitBoxInstance.transform.Find("TurretHitBox").SetParent(TurretTransform.transform);

        HitBoxInstance.transform.Find("Gun").name = "GunHitBox";
        HitBoxInstance.transform.Find("GunHitBox").SetParent(GunTransform.transform);

        HitBoxInstance.transform.Find("Dym").name = "DymHitBox";
        HitBoxInstance.transform.Find("DymHitBox").SetParent(GunDymTransform.transform);

        DestroyImmediate(HitBoxInstance);
        Restore(LeftWheel.GetComponentsInChildren <Transform> ());
        Restore(RightWheel.GetComponentsInChildren <Transform> ());

        Restore(LeftUpperWheels.GetComponentsInChildren <Transform> ());
        Restore(RightUpperWheels.GetComponentsInChildren <Transform> ());

        new GameObject("MainCameraTarget").transform.SetParent(TurretTransform.transform);

        TankInitSystem initySystem = TankPrefabs.AddComponent <TankInitSystem>();
        initySystem.PSParameter  = vehicleData.vehicleTextData.PSParameter;
        initySystem.TFParameter  = vehicleData.vehicleTextData.TFParameter;
        initySystem.MTParameter  = vehicleData.vehicleTextData.MTParameter;
        initySystem.PTCParameter = vehicleData.vehicleTextData.PTCParameter;

        return(initySystem);
    }
 /// <summary>
 /// OnPreFireProjectileModifier() is called before the gun shoots a projectile. If the method returns something that's not the projectile argument, the projectile the gun will shoot will be replaced with the returned projectile.
 /// </summary>
 /// <param name="gun">The gun.</param>
 /// <param name="projectile">Original projectile.</param>
 /// <param name="mod">Target ProjectileModule.</param>
 /// <returns>The replacement projectile.</returns>
 public virtual Projectile OnPreFireProjectileModifier(Gun gun, Projectile projectile, ProjectileModule mod)
 {
     return(projectile);
 }
 /// <summary>
 /// OnBurstContinuedSafe() is called when the gun continues a burst (attacks while bursting) and if the gun's owner is a player.
 /// </summary>
 /// <param name="player">The player. Can't be null.</param>
 /// <param name="gun">The gun.</param>
 public virtual void OnBurstContinuedSafe(PlayerController player, Gun gun)
 {
 }
 /// <summary>
 /// OnAmmoChangedSafe() is called when the gun's ammo amount increases/decreases and if the gun's owner is a player.
 /// </summary>
 /// <param name="player">The player. Can't be null.</param>
 /// <param name="gun">The gun.</param>
 public virtual void OnAmmoChangedSafe(PlayerController player, Gun gun)
 {
 }
 /// <summary>
 /// OnReloadSafe() is called when the gun is reloaded and the gun's owner is a player.
 /// </summary>
 /// <param name="player">The player that reloaded the gun. Can't be null.</param>
 /// <param name="gun">The gun.</param>
 public virtual void OnReloadSafe(PlayerController player, Gun gun)
 {
 }
    // Update is called once per frame
    void Update()
    {
        if (startGame == false)
        {
            Time.timeScale = 0f;
        }

        if (Input.GetKeyDown(KeyCode.Space) && startGame == false)
        {
            gameStart          = true;
            Time.timeScale     = 1f;
            ClockShots.text    = "";
            startGameText.text = "";
            startGame          = true;
        }

        //Sets the highscore to the highest score stored in PlayerPrefs
        highScore = PlayerPrefs.GetInt(highscoreKey);

        //The clock will go down depending on how much the bullets have slowed down
        clock -= (slowDown * Time.deltaTime);

        //Finds the gun in the scene and gets the script on it
        GameObject gun       = GameObject.Find("Gun");
        Gun        gunscript = gun.GetComponent <Gun> ();

        //This switch statement gives each bullet count an amount to slow down the clock by
        switch (gunscript.bulletCount)
        {
        case 6:
            slowDown = 1f;
            break;

        case 5:
            slowDown = .875f;
            break;

        case 4:
            slowDown = .75f;
            break;

        case 3:
            slowDown = .625f;
            break;

        case 2:
            slowDown = .5f;
            break;

        case 1:
            slowDown = .375f;
            break;

        case 0:
            slowDown = .25f;
            break;
        }

        //The clock will read the lowest int of the current time
        if (startGame == true)
        {
            clockText.text = "" + Mathf.FloorToInt(clock);
        }

        //Goes into the gun script and plays the the gunshot sound effect when gun is shot. Also changes the audio clip depending on the bulletCount
        if (gunscript.shotsound && gunscript.bulletCount > 2f)
        {
            audioSource.PlayOneShot(shotSound, .4f);
            gunscript.shotsound = false;
        }
        else if (gunscript.shotsound && gunscript.bulletCount <= 2f)
        {
            audioSource.PlayOneShot(slowShotSound, .4f);
            gunscript.shotsound = false;
        }

        if (gunscript.reloadSound)
        {
            audioSource.PlayOneShot(reloadSound, 1f);
            gunscript.reloadSound = false;
        }

        //The score will show as the score earned this round
        if (startGame == true)
        {
            scoreText.text = "Score: " + score;
        }

        //If the score is greater than the highscore, than set the PlayerPrefs to the score
        if (score > highScore)
        {
            PlayerPrefs.SetInt(highscoreKey, score);
            PlayerPrefs.Save();
        }

        //If the clock reaches less than 0, Game Over
        if (clock <= 0)
        {
            clock = 0;
            GameOver();
        }

        //Finds the player on the scene and gets its script
        GameObject  player       = GameObject.FindGameObjectWithTag("Player");
        NSMMovement playerScript = player.GetComponent <NSMMovement> ();

        //If player is hit with a bullet, Game Over
        if (playerScript.playerDead)
        {
            GameOver();
        }

        //If the restart is true and Escape is pressed, load the scene again and return Time.timeScale back to 1
        if (restart)
        {
            if (Input.GetKeyDown(KeyCode.Space))
            {
                SceneManager.LoadScene(0);
                Time.timeScale = 1;
            }
        }
    }
Exemple #45
0
        public static void Add()
        {
            Gun gun = ETGMod.Databases.Items.NewGun("Super Disc Gun", "discgun_superdiscsynergyforme");

            Game.Items.Rename("outdated_gun_mods:super_disc_gun", "nn:disc_gun+super_disc");
            gun.gameObject.AddComponent <DiscGunSuperDiscForme>();
            gun.SetShortDescription("Badder Choices");
            gun.SetLongDescription("Fires a shit-ton of discs. If you're reading this, you're a hacker.");

            gun.SetupSprite(null, "discgun_superdiscsynergyforme_idle_001", 8);
            gun.SetAnimationFPS(gun.shootAnimation, 14);

            for (int i = 0; i < 5; i++)
            {
                gun.AddProjectileModuleFrom(PickupObjectDatabase.GetById(86) as Gun, true, false);
            }

            foreach (ProjectileModule mod in gun.Volley.projectiles)
            {
                mod.ammoCost            = 1;
                mod.shootStyle          = ProjectileModule.ShootStyle.SemiAutomatic;
                mod.sequenceStyle       = ProjectileModule.ProjectileSequenceStyle.Random;
                mod.cooldownTime        = 0.25f;
                mod.numberOfShotsInClip = 10;
                mod.angleVariance       = 20f;

                Projectile projectile = UnityEngine.Object.Instantiate <Projectile>(mod.projectiles[0]);
                projectile.gameObject.SetActive(false);
                FakePrefab.MarkAsFakePrefab(projectile.gameObject);
                UnityEngine.Object.DontDestroyOnLoad(projectile);
                mod.projectiles[0]          = projectile;
                projectile.baseData.damage *= 4f;
                projectile.baseData.range  *= 20f;
                projectile.baseData.speed  *= 0.4f;
                projectile.SetProjectileSpriteRight("discgun_projectile", 15, 15, true, tk2dBaseSprite.Anchor.MiddleCenter, 9, 9);
                SelfHarmBulletBehaviour SuicidalTendancies = projectile.gameObject.AddComponent <SelfHarmBulletBehaviour>();

                PierceProjModifier Piercing = projectile.gameObject.GetOrAddComponent <PierceProjModifier>();
                Piercing.penetratesBreakables = true;
                Piercing.penetration         += 10;
                BounceProjModifier Bouncing = projectile.gameObject.GetOrAddComponent <BounceProjModifier>();
                Bouncing.numberOfBounces = 10;
                if (mod != gun.DefaultModule)
                {
                    mod.ammoCost = 0;
                }
                projectile.transform.parent = gun.barrelOffset;
            }

            gun.reloadTime = 1f;
            gun.SetBaseMaxAmmo(300);
            //gun.DefaultModule.positionOffset = new Vector3(1f, 0f, 0f);
            gun.barrelOffset.transform.localPosition = new Vector3(1.75f, 1.12f, 0f);


            //BULLET STATS

            gun.quality = PickupObject.ItemQuality.EXCLUDED;

            gun.encounterTrackable.EncounterGuid = "this is the Disc Gun Super Disc Synergy Forme";
            ETGMod.Databases.Items.Add(gun, null, "ANY");

            string bleh = "Not a Bot, if you're sniffing around in my code, lookin to steal for the Nuclear Throne Mode, you're a stinker. It's cool, I'm a stinker too, just wanted to let you know";

            if (bleh == null)
            {
                ETGModConsole.Log("BOT WHAT THE F**K DID YOU DO");
            }

            DiscGunSuperDiscSynergyFormeID = gun.PickupObjectId;
        }
Exemple #46
0
 // Gun 스크립트 세팅
 public void SetGun(Gun gun)
 {
     GunScript = gun;
 }
 public virtual void OnAutoReload(PlayerController player, Gun gun)
 {
 }
 public void Start()
 {
     rend  = GetComponent <Renderer>();
     agent = GetComponent <NavMeshAgent>();
     gun   = GetComponentInChildren <Gun>(); //?
 }
Exemple #49
0
 private void OnNewWave(int waveNumber)
 {
     gun = FindObjectOfType <Gun>();
     SubscribeGunEvents();
 }
 public virtual void OnReloadPressed(PlayerController player, Gun gun, bool bSOMETHING)
 {
 }
Exemple #51
0
 public override void OnPostFired(PlayerController player, Gun railsgun)
 {
     gun.PreventNormalFireAudio = true;
     AkSoundEngine.PostEvent("Play_ENM_smiley_whistle_01", gameObject);
     AkSoundEngine.PostEvent("Play_WPN_blunderbuss_shot_01", gameObject);
 }
Exemple #52
0
 public void showContextText(Gun gun, int price)
 {
     contextActionText.enabled = true;
     contextActionText.text    = "Press F to buy " + gun.gunClass + " for " + price.ToString();
 }
 public override void OnPostFired(PlayerController player, Gun gun)
 {
 }
Exemple #54
0
        // POST: api/Gun
        public void Post([FromBody] Gun value)
        {
            var gunService = new GunService();

            gunService.Add(value);
        }
        private void OnOpenedChest(Chest chest, PlayerController player)
        {
            AkSoundEngine.PostEvent("Play_ENM_creecher_peel_01", base.gameObject);

            if (chest.breakAnimName.Contains("wood"))
            {
                PickupObject pickupObject = this.OpenD(player);

                StatModifier statModifier = new StatModifier();
                statModifier.statToBoost = PlayerStats.StatType.Curse;
                statModifier.amount      = 2f;
                statModifier.modifyType  = StatModifier.ModifyMethod.ADDITIVE;

                if (pickupObject is Gun)
                {
                    Gun gun = pickupObject as Gun;
                    Array.Resize <StatModifier>(ref gun.passiveStatModifiers, gun.passiveStatModifiers.Length + 1);
                    gun.passiveStatModifiers[gun.passiveStatModifiers.Length - 1] = statModifier;
                }
                else if (pickupObject is PassiveItem)
                {
                    PassiveItem passiveItem = pickupObject as PassiveItem;
                    Array.Resize <StatModifier>(ref passiveItem.passiveStatModifiers, passiveItem.passiveStatModifiers.Length + 1);
                    passiveItem.passiveStatModifiers[passiveItem.passiveStatModifiers.Length - 1] = statModifier;
                }
                else if (pickupObject is PlayerItem)
                {
                    PlayerItem playerItem = pickupObject as PlayerItem;
                    Array.Resize <StatModifier>(ref playerItem.passiveStatModifiers, playerItem.passiveStatModifiers.Length + 1);
                    playerItem.passiveStatModifiers[playerItem.passiveStatModifiers.Length - 1] = statModifier;
                }
            }

            if (chest.breakAnimName.Contains("silver"))
            {
                PickupObject pickupObject = this.OpenC(player);

                StatModifier statModifier = new StatModifier();
                statModifier.statToBoost = PlayerStats.StatType.Curse;
                statModifier.amount      = 2f;
                statModifier.modifyType  = StatModifier.ModifyMethod.ADDITIVE;

                if (pickupObject is Gun)
                {
                    Gun gun = pickupObject as Gun;
                    Array.Resize <StatModifier>(ref gun.passiveStatModifiers, gun.passiveStatModifiers.Length + 1);
                    gun.passiveStatModifiers[gun.passiveStatModifiers.Length - 1] = statModifier;
                }
                else if (pickupObject is PassiveItem)
                {
                    PassiveItem passiveItem = pickupObject as PassiveItem;
                    Array.Resize <StatModifier>(ref passiveItem.passiveStatModifiers, passiveItem.passiveStatModifiers.Length + 1);
                    passiveItem.passiveStatModifiers[passiveItem.passiveStatModifiers.Length - 1] = statModifier;
                }
                else if (pickupObject is PlayerItem)
                {
                    PlayerItem playerItem = pickupObject as PlayerItem;
                    Array.Resize <StatModifier>(ref playerItem.passiveStatModifiers, playerItem.passiveStatModifiers.Length + 1);
                    playerItem.passiveStatModifiers[playerItem.passiveStatModifiers.Length - 1] = statModifier;
                }
            }

            if (chest.breakAnimName.Contains("green"))
            {
                PickupObject pickupObject = this.OpenB(player);

                StatModifier statModifier = new StatModifier();
                statModifier.statToBoost = PlayerStats.StatType.Curse;
                statModifier.amount      = 2f;
                statModifier.modifyType  = StatModifier.ModifyMethod.ADDITIVE;

                if (pickupObject is Gun)
                {
                    Gun gun = pickupObject as Gun;
                    Array.Resize <StatModifier>(ref gun.passiveStatModifiers, gun.passiveStatModifiers.Length + 1);
                    gun.passiveStatModifiers[gun.passiveStatModifiers.Length - 1] = statModifier;
                }
                else if (pickupObject is PassiveItem)
                {
                    PassiveItem passiveItem = pickupObject as PassiveItem;
                    Array.Resize <StatModifier>(ref passiveItem.passiveStatModifiers, passiveItem.passiveStatModifiers.Length + 1);
                    passiveItem.passiveStatModifiers[passiveItem.passiveStatModifiers.Length - 1] = statModifier;
                }
                else if (pickupObject is PlayerItem)
                {
                    PlayerItem playerItem = pickupObject as PlayerItem;
                    Array.Resize <StatModifier>(ref playerItem.passiveStatModifiers, playerItem.passiveStatModifiers.Length + 1);
                    playerItem.passiveStatModifiers[playerItem.passiveStatModifiers.Length - 1] = statModifier;
                }
            }

            if (chest.breakAnimName.Contains("redgold"))
            {
                PickupObject pickupObject = this.OpenA(player);

                StatModifier statModifier = new StatModifier();
                statModifier.statToBoost = PlayerStats.StatType.Curse;
                statModifier.amount      = 2f;
                statModifier.modifyType  = StatModifier.ModifyMethod.ADDITIVE;

                if (pickupObject is Gun)
                {
                    Gun gun = pickupObject as Gun;
                    Array.Resize <StatModifier>(ref gun.passiveStatModifiers, gun.passiveStatModifiers.Length + 1);
                    gun.passiveStatModifiers[gun.passiveStatModifiers.Length - 1] = statModifier;
                }
                else if (pickupObject is PassiveItem)
                {
                    PassiveItem passiveItem = pickupObject as PassiveItem;
                    Array.Resize <StatModifier>(ref passiveItem.passiveStatModifiers, passiveItem.passiveStatModifiers.Length + 1);
                    passiveItem.passiveStatModifiers[passiveItem.passiveStatModifiers.Length - 1] = statModifier;
                }
                else if (pickupObject is PlayerItem)
                {
                    PlayerItem playerItem = pickupObject as PlayerItem;
                    Array.Resize <StatModifier>(ref playerItem.passiveStatModifiers, playerItem.passiveStatModifiers.Length + 1);
                    playerItem.passiveStatModifiers[playerItem.passiveStatModifiers.Length - 1] = statModifier;
                }
            }


            if (chest.breakAnimName.Contains("black"))
            {
                PickupObject pickupObject = this.OpenS(player);

                StatModifier statModifier = new StatModifier();
                statModifier.statToBoost = PlayerStats.StatType.Curse;
                statModifier.amount      = 2f;
                statModifier.modifyType  = StatModifier.ModifyMethod.ADDITIVE;

                if (pickupObject is Gun)
                {
                    Gun gun = pickupObject as Gun;
                    Array.Resize <StatModifier>(ref gun.passiveStatModifiers, gun.passiveStatModifiers.Length + 1);
                    gun.passiveStatModifiers[gun.passiveStatModifiers.Length - 1] = statModifier;
                }
                else if (pickupObject is PassiveItem)
                {
                    PassiveItem passiveItem = pickupObject as PassiveItem;
                    Array.Resize <StatModifier>(ref passiveItem.passiveStatModifiers, passiveItem.passiveStatModifiers.Length + 1);
                    passiveItem.passiveStatModifiers[passiveItem.passiveStatModifiers.Length - 1] = statModifier;
                }
                else if (pickupObject is PlayerItem)
                {
                    PlayerItem playerItem = pickupObject as PlayerItem;
                    Array.Resize <StatModifier>(ref playerItem.passiveStatModifiers, playerItem.passiveStatModifiers.Length + 1);
                    playerItem.passiveStatModifiers[playerItem.passiveStatModifiers.Length - 1] = statModifier;
                }
            }

            else if (!chest.breakAnimName.Contains("black") && !chest.breakAnimName.Contains("redgold") && !chest.breakAnimName.Contains("green") && !chest.breakAnimName.Contains("silver") && !chest.breakAnimName.Contains("wood"))
            {
                PickupObject pickupObject = this.OpenRandom(player);

                StatModifier statModifier = new StatModifier();
                statModifier.statToBoost = PlayerStats.StatType.Curse;
                statModifier.amount      = 2f;
                statModifier.modifyType  = StatModifier.ModifyMethod.ADDITIVE;

                if (pickupObject is Gun)
                {
                    Gun gun = pickupObject as Gun;
                    Array.Resize <StatModifier>(ref gun.passiveStatModifiers, gun.passiveStatModifiers.Length + 1);
                    gun.passiveStatModifiers[gun.passiveStatModifiers.Length - 1] = statModifier;
                }
                else if (pickupObject is PassiveItem)
                {
                    PassiveItem passiveItem = pickupObject as PassiveItem;
                    Array.Resize <StatModifier>(ref passiveItem.passiveStatModifiers, passiveItem.passiveStatModifiers.Length + 1);
                    passiveItem.passiveStatModifiers[passiveItem.passiveStatModifiers.Length - 1] = statModifier;
                }
                else if (pickupObject is PlayerItem)
                {
                    PlayerItem playerItem = pickupObject as PlayerItem;
                    Array.Resize <StatModifier>(ref playerItem.passiveStatModifiers, playerItem.passiveStatModifiers.Length + 1);
                    playerItem.passiveStatModifiers[playerItem.passiveStatModifiers.Length - 1] = statModifier;
                }
            }
        }
Exemple #56
0
        public void testGunBasic()
        {
            Gun gun = new Gun("2244256138", di);

            Assert.AreEqual("Death's Hand Mk I (Class 1)", gun.Name);
        }
 public virtual void OnFinishAttack(PlayerController player, Gun gun)
 {
 }
Exemple #58
0
 public override void OnPostFired(PlayerController owner, Gun gun)
 {
     AkSoundEngine.PostEvent("Play_wpn_kthulu_soul_01", base.gameObject);
     gun.PreventNormalFireAudio = true;
 }
 /// <summary>
 /// OnHeroSwordCooldownStarted() when the gun's Sword Slash started and if the gun is a HeroSword (if gun.IsHeroSword = true).
 /// </summary>
 /// <param name="player"></param>
 /// <param name="gun"></param>
 public virtual void OnHeroSwordCooldownStarted(PlayerController player, Gun gun)
 {
 }
Exemple #60
0
    void Start()
    {
        hero = GameObject.FindGameObjectWithTag("Player").transform;

        gun = GetComponentInChildren <Gun>();
    }