Exemplo n.º 1
0
        public static NwWaypoint?Deserialize(byte[] serialized)
        {
            CNWSWaypoint?waypoint = null;
            bool         result   = NativeUtils.DeserializeGff(serialized, (resGff, resStruct) =>
            {
                if (!resGff.IsValidGff("UTW"))
                {
                    return(false);
                }

                waypoint = new CNWSWaypoint(Invalid);
                if (waypoint.LoadWaypoint(resGff, resStruct, null).ToBool())
                {
                    waypoint.LoadObjectState(resGff, resStruct);
                    waypoint.m_oidArea = Invalid;
                    GC.SuppressFinalize(waypoint);
                    return(true);
                }

                waypoint.Dispose();
                return(false);
            });

            return(result && waypoint != null?waypoint.ToNwObject <NwWaypoint>() : null);
        }
Exemplo n.º 2
0
        internal static NwObject?CreateInternal(ICGameObject?gameObject)
        {
            if (gameObject == null)
            {
                return(null);
            }

            return(gameObject switch
            {
                CNWSArea area => new NwArea(area),
                CNWSAreaOfEffectObject areaOfEffect => new NwAreaOfEffect(areaOfEffect),
                CNWSCreature creature => new NwCreature(creature),
                CNWSDoor door => new NwDoor(door),
                CNWSEncounter encounter => new NwEncounter(encounter),
                CNWSItem item => new NwItem(item),
                CNWSPlaceable placeable => new NwPlaceable(placeable),
                CNWSSoundObject soundObject => new NwSound(soundObject),
                CNWSStore store => new NwStore(store),
                CNWSTrigger trigger => new NwTrigger(trigger),
                CNWSWaypoint waypoint => new NwWaypoint(waypoint),
                CNWSObject => CreateFromVirtualType(gameObject),
                CGameObject => CreateFromVirtualType(gameObject),
                CNWSModule => NwModule.Instance,
                _ => null,
            });
Exemplo n.º 3
0
 internal NwWaypoint(CNWSWaypoint waypoint) : base(waypoint)
 {
     Waypoint = waypoint;
 }