Beispiel #1
0
        void Start()
        {
            usable   = true;
            pickable = false;
            doorData = new DoorData();
            doorData.closedRotation = transform.rotation;
            doorData.openRotation   = doorData.closedRotation * Quaternion.Euler(Vector3.up * 90f);
            doorData.moving         = false;
            var DOOR = record as DOORRecord;

            if (DOOR.FNAM != null)
            {
                doorData.doorName = DOOR.FNAM.value;
            }
            doorData.leadsToAnotherCell  = refObjDataGroup.DNAM != null || refObjDataGroup.DODT != null;
            doorData.leadsToInteriorCell = refObjDataGroup.DNAM != null;
            if (doorData.leadsToInteriorCell)
            {
                doorData.doorExitName = refObjDataGroup.DNAM.value;
            }
            if (doorData.leadsToAnotherCell && !doorData.leadsToInteriorCell)
            {
                var doorExitCell = TesEngine.instance._data.FindExteriorCellRecord(TesEngine.instance._cellManager.GetExteriorCellIndices(doorData.doorExitPos));
                doorData.doorExitName = doorExitCell != null ? (doorExitCell.RGNN?.value ?? "Unknown Region") : doorData.doorName;
            }
            if (refObjDataGroup.DODT != null)
            {
                doorData.doorExitPos         = NifUtils.NifPointToUnityPoint(refObjDataGroup.DODT.position);
                doorData.doorExitOrientation = NifUtils.NifEulerAnglesToUnityQuaternion(refObjDataGroup.DODT.eulerAngles);
            }
            objData.name = doorData.leadsToAnotherCell ? doorData.doorExitName : "Use " + doorData.doorName;
        }
Beispiel #2
0
        void Start()
        {
            usable   = true;
            pickable = false;
            doorData = new DoorData {
                closedRotation = transform.rotation
            };
            doorData.openRotation = doorData.closedRotation * Quaternion.Euler(Vector3.up * 90f);
            doorData.moving       = false;
            var DOOR = record as DOORRecord;

            if (DOOR.FULL.Value != null)
            {
                doorData.doorName = DOOR.FULL.Value;
            }
            doorData.leadsToAnotherCell  = refObjDataGroup.DNAM.Value != null || refObjDataGroup.DODT != null;
            doorData.leadsToInteriorCell = refObjDataGroup.DNAM.Value != null;
            if (doorData.leadsToInteriorCell)
            {
                doorData.doorExitName = refObjDataGroup.DNAM.Value;
            }
            if (doorData.leadsToAnotherCell && !doorData.leadsToInteriorCell)
            {
                var doorExitCell = BaseEngine.Instance.Data.FindCellRecord(BaseEngine.Instance.CellManager.GetCellId(doorData.doorExitPos, 0));
                doorData.doorExitName = doorExitCell != null ? (((CELLRecord)doorExitCell).FULL.Value ?? "Unknown Region") : doorData.doorName;
            }
            if (refObjDataGroup.DODT != null)
            {
                doorData.doorExitPos         = NifUtils.NifPointToUnityPoint(refObjDataGroup.DODT.Value.Position.ToVector3());
                doorData.doorExitOrientation = NifUtils.NifEulerAnglesToUnityQuaternion(refObjDataGroup.DODT.Value.EulerAngles.ToVector3());
            }
            objData.name = doorData.leadsToAnotherCell ? doorData.doorExitName : "Use " + doorData.doorName;
        }
Beispiel #3
0
        /// <summary>
        /// Finishes initializing an instantiated cell object.
        /// </summary>
        void PostProcessInstantiatedCellObject(GameObject gameObject, RefCellObjInfo refCellObjInfo)
        {
            var refObj = (CELLRecord.RefObj)refCellObjInfo.RefObj;

            // Handle object transforms.
            if (refObj.XSCL != null)
            {
                gameObject.transform.localScale = Vector3.one * refObj.XSCL.Value.Value;
            }
            gameObject.transform.position += NifUtils.NifPointToUnityPoint(refObj.DATA.Position.ToVector3());
            gameObject.transform.rotation *= NifUtils.NifEulerAnglesToUnityQuaternion(refObj.DATA.EulerAngles.ToVector3());
            var tagTarget = gameObject;
            var coll      = gameObject.GetComponentInChildren <Collider>(); // if the collider is on a child object and not on the object with the component, we need to set that object's tag instead.

            if (coll != null)
            {
                tagTarget = coll.gameObject;
            }
            ProcessObjectType <DOORRecord>(tagTarget, refCellObjInfo, "Door");
            ProcessObjectType <ACTIRecord>(tagTarget, refCellObjInfo, "Activator");
            ProcessObjectType <CONTRecord>(tagTarget, refCellObjInfo, "Container");
            ProcessObjectType <LIGHRecord>(tagTarget, refCellObjInfo, "Light");
            ProcessObjectType <LOCKRecord>(tagTarget, refCellObjInfo, "Lock");
            ProcessObjectType <PROBRecord>(tagTarget, refCellObjInfo, "Probe");
            ProcessObjectType <REPARecord>(tagTarget, refCellObjInfo, "RepairTool");
            ProcessObjectType <WEAPRecord>(tagTarget, refCellObjInfo, "Weapon");
            ProcessObjectType <CLOTRecord>(tagTarget, refCellObjInfo, "Clothing");
            ProcessObjectType <ARMORecord>(tagTarget, refCellObjInfo, "Armor");
            ProcessObjectType <INGRRecord>(tagTarget, refCellObjInfo, "Ingredient");
            ProcessObjectType <ALCHRecord>(tagTarget, refCellObjInfo, "Alchemical");
            ProcessObjectType <APPARecord>(tagTarget, refCellObjInfo, "Apparatus");
            ProcessObjectType <BOOKRecord>(tagTarget, refCellObjInfo, "Book");
            ProcessObjectType <MISCRecord>(tagTarget, refCellObjInfo, "MiscObj");
            ProcessObjectType <CREARecord>(tagTarget, refCellObjInfo, "Creature");
            ProcessObjectType <NPC_Record>(tagTarget, refCellObjInfo, "NPC");
        }