示例#1
0
    //serialization constructor
    protected SavedState(SerializationInfo info, StreamingContext context)
    {
        //this.position = (SerVector3)info.GetValue("position",typeof(SerVector3));
        this.localPosition = (SerVector3)info.GetValue("localPosition", typeof(SerVector3));
        //this.rotation = (SerQuaternion)info.GetValue("rotation",typeof(SerQuaternion));
        this.localRotation = (SerQuaternion)info.GetValue("localRotation", typeof(SerQuaternion));

        emittingParticles = info.GetBoolean("emittingParticles");
        isActive          = info.GetBoolean("isActive");
    }
示例#2
0
    public static Vector3 SerVector3ToVector3(SerVector3 sv3)
    {
        Vector3 v3 = new Vector3
        {
            x = sv3.x,
            y = sv3.y,
            z = sv3.z
        };

        return(v3);
    }
示例#3
0
    //public static SerGameItem GameItemToSerGameItem(GameItem item)
    //{

    //}

    public static SerVector3 Vector3ToSerVector3(Vector3 v3)
    {
        SerVector3 sv3 = new SerVector3
        {
            x = v3.x,
            y = v3.y,
            z = v3.z
        };

        return(sv3);
    }
示例#4
0
    //serialization constructor
    protected SavedState(SerializationInfo info,StreamingContext context)
    {
        try {
            this.position = (SerVector3)info.GetValue("position",typeof(SerVector3));
            this.rotation = (SerQuaternion)info.GetValue("rotation",typeof(SerQuaternion));
        } catch {
            //not available if used an older version to save the replay, ignore
        }
        this.localPosition = (SerVector3)info.GetValue("localPosition",typeof(SerVector3));
        this.localRotation = (SerQuaternion)info.GetValue("localRotation",typeof(SerQuaternion));

        emittingParticles = info.GetBoolean("emittingParticles");
        isActive = info.GetBoolean("isActive");
    }
示例#5
0
    public bool isDifferentTo(SerVector3 other)
    {
        bool changed = false;

        if (!changed && x != other.x )
            changed = true;

        if (!changed && y != other.y )
            changed = true;

        if (!changed && z != other.z )
            changed = true;

        return changed;
    }
示例#6
0
    //as this is not derived from MonoBehaviour, we have a constructor
    public SavedState(GameObject go)
    {
        if (go != null) {
            if(go.GetComponent<ParticleEmitter>())
                emittingParticles = go.GetComponent<ParticleEmitter>().emit;

            this.position = new SerVector3(go.transform.position);
            this.rotation = new SerQuaternion(go.transform.rotation);
            this.localPosition = new SerVector3(go.transform.localPosition);
            this.localRotation = new SerQuaternion(go.transform.localRotation);
            this.isActive = go.activeInHierarchy;
        } else {
            this.position = new SerVector3(Vector3.zero);
            this.rotation = new SerQuaternion(Quaternion.identity);
            this.localPosition = new SerVector3(Vector3.zero);
            this.localRotation = new SerQuaternion(Quaternion.identity);
            this.isActive = false;
        }
    }
示例#7
0
    //as this is not derived from MonoBehaviour, we have a constructor
    public SavedState(GameObject go)
    {
        if (go != null) {
            if(go.GetComponent<ParticleEmitter>())
                emittingParticles = go.GetComponent<ParticleEmitter>().emit;

            //this.position = new SerVector3(go.transform.position);
            //this.rotation = new SerQuaternion(go.transform.rotation);
            this.localPosition = new SerVector3(go.transform.localPosition);
            this.localRotation = new SerQuaternion(go.transform.localRotation);
            this.isActive = go.activeInHierarchy;

            /**************************************************************
             *  New Addition
             **************************************************************/

            //only for main camera
            if (go.tag == "MainCamera" /*&& go.transform.parent == null*/)
            {

                this.isMainCameraChild = go.GetComponent<PlaybackCamera>().isMainCameraChild;

                if (this.isMainCameraChild)
                {
                    this.tag = go.transform.parent.tag;
                }

                PlaybackDialogue diaggy = go.GetComponent<PlaybackDialogue> ();
                this.convoTitle = diaggy.convoTitle;
                this.dialogueNum = diaggy.dialogueNum;
                this.dialogueType = diaggy.dialogueType;
            }

            //**************************************************************

        } else {
            //this.position = new SerVector3(Vector3.zero);
            //this.rotation = new SerQuaternion(Quaternion.identity);
            this.localPosition = new SerVector3(Vector3.zero);
            this.localRotation = new SerQuaternion(Quaternion.identity);
            this.isActive = false;
        }
    }
示例#8
0
    public bool isDifferentTo(SerVector3 other)
    {
        bool changed = false;

        if (!changed && x != other.x)
        {
            changed = true;
        }

        if (!changed && y != other.y)
        {
            changed = true;
        }

        if (!changed && z != other.z)
        {
            changed = true;
        }

        return(changed);
    }
示例#9
0
    //as this is not derived from MonoBehaviour, we have a constructor
    public SavedState(GameObject go, Object2PropertiesMapping o2m)
    {
        if (o2m.isParent())
        {
            isParent = true;
        }
        else
        {
            isParent = false;
        }

        if (go != null)
        {
            if (o2m.isParent())
            {
                this.pos   = new SerVector3(go.transform.position);
                this.scale = new SerVector3(go.transform.lossyScale);
                this.rot   = new SerQuaternion(go.transform.rotation);
                isParent   = true;
            }
            else
            {
                this.pos   = new SerVector3(go.transform.localPosition);
                this.scale = new SerVector3(go.transform.localScale);
                this.rot   = new SerQuaternion(go.transform.localRotation);
            }

            this.isActive = go.activeInHierarchy;
        }
        else
        {
            this.pos      = new SerVector3(Vector3.zero);
            this.scale    = new SerVector3(Vector3.one);
            this.rot      = new SerQuaternion(Quaternion.identity);
            this.isActive = false;
        }
    }
示例#10
0
    //as this is not derived from MonoBehaviour, we have a constructor
    public SavedState(GameObject go)
    {
        if (go != null)
        {
            if (go.GetComponent <ParticleEmitter>())
            {
                emittingParticles = go.GetComponent <ParticleEmitter>().emit;
            }

            //this.position = new SerVector3(go.transform.position);
            //this.rotation = new SerQuaternion(go.transform.rotation);
            this.localPosition = new SerVector3(go.transform.localPosition);
            this.localRotation = new SerQuaternion(go.transform.localRotation);
            this.isActive      = go.activeInHierarchy;
        }
        else
        {
            //this.position = new SerVector3(Vector3.zero);
            //this.rotation = new SerQuaternion(Quaternion.identity);
            this.localPosition = new SerVector3(Vector3.zero);
            this.localRotation = new SerQuaternion(Quaternion.identity);
            this.isActive      = false;
        }
    }
示例#11
0
 public Vector3 serVec3ToVec3(SerVector3 serVec3)
 {
     return(new Vector3(serVec3.x, serVec3.y, serVec3.z));
 }
示例#12
0
 public Vector3 serVec3ToVec3(SerVector3 serVec3)
 {
     return new Vector3(serVec3.x,serVec3.y,serVec3.z);
 }
示例#13
0
    //serialization constructor
    protected SavedState(SerializationInfo info,StreamingContext context)
    {
        //this.position = (SerVector3)info.GetValue("position",typeof(SerVector3));
        this.localPosition = (SerVector3)info.GetValue("localPosition",typeof(SerVector3));
        //this.rotation = (SerQuaternion)info.GetValue("rotation",typeof(SerQuaternion));
        this.localRotation = (SerQuaternion)info.GetValue("localRotation",typeof(SerQuaternion));

        emittingParticles = info.GetBoolean("emittingParticles");
        isActive = info.GetBoolean("isActive");

        /**************************************************************
         *  New Addition
         **************************************************************/
        this.isMainCameraChild = info.GetBoolean("isMainCameraChild");
        this.tag = info.GetString("tag");
        this.convoTitle = info.GetString("convoTitle");
        this.dialogueNum = info.GetInt32("dialogueNum");
        this.dialogueType = info.GetString("dialogueType");
        //*************************************************************
    }