Ejemplo n.º 1
0
 public MoleculeComponent(ComponentDef componentDef, Molecule _molecule)
 {
     definition     = componentDef;
     molecule       = _molecule;
     state          = (definition.states == null || definition.states.Length < 1) ? "" : definition.states[0];
     localTransform = new RelativeTransform(componentDef.transformOnMolecule);
 }
Ejemplo n.º 2
0
        public virtual void MoveToComplex(Complex _complex)
        {
            RelativeTransform _worldTransform = new RelativeTransform(worldTransform);

            complex.RemoveMolecule(this);
            complex = _complex;

            localTransform = complex.reactor.GetLocalTransform(complex.position, complex.rotation, _worldTransform);
        }
Ejemplo n.º 3
0
 public Molecule(MoleculePattern moleculePattern, RelativeTransform _localTransform, Complex _complex)
 {
     localTransform     = new RelativeTransform(_localTransform);
     complex            = _complex;
     definition         = moleculePattern.moleculeDef;
     collisionRadius    = interactionRadius = definition.radius;
     interactionRadius += 1f;
     CreateComponents(moleculePattern);
     SetColorForCurrentState();
 }
Ejemplo n.º 4
0
        public RelativeTransform GetParentWorldTransform(RelativeTransform childWorldTransform, RelativeTransform childLocalTransform)
        {
            childTransform.SetParent(parentTransform);
            childTransform.localPosition = childLocalTransform.position;
            childTransform.localRotation = Quaternion.Euler(childLocalTransform.rotation);

            childTransform.SetParent(transform);
            parentTransform.SetParent(childTransform);
            childTransform.position = childWorldTransform.position;
            childTransform.rotation = Quaternion.Euler(childWorldTransform.rotation);

            parentTransform.SetParent(transform);
            return(new RelativeTransform(parentTransform.position, parentTransform.rotation.eulerAngles));
        }
Ejemplo n.º 5
0
        public RelativeTransform GetLocalTransform(Vector3 parentWorldPosition, Quaternion parentWorldRotation, RelativeTransform childWorldTransform)
        {
            parentTransform.position = parentWorldPosition;
            parentTransform.rotation = parentWorldRotation;

            childTransform.position = childWorldTransform.position;
            childTransform.rotation = Quaternion.Euler(childWorldTransform.rotation);

            childTransform.SetParent(parentTransform);
            Vector3 childLocalPosition = childTransform.localPosition;
            Vector3 childLocalRotation = childTransform.localRotation.eulerAngles;

            childTransform.SetParent(transform);

            return(new RelativeTransform(childLocalPosition, childLocalRotation));
        }
Ejemplo n.º 6
0
        public RelativeTransform GetWorldTransform(Vector3 parentWorldPosition, Quaternion parentWorldRotation, RelativeTransform localTransform)
        {
            parentTransform.position = parentWorldPosition;
            parentTransform.rotation = parentWorldRotation;

            childTransform.position = parentTransform.TransformPoint(localTransform.position);
            childTransform.rotation = parentTransform.rotation * Quaternion.Euler(localTransform.rotation);
            return(new RelativeTransform(childTransform.position, childTransform.rotation.eulerAngles));
        }
Ejemplo n.º 7
0
 public void SetWorldTransform(RelativeTransform worldTransform)
 {
     complex.SetWorldTransform(complex.reactor.GetParentWorldTransform(worldTransform, localTransform));
 }
Ejemplo n.º 8
0
 public void SetWorldTransform(RelativeTransform worldTransform)
 {
     mover.SetWorldTransform(worldTransform);
 }
Ejemplo n.º 9
0
 public RelativeTransform(RelativeTransform _relativeTransform)
 {
     position = _relativeTransform.position;
     rotation = _relativeTransform.rotation;
 }
Ejemplo n.º 10
0
 public void SetWorldTransform(RelativeTransform worldTransform)
 {
     position = worldTransform.position;
     rotation = Quaternion.Euler(worldTransform.rotation);
 }