Пример #1
0
        public override void Init(BasePlayer player, Vector2 spawnPos)
        {
            Player   = player;
            Position = spawnPos;

            IsAlive       = true;
            Health        = 0;
            Armor         = 0;
            EmoteStopTick = -1;
            Emote         = Emote.Normal;

            Core                      = Kernel.Get <BaseCharacterCore>();
            SendCore                  = Kernel.Get <BaseCharacterCore>();
            ReckoningCore             = Kernel.Get <BaseCharacterCore>();
            ReckoningCore.IsPredicted = true;

            Core.Reset();
            Core.Init(GameWorld.WorldCore, GameContext.MapCollision);
            Core.Position = Position;

            var worldCore = new WorldCore(
                GameWorld.WorldCore.CharacterCores.Length,
                Kernel.Get <BaseTuningParams>());

            ReckoningCore.Init(worldCore, GameContext.MapCollision);

            GameContext.CreatePlayerSpawn(spawnPos);
            GameWorld.WorldCore.CharacterCores[player.ClientId] = Core;

            Input           = new SnapshotPlayerInput();
            LatestPrevInput = new SnapshotPlayerInput();
            LatestInput     = new SnapshotPlayerInput();
            LastAction      = -1;

            HitObjects = new List <Entity>();
            NinjaStat  = new NinjaStat();

            ActiveWeapon = Weapon.Hammer;
            LastWeapon   = Weapon.Gun;
            QueuedWeapon = (Weapon)(-1);
            Weapons      = new WeaponStat[(int)Weapon.NumWeapons];
            Weapons[(int)Weapon.Hammer].Got  = true;
            Weapons[(int)Weapon.Hammer].Ammo = -1;

            Destroyed += OnDestroyed;
            Reseted   += OnReseted;
        }
Пример #2
0
        public Character(BasePlayer player, Vector2 spawnPos) : base(1)
        {
            HitObjects = new List <Entity>();
            Weapons    = new WeaponStat[(int)Weapon.NUM_WEAPONS];
            NinjaStat  = new NinjaStat();

            ActiveWeapon = Weapon.GUN;
            LastWeapon   = Weapon.HAMMER;
            QueuedWeapon = (Weapon)(-1);

            Position      = spawnPos;
            Health        = 0;
            Armor         = 0;
            EmoteStopTick = -1;
            LastAction    = -1;
            Player        = player;
            IsAlive       = true;

            Input           = new SnapObj_PlayerInput();
            LatestPrevInput = new SnapObj_PlayerInput();
            LatestInput     = new SnapObj_PlayerInput();

            Core          = new CharacterCore();
            SendCore      = new CharacterCore();
            ReckoningCore = new CharacterCore();

            Core.Reset();
            Core.Init(GameWorld.WorldCore, GameContext.Collision);
            Core.Position = Position;

            var worldCore = new WorldCore(
                GameWorld.WorldCore.CharacterCores.Length,
                GameWorld.WorldCore.Tuning);

            ReckoningCore.Init(worldCore, GameContext.Collision);

            GameWorld.WorldCore.CharacterCores[player.ClientId] = Core;
            GameContext.GameController.OnCharacterSpawn(this);
        }