Пример #1
0
 // Token: 0x06001A9B RID: 6811 RVA: 0x0008B208 File Offset: 0x00089408
 private void ConfigureAvatar(GameActorInfo info, CharacterConfig character, bool isLocal)
 {
     if (character != null && info != null)
     {
         if (isLocal)
         {
             this.Player.SetCurrentCharacterConfig(character);
             this.Player.MoveController.IsLowGravity = GameFlags.IsFlagSet(GameFlags.GAME_FLAGS.LowGravity, this.RoomData.GameFlags);
             character.Initialize(this.PlayerData, this.Avatar);
         }
         else
         {
             global::Avatar avatar = new global::Avatar(new Loadout(info.Gear, info.Weapons), false);
             avatar.SetDecorator(global::AvatarBuilder.CreateRemoteAvatar(avatar.Loadout.GetAvatarGear(), info.SkinColor));
             character.Initialize(this.RemotePlayerStates.GetState(info.PlayerId), avatar);
             GameData.Instance.OnHUDStreamMessage.Fire(info, LocalizedStrings.JoinedTheGame, null);
         }
         if (!info.IsAlive)
         {
             character.SetDead(Vector3.zero, BodyPart.Body, 0, UberstrikeItemClass.WeaponMachinegun);
         }
     }
     else
     {
         Debug.LogError(string.Format("OnAvatarLoaded failed because loaded Avatar is {0} and Info is {1}", character != null, info != null));
     }
 }
Пример #2
0
    // Token: 0x06001F7B RID: 8059 RVA: 0x000970A4 File Offset: 0x000952A4
    public bool Shoot()
    {
        bool result = false;

        if (this.IsWeaponReady)
        {
            if (this.CheckAmmoCount())
            {
                this._currentSlot.InputHandler.FireHandler.RegisterShot();
                if (!GameFlags.IsFlagSet(GameFlags.GAME_FLAGS.QuickSwitch, GameState.Current.RoomData.GameFlags))
                {
                    this._holsterTime = WeaponConfigurationHelper.GetRateOfFire(this._currentSlot.View);
                }
                Ray ray = new Ray(GameState.Current.PlayerData.ShootingPoint + GameState.Current.Player.EyePosition, GameState.Current.PlayerData.ShootingDirection);
                CmunePairList <BaseGameProp, ShotPoint> cmunePairList;
                this._currentSlot.Logic.Shoot(ray, out cmunePairList);
                if (!this._currentSlot.Decorator.HasShootAnimation)
                {
                    WeaponFeedbackManager.Instance.Fire();
                }
                AmmoDepot.UseAmmoOfClass(this._currentSlot.View.ItemClass, this._currentSlot.Logic.AmmoCountPerShot);
                GameState.Current.PlayerData.WeaponFired.Value = this._currentSlot;
                result = true;
            }
            else
            {
                this._currentSlot.Decorator.PlayOutOfAmmoSound();
                GameData.Instance.OnNotificationFull.Fire(string.Empty, "Out of ammo!", 1f);
            }
        }
        return(result);
    }
Пример #3
0
    /// <summary>
    /// Returns whether the given event passes the flag check based on given set flags.
    /// </summary>
    /// <param name="eventArg"></param>
    /// <param name="gameFlagsArg"></param>
    /// <returns></returns>
    private bool HaveRequiredFlags(HavenLocationEvent eventArg, GameFlags gameFlagsArg)
    {
        // if given event does NOT require flags
        if (!eventArg.RequiresFlag())
        {
            // return that passed flag check
            return(true);
        }

        // loop through all given events needed flags
        foreach (string iterFlag in eventArg.GetAppropriateRequiredFlags(gameFlagsArg))
        {
            // if given flags do NOT have the iterating needed flag
            if (!gameFlagsArg.IsFlagSet(iterFlag))
            {
                // return that did NOT pass flag check
                return(false);
            }
        }

        // return that passed flag check
        return(true);
    }