예제 #1
0
        /// <summary>
        /// Reads the object from NBT and sets it's state.
        /// </summary>
        public virtual void readFromNbt(NbtCompound tag)
        {
            // Don't read id from NBT.

            this.transform.position    = tag.getVector3("position");
            this.transform.eulerAngles = tag.getVector3("eulerRotation");
            this.transform.localScale  = tag.getVector3("localScale", Vector3.one);
            this.immutable             = tag.getBool("isImmutable");
            this.guid = new Guid(tag.getString("guid"));
        }
예제 #2
0
    public void readFromNbt(NbtCompound tag)
    {
        NbtList tagList = tag.getList("entries");

        foreach (NbtCompound compound in tagList)
        {
            this.entires.Add(new Entry(compound));
        }

        this.isPrimary        = tag.getBool("isPrimary");
        this.constructionTime = tag.getFloat("constructionTime");
    }
예제 #3
0
        public override void readFromNbt(NbtCompound tag)
        {
            base.readFromNbt(tag);

            this.lastPos   = tag.getVector3("lastPos");
            this.unitStats = new UnitStats(tag, this.getData());

            bool flag = tag.getBool("hasMovementOverride");

            if (flag)
            {
                this.overrideMovementDestination = tag.getVector3("overrideMovementDestination");
                this.overrideMovementStopDis     = tag.getFloat("overrideMovementStopDis");
            }
        }
예제 #4
0
    public override void readFromNbt(NbtCompound tag)
    {
        base.readFromNbt(tag);

        this.energy.value      = tag.getFloat("energy");
        this.hunger.value      = tag.getFloat("hunger");
        this.temperature.value = tag.getFloat("temperature");
        this.happiness.value   = tag.getFloat("happiness");
        this.isDead            = tag.getBool("isDead");
        this.info = new WorkerInfo(tag.getCompound("workerInfo"));
        this.setType(Main.instance.workerTypeRegistry.getElement(tag.getInt("workerType")));

        // Read Ai Meta objects from NBT
        foreach (IAiMeta meta in this.GetComponentsInChildren <IAiMeta>())
        {
            meta.readFromNbt(tag);
        }
    }
예제 #5
0
    public override void readFromNbt(NbtCompound tag)
    {
        base.readFromNbt(tag);

        this.lastPos   = tag.getVector3("lastPos");
        this.unitStats = new UnitStats(tag, this.unitData);

        bool flag = tag.getBool("hasMovementOverride");

        if (flag)
        {
            this.overrideMovementDestination = tag.getVector3("overrideMovementDestination");
            this.overrideMovementStopDis     = tag.getFloat("overrideMovementStopDis");
            this.moveHelper.setDestination((Vector3)this.overrideMovementDestination, this.overrideMovementStopDis);
        }

        NbtCompound tagTask = tag.getCompound("task");
        ITask       task    = (ITask)Activator.CreateInstance(TaskManager.getTaskFromId(tagTask.getInt("taskID")), new object[] { (UnitBase)this });

        task.readFromNbt(tagTask);
        this.setTask(task, true);
    }
예제 #6
0
 public void readFromNbt(NbtCompound tag)
 {
     this.isFlipped = tag.getBool("isSwitchCurved");
 }
예제 #7
0
 public Entry(NbtCompound tag)
 {
     this.cell             = Main.instance.tileRegistry.getElement(tag.getInt("cellId"));
     this.position         = new Position(tag.getVector3Int("offset"));
     this.addFogOnComplete = tag.getBool("addFog");
 }
예제 #8
0
 public void readFromNbt(NbtCompound tag)
 {
     this.unlocked = tag.getBool("unlocked");
 }
예제 #9
0
 public void readFromNbt(NbtCompound tag)
 {
     this.isTripped = tag.getBool("isTripped");
     //this.tripTimer = tag.getFloat("tripTimer");
 }
예제 #10
0
 public void readFromNbt(NbtCompound tag)
 {
     this.isOn = tag.getBool("isLeverOn");
 }