//private void Reloading(FPSWeaponViewModel fpsWeapon, State state) //{ // if (state is Reloading && fpsWeapon.Magazine.Count > 0) // { // Debug.Log("fdfdfdfdfdfdfdfd"); // fpsWeapon.Ammo = fpsWeapon.Magazine[0].Amount; // ExecuteCommand(fpsWeapon.FinishedReloading); // fpsWeapon.Magazine.RemoveAt(0); // } //} //public override void AddMagazine(FPSWeaponViewModel fPSWeapon) //{ // base.AddMagazine(fPSWeapon); // //oo = fPSWeapon.ParentFPSPlayer; // //oo.CollectedMag++; //} public override void InitializeFPSWeapon(FPSWeaponViewModel fpsWeapon) { //var enemy = FPSEnemyController.CreateFPSEnemy(); //enemy.Identifier = Guid.NewGuid().ToString(); //enemy.HealthStateProperty.Where(p => p == FPSPlayerState.Dead) // .Subscribe(p => EnemyDied(enemy)).DisposeWith(enemy); //FPSGame.Enemies.Add(enemy); //fpsWeapon.StateProperty.Subscribe(state => Reloading(fpsWeapon, state)); //fpsWeapon.StateProperty // .Where(p => p is Reloading && fpsWeapon.Magazine.Count > 0) // Subscribe only to when the state is changed to reloading // .Subscribe(r => // { // // When we've entered the reloading state create a timer that moves it to finished reloading // Observable.Timer(TimeSpan.FromSeconds(fpsWeapon.ReloadTime)) // .Subscribe(l => // { // Debug.Log("dsdsdsdsdsd"); // fpsWeapon.Ammo = fpsWeapon.Magazine[0].Amount; // //fpsWeapon.RoundSize; // ExecuteCommand(fpsWeapon.FinishedReloading); // fpsWeapon.Magazine.RemoveAt(0); // }); // }).DisposeWith(fpsWeapon); // Make sure this is disposed with the weapon //ExecuteCommand(fpsWeapon.FinishedReloading); }
/// Subscribes to the property and is notified anytime the value changes. public override void CurrentWeaponChanged(FPSWeaponViewModel value) { base.CurrentWeaponChanged(value); if (value != null) { _WeaponHudView.ViewModelObject = value; } }
public override ViewBase CreateWeaponsView(FPSWeaponViewModel fPSWeapon) { var prefabName = fPSWeapon.WeaponType.ToString() + "Weapon"; var weapon = InstantiateView(prefabName, fPSWeapon); weapon.transform.parent = _WeaponsContainer; weapon.transform.localEulerAngles = new Vector3(0f, 0f, 0f); weapon.transform.localPosition = new Vector3(0f, 0f, 0f); weapon.InitializeData(fPSWeapon); return(weapon); }
public override void NextZoom(FPSWeaponViewModel fpsWeapon) { if (fpsWeapon.MaxZooms - 1 == fpsWeapon.ZoomIndex) { fpsWeapon.ZoomIndex = 0; } else { fpsWeapon.ZoomIndex++; } }
public override void InitializeFPSWeapon(FPSWeaponViewModel fpsWeapon) { fpsWeapon.StateProperty .Where(p => p is Reloading) // Subscribe only to when the state is changed to reloading .Subscribe(r => { // When we've entered the reloading state create a timer that moves it to finished reloading Observable.Timer(TimeSpan.FromSeconds(fpsWeapon.ReloadTime)) .Subscribe(l => { fpsWeapon.Ammo = fpsWeapon.RoundSize; ExecuteCommand(fpsWeapon.FinishedReloading); }); }).DisposeWith(fpsWeapon); // Make sure this is disposed with the weapon }
protected override void InitializeViewModel(ViewModel viewModel) { FPSWeaponViewModel fPSWeapon = ((FPSWeaponViewModel)(viewModel)); fPSWeapon.ZoomIndex = this._ZoomIndex; fPSWeapon.MaxZooms = this._MaxZooms; fPSWeapon.WeaponType = this._WeaponType; fPSWeapon.ReloadTime = this._ReloadTime; fPSWeapon.RoundSize = this._RoundSize; fPSWeapon.MinSpread = this._MinSpread; fPSWeapon.BurstSize = this._BurstSize; fPSWeapon.RecoilSpeed = this._RecoilSpeed; fPSWeapon.FireSpeed = this._FireSpeed; fPSWeapon.BurstSpeed = this._BurstSpeed; fPSWeapon.SpreadMultiplier = this._SpreadMultiplier; fPSWeapon.Ammo = this._Ammo; }
/// This binding will add or remove views based on an element/viewmodel collection. public virtual ViewBase CreateWeaponsView(FPSWeaponViewModel item) { return(this.InstantiateView(item)); }
public abstract void InitializeFPSWeapon(FPSWeaponViewModel fPSWeapon);
public virtual void FinishedReloading(FPSWeaponViewModel fPSWeapon) { }
public override void PickupWeapon(FPSPlayerViewModel fPsPlayer, FPSWeaponViewModel fpsWeaponViewModel) { fPsPlayer.Weapons.Add(fpsWeaponViewModel); }
public virtual void Reload(FPSWeaponViewModel fPSWeapon) { }
public virtual void BulletFired(FPSWeaponViewModel fPSWeapon) { }
public virtual void NextZoom(FPSWeaponViewModel fPSWeapon) { }
public virtual void EndFire(FPSWeaponViewModel fPSWeapon) { }
public virtual void ExecutePickupWeapon(FPSWeaponViewModel fPSWeapon) { this.ExecuteCommand(FPSPlayer.PickupWeapon, fPSWeapon); }
/// Subscribes to the property and is notified anytime the value changes. public virtual void CurrentWeaponChanged(FPSWeaponViewModel value) { }
public virtual void PickupWeapon(FPSPlayerViewModel fPSPlayer, FPSWeaponViewModel arg) { }
public virtual void AddMagazine(FPSWeaponViewModel fPSWeapon) { }
public override ViewBase CreateWeaponsView(FPSWeaponViewModel fPSWeapon) { return(null); }
public override void BulletFired(FPSWeaponViewModel fPSWeapon) { base.BulletFired(fPSWeapon); fPSWeapon.Ammo -= 1; }
public virtual void BeginFire(FPSWeaponViewModel fPSWeapon) { }