예제 #1
0
        public override void ReplaceWith(GameObject newObj)
        {
            ushort      seat     = _seatIndex;
            BipedObject newBiped = newObj as BipedObject;

            if (newBiped != null)
            {
                newBiped._currentVehicleId    = _currentVehicleId;
                newBiped._controlledVehicleId = _controlledVehicleId;
            }

            base.ReplaceWith(newObj);

            newBiped._seatIndex = seat;
        }
예제 #2
0
        private bool ProcessObjectEntry(SaveIO.SaveReader reader, bool active, uint datumIndex, ushort flags, uint size, long offset)
        {
            if (!active)
            {
                _objects.Add(null);
                return(true);
            }

            // Read the object entry
            ObjectEntry entry = new ObjectEntry(_objectChunk, reader, datumIndex, flags, offset);

            // Seek to the start of the object data
            reader.Seek(_objectPoolStart + entry.PoolOffset, SeekOrigin.Begin);

            // Process it based on object class
            GameObject obj;

            switch (entry.TagGroup)
            {
            case TagGroup.Bipd:
                obj = new BipedObject(reader, entry);
                break;

            case TagGroup.Vehi:
                obj = new VehicleObject(reader, entry);
                break;

            case TagGroup.Weap:
                obj = new WeaponObject(reader, entry);
                break;

            case TagGroup.Eqip:
                obj = new EquipmentObject(reader, entry);
                break;

            default:
                obj = new GameObject(reader, entry);
                break;
            }
            _objects.Add(obj);

            if (obj.Next == null)
            {
                _lastPoolObject = obj;
            }

            return(true);
        }
예제 #3
0
        /// <summary>
        /// Helper function for changing the player's biped.
        /// </summary>
        /// <param name="newBiped">The new biped to use.</param>
        public void ChangeBiped(BipedObject newBiped, bool transferWeapons)
        {
            if (newBiped != _biped && newBiped != null && !newBiped.Deleted)
            {
                if (transferWeapons)
                {
                    if (newBiped.ArmorAbility != null)
                    {
                        newBiped.ArmorAbility.Drop();
                    }

                    _biped.TransferWeapons(newBiped);
                    newBiped.ArmorAbility   = _biped.ArmorAbility;
                    newBiped.FragGrenades   = _biped.FragGrenades;
                    newBiped.PlasmaGrenades = _biped.PlasmaGrenades;
                }
                _biped.ReplaceWith(newBiped);
                _biped.Delete(true);
                _biped         = newBiped;
                newBiped.Actor = null;
            }
        }