示例#1
0
 protected override void Awake()
 {
     vp_FPController.cs = this;
     base.Awake();
     this.m_CharacterController         = base.gameObject.GetComponent <CharacterController>();
     this.m_NormalHeight                = this.CharacterController.height;
     this.CharacterController.center    = (this.m_NormalCenter = new Vector3(0f, this.m_NormalHeight * 0.5f, 0f));
     this.CharacterController.radius    = this.m_NormalHeight * 0.25f;
     this.m_CrouchHeight                = this.m_NormalHeight * 0.5f;
     this.m_CrouchCenter                = this.m_NormalCenter * 0.5f;
     this.m_CharacterController.enabled = false;
     this.steps_audio            = base.gameObject.AddComponent <AudioSource>();
     this.steps_walk_concrete[0] = SND.GetSoundByName("player/movement/walk_concrete1");
     this.steps_walk_concrete[1] = SND.GetSoundByName("player/movement/walk_concrete2");
     this.steps_walk_concrete[2] = SND.GetSoundByName("player/movement/walk_concrete3");
     this.steps_walk_concrete[3] = SND.GetSoundByName("player/movement/walk_concrete4");
     this.steps_run_concrete[0]  = SND.GetSoundByName("player/movement/run_concrete1");
     this.steps_run_concrete[1]  = SND.GetSoundByName("player/movement/run_concrete2");
     this.steps_run_concrete[2]  = SND.GetSoundByName("player/movement/run_concrete3");
     this.steps_run_concrete[3]  = SND.GetSoundByName("player/movement/run_concrete4");
     this.steps_walk_gravel[0]   = SND.GetSoundByName("player/movement/walk_gravel1");
     this.steps_walk_gravel[1]   = SND.GetSoundByName("player/movement/walk_gravel2");
     this.steps_walk_gravel[2]   = SND.GetSoundByName("player/movement/walk_gravel3");
     this.steps_walk_gravel[3]   = SND.GetSoundByName("player/movement/walk_gravel4");
     this.steps_run_gravel[0]    = SND.GetSoundByName("player/movement/run_gravel1");
     this.steps_run_gravel[1]    = SND.GetSoundByName("player/movement/run_gravel2");
     this.steps_run_gravel[2]    = SND.GetSoundByName("player/movement/run_gravel3");
     this.steps_run_gravel[3]    = SND.GetSoundByName("player/movement/run_gravel4");
 }
示例#2
0
 public static void Init()
 {
     foreach (KeyValuePair <int, CWeaponData> current in WeaponData.weapons)
     {
         current.Value.fire1 = SND.GetSoundByName("weapon/" + current.Value.wName.ToLower() + "_fire1");
         current.Value.icon  = TEX.GetTextureByName("weapon_" + current.Value.wName.ToLower());
         if (current.Value.icon == null)
         {
             Debug.Log("[TEX] can't load: weapon_" + current.Value.wName.ToLower());
         }
         if (current.Value.icon)
         {
             int width  = current.Value.icon.width;
             int height = current.Value.icon.height;
             current.Value.icon2_inverted = new Texture2D(width, height, TextureFormat.RGBA32, false);
             current.Value.icon2          = new Texture2D(width, height, TextureFormat.RGBA32, false);
             for (int i = 0; i < width; i++)
             {
                 for (int j = 0; j < height; j++)
                 {
                     current.Value.icon2.SetPixel(width - i, j, new Color(1f, 1f, 1f, current.Value.icon.GetPixel(i, j).a));
                     current.Value.icon2_inverted.SetPixel(i, j, new Color(1f, 1f, 1f, current.Value.icon.GetPixel(i, j).a));
                 }
             }
             current.Value.icon2.Apply(true);
             current.Value.icon2_inverted.Apply(true);
         }
     }
 }
示例#3
0
 public void PostAwake()
 {
     Zombie.tInfectedScreen = Resources.Load <Texture2D>("Textures/blood_w");
     Zombie.infectionSound  = SND.GetSoundByName("zombie_infection");
     Zombie.attackSound     = SND.GetSoundByName("zombie_attack");
     this.tGradient         = TEX.GetTextureByName("GUI/left_gradient");
     Zombie.infectedScreen  = false;
     this.OnResize();
 }
示例#4
0
 private void Start()
 {
     this.detonationSound                   = SND.GetSoundByName("flashbang");
     GrenadeFlash.asDetonation              = base.GetComponent <AudioSource>();
     GrenadeFlash.asDetonation.maxDistance  = 50f;
     GrenadeFlash.asDetonation.rolloffMode  = AudioRolloffMode.Linear;
     GrenadeFlash.asDetonation.volume       = 0.5f * Options.gamevol;
     GrenadeFlash.asDetonation.spatialBlend = 1f;
     GrenadeFlash.asDetonation.PlayOneShot(this.detonationSound);
     this.lightComp   = base.GetComponentInChildren <Light>();
     this.destroytime = Time.time + 3f;
 }
示例#5
0
 private void Start()
 {
     this.detonationSound                   = SND.GetSoundByName("smokegrenade");
     GrenadeSmoke.asDetonation              = base.GetComponent <AudioSource>();
     GrenadeSmoke.asDetonation.maxDistance  = 50f;
     GrenadeSmoke.asDetonation.rolloffMode  = AudioRolloffMode.Linear;
     GrenadeSmoke.asDetonation.volume       = 0.5f * Options.gamevol;
     GrenadeSmoke.asDetonation.spatialBlend = 1f;
     GrenadeSmoke.asDetonation.PlayOneShot(this.detonationSound);
     this.smoketime   = Time.time + 35f;
     this.destroytime = Time.time + 50f;
 }
示例#6
0
 protected override void Awake()
 {
     base.Awake();
     this.m_FPSCamera           = base.transform.root.GetComponentInChildren <vp_FPCamera>();
     this.m_OperatorTransform   = this.m_FPSCamera.transform;
     this.m_NextAllowedFireTime = Time.time;
     this.ProjectileSpawnDelay  = Mathf.Min(this.ProjectileSpawnDelay, this.ProjectileFiringRate - 0.1f);
     this.as_dryfire            = base.Parent.GetComponent <AudioSource>();
     if (this.sndSoundDryFire == null)
     {
         this.sndSoundDryFire = SND.GetSoundByName(this.SoundDryFire);
     }
 }
示例#7
0
 protected virtual void Awake()
 {
     this.m_Audio  = base.gameObject.transform.parent.GetComponent <AudioSource>();
     this.m_Player = (vp_FPPlayerEventHandler)base.transform.root.GetComponentInChildren(typeof(vp_FPPlayerEventHandler));
     if (this.sndSoundReload == null)
     {
         this.sndSoundReload = SND.GetSoundByName(this.SoundReload);
     }
     if (this.sndSoundReloadEmpty == null)
     {
         this.sndSoundReloadEmpty = SND.GetSoundByName(this.SoundReloadEmpty);
     }
 }
示例#8
0
 public void PostAwake()
 {
     C4.checkTime       = Time.realtimeSinceStartup;
     C4.trPlayer        = GameObject.Find("LocalPlayer").transform;
     C4.placeBomb       = ContentLoader_.LoadGameObject("c4_place");
     C4.plantStartSound = SND.GetSoundByName("c4_plant");
     C4.showDiffuseBar  = false;
     C4.sector          = new C4.PlantSector[2];
     C4.plant           = new List <C4.PlantSector> [2];
     C4.plant[0]        = new List <C4.PlantSector>();
     C4.plant[1]        = new List <C4.PlantSector>();
     this.csCamera      = (vp_FPCamera)UnityEngine.Object.FindObjectOfType(typeof(vp_FPCamera));
     this.csController  = (vp_FPController)UnityEngine.Object.FindObjectOfType(typeof(vp_FPController));
 }
示例#9
0
 protected override void Awake()
 {
     base.Awake();
     this.m_OperatorTransform   = base.Transform;
     this.m_CharacterController = this.m_OperatorTransform.root.GetComponentInChildren <CharacterController>();
     this.m_NextAllowedFireTime = Time.time;
     this.ProjectileSpawnDelay  = Mathf.Min(this.ProjectileSpawnDelay, this.ProjectileFiringRate - 0.1f);
     if (this.sndSoundFire == null)
     {
         this.sndSoundFire = SND.GetSoundByName(this.SoundFire);
     }
     if (this.sndSoundFire == null)
     {
         MonoBehaviour.print("[WEAPON] can't load audioclip: " + this.SoundFire);
     }
 }
示例#10
0
 public void PostAwake()
 {
     HitSound.hit[0]         = SND.GetSoundByName("player/player_hit0");
     HitSound.hit[1]         = SND.GetSoundByName("player/player_hit1");
     HitSound.hit[2]         = SND.GetSoundByName("player/player_hit2");
     HitSound.hitZombie[0]   = SND.GetSoundByName("zombie_hit01");
     HitSound.hitZombie[1]   = SND.GetSoundByName("zombie_hit02");
     HitSound.hitZombie[2]   = SND.GetSoundByName("zombie_hit03");
     HitSound.death[0]       = SND.GetSoundByName("player/player_die1");
     HitSound.death[1]       = SND.GetSoundByName("player/player_die2");
     HitSound.death[2]       = SND.GetSoundByName("player/player_die3");
     HitSound.death[3]       = SND.GetSoundByName("player/player_die4");
     HitSound.deathZombie[0] = SND.GetSoundByName("zombie_die01");
     HitSound.deathZombie[1] = SND.GetSoundByName("zombie_die02");
     HitSound.a             = base.gameObject.AddComponent <AudioSource>();
     HitSound.a.loop        = false;
     HitSound.a.playOnAwake = false;
 }
示例#11
0
 public void Init()
 {
     C4Place.detonationSound      = SND.GetSoundByName("c4_explosion");
     C4Place.detonationFarSound   = SND.GetSoundByName("FarExplosionA");
     C4Place.beepSound            = SND.GetSoundByName("c4_beep");
     C4Place.diffuseStartSound    = SND.GetSoundByName("c4_diffuse");
     C4Place.diffuseEndSound      = SND.GetSoundByName("c4_diffuse_end");
     C4Place.plantEndSound        = SND.GetSoundByName("c4_plant_end");
     C4Place.asBeep               = base.GetComponent <AudioSource>();
     C4Place.asBeep.maxDistance   = 50f;
     C4Place.asBeep.rolloffMode   = AudioRolloffMode.Linear;
     C4Place.asBeep.volume        = 0.5f * Options.gamevol;
     C4Place.asBeep.spatialBlend  = 1f;
     C4Place.asInstr              = base.GetComponent <AudioSource>();
     C4Place.asInstr.maxDistance  = 50f;
     C4Place.asInstr.rolloffMode  = AudioRolloffMode.Linear;
     C4Place.asInstr.volume       = 0.5f * Options.gamevol;
     C4Place.asInstr.spatialBlend = 1f;
 }
 private void NoDelayHitHS()
 {
     BasePlayer.go.GetComponent <AudioSource>().PlayOneShot(SND.GetSoundByName("player/enemy_headshot"));
 }
示例#13
0
 protected virtual void OnStart_Reload()
 {
     this.m_Player.Reload.AutoDuration = this.ReloadDuration;
     if (this.AnimationReload == "null")
     {
         this.StartReload   = Time.time;
         vp_FPInput.ZoomTap = false;
         return;
     }
     if (this.m_Weapon.WeaponID == 9 || this.m_Weapon.WeaponID == 16)
     {
         int ammoType = BasePlayer.currweapon.data.ammoType;
         if (BasePlayer.currweapon.data.maxClip - BasePlayer.currweapon.clip == 1 || BasePlayer.ammo[ammoType] == 1)
         {
             if (this.currAnimation == "ReloadStart" || this.currAnimation == "ReloadLoop")
             {
                 this.currAnimation  = "ReloadEnd";
                 this.ReloadDuration = this.m_Weapon.WeaponCoreModel.GetComponent <Animation>().GetClip(this.currAnimation).length - 0.1f;
                 this.m_Player.Reload.AutoDuration = this.ReloadDuration;
                 this.m_Weapon.WeaponCoreModel.GetComponent <Animation>().Stop("ReloadEnd");
                 this.m_Weapon.WeaponCoreModel.GetComponent <Animation>().Play("ReloadEnd");
             }
             else
             {
                 this.currAnimation  = "ReloadOne";
                 this.ReloadDuration = this.m_Weapon.WeaponCoreModel.GetComponent <Animation>().GetClip(this.currAnimation).length - 0.1f;
                 this.m_Player.Reload.AutoDuration = this.ReloadDuration;
                 this.m_Weapon.WeaponCoreModel.GetComponent <Animation>().Stop("ReloadOne");
                 this.m_Weapon.WeaponCoreModel.GetComponent <Animation>().Play("ReloadOne");
             }
         }
         else if (this.currAnimation == "Idle" || this.currAnimation == "ReloadEnd" || this.currAnimation == "ReloadOne")
         {
             this.currAnimation  = "ReloadStart";
             this.ReloadDuration = this.m_Weapon.WeaponCoreModel.GetComponent <Animation>().GetClip(this.currAnimation).length - 0.1f;
             this.m_Player.Reload.AutoDuration = this.ReloadDuration;
             this.m_Weapon.WeaponCoreModel.GetComponent <Animation>().Stop("ReloadStart");
             this.m_Weapon.WeaponCoreModel.GetComponent <Animation>().Play("ReloadStart");
         }
         else
         {
             this.currAnimation  = "ReloadLoop";
             this.ReloadDuration = this.m_Weapon.WeaponCoreModel.GetComponent <Animation>().GetClip(this.currAnimation).length - 0.1f;
             this.m_Player.Reload.AutoDuration = this.ReloadDuration;
             this.m_Weapon.WeaponCoreModel.GetComponent <Animation>().Stop("ReloadLoop");
             this.m_Weapon.WeaponCoreModel.GetComponent <Animation>().Play("ReloadLoop");
         }
         this.m_Audio.pitch = 1f;
         this.m_Audio.PlayOneShot(SND.GetSoundByName("bullet_insert"));
         this.StartReload   = Time.time;
         vp_FPInput.ZoomTap = false;
         return;
     }
     if (this.m_Weapon.WeaponID == 24 || this.m_Weapon.WeaponID == 25)
     {
         this.AnimationReloadEmpty = "null";
     }
     if (BasePlayer.currweapon.clip == 0 && this.AnimationReloadEmpty != "null")
     {
         this.ReloadDuration = this.m_Weapon.WeaponCoreModel.GetComponent <Animation>().GetClip(this.AnimationReloadEmpty).length - 0.1f;
         this.m_Player.Reload.AutoDuration = this.ReloadDuration;
         this.m_Weapon.WeaponCoreModel.GetComponent <Animation>().Stop(this.AnimationReloadEmpty);
         this.m_Weapon.WeaponCoreModel.GetComponent <Animation>().Play(this.AnimationReloadEmpty);
     }
     else
     {
         this.ReloadDuration = this.m_Weapon.WeaponCoreModel.GetComponent <Animation>().GetClip(this.AnimationReload).length - 0.1f;
         this.m_Player.Reload.AutoDuration = this.ReloadDuration;
         this.m_Weapon.WeaponCoreModel.GetComponent <Animation>().Stop(this.AnimationReload);
         this.m_Weapon.WeaponCoreModel.GetComponent <Animation>().Play(this.AnimationReload);
     }
     if (this.m_Audio != null)
     {
         this.m_Audio.pitch = 1f;
         if (BasePlayer.currweapon.clip == 0)
         {
             this.m_Audio.PlayOneShot(this.sndSoundReloadEmpty);
         }
         else
         {
             this.m_Audio.PlayOneShot(this.sndSoundReload);
         }
     }
     this.StartReload   = Time.time;
     vp_FPInput.ZoomTap = false;
 }
示例#14
0
 private void Start()
 {
     CutoffFX.asDetonation = base.GetComponent <AudioSource>();
     CutoffFX.fxSound      = SND.GetSoundByName("flashbang_fx");
     CutoffFX.phaseStep    = 4;
 }