Exemplo n.º 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");
    }
Exemplo n.º 2
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");
    }
Exemplo n.º 3
0
    public bool isDifferentTo(SerQuaternion 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;

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

        return changed;
    }
Exemplo n.º 4
0
	public bool isDifferentTo(SerQuaternion 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;
		
		if (!changed && w != other.w )
			changed = true;
				
		
		return changed;
	}
Exemplo n.º 5
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;
        }
    }
Exemplo n.º 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;

            /**************************************************************
             *  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;
        }
    }
Exemplo n.º 7
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;
        }
    }
Exemplo n.º 8
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;
        }
    }
Exemplo n.º 9
0
 public Quaternion serQuatToQuat(SerQuaternion serQuat)
 {
     return(new Quaternion(serQuat.x, serQuat.y, serQuat.z, serQuat.w));
 }
Exemplo n.º 10
0
 public Quaternion serQuatToQuat(SerQuaternion serQuat)
 {
     return new Quaternion(serQuat.x,serQuat.y,serQuat.z,serQuat.w);
 }
Exemplo n.º 11
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");
        //*************************************************************
    }