//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;
     }
 }
Exemple #3
0
    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++;
     }
 }
Exemple #5
0
 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
 }
Exemple #6
0
    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;
    }
Exemple #7
0
 /// This binding will add or remove views based on an element/viewmodel collection.
 public virtual ViewBase CreateWeaponsView(FPSWeaponViewModel item)
 {
     return(this.InstantiateView(item));
 }
Exemple #8
0
 public abstract void InitializeFPSWeapon(FPSWeaponViewModel fPSWeapon);
Exemple #9
0
 public virtual void FinishedReloading(FPSWeaponViewModel fPSWeapon)
 {
 }
Exemple #10
0
 public override void PickupWeapon(FPSPlayerViewModel fPsPlayer, FPSWeaponViewModel fpsWeaponViewModel)
 {
     fPsPlayer.Weapons.Add(fpsWeaponViewModel);
 }
Exemple #11
0
 public virtual void Reload(FPSWeaponViewModel fPSWeapon)
 {
 }
Exemple #12
0
 public virtual void BulletFired(FPSWeaponViewModel fPSWeapon)
 {
 }
Exemple #13
0
 public virtual void NextZoom(FPSWeaponViewModel fPSWeapon)
 {
 }
Exemple #14
0
 public virtual void EndFire(FPSWeaponViewModel fPSWeapon)
 {
 }
Exemple #15
0
 public virtual void ExecutePickupWeapon(FPSWeaponViewModel fPSWeapon)
 {
     this.ExecuteCommand(FPSPlayer.PickupWeapon, fPSWeapon);
 }
Exemple #16
0
 /// Subscribes to the property and is notified anytime the value changes.
 public virtual void CurrentWeaponChanged(FPSWeaponViewModel value)
 {
 }
Exemple #17
0
 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;
 }
Exemple #21
0
 public virtual void BeginFire(FPSWeaponViewModel fPSWeapon)
 {
 }