Example #1
0
 public ComponentLinkCommand(SpeciesReference speciesReference, ComponentBase component, int linkNumber, ComponentLinkType linkType, bool adding)
 {
     this.speciesReference = speciesReference;
     this.component = component;
     this.linkNumber = linkNumber;
     this.linkType = linkType;
     this.adding = adding;
 }
Example #2
0
 public void setSpeciesReference(int linkNumber, ComponentLinkType linkType, SpeciesReference reference)
 {
     switch (linkType)
     {
         case ComponentLinkType.Input:
             reactants[linkNumber] = reference;
             break;
         case ComponentLinkType.Output:
             products[linkNumber] = reference;
             break;
     }
 }
Example #3
0
 public ComponentLink(ComponentBase parent, ComponentLinkType type, int linkNumber, float xOffset, float yOffset)
 {
     this.parent = parent;
     this.linkType = type;
     this.linkNumber = linkNumber;
     this.xOffset = xOffset;
     this.yOffset = yOffset;
 }
Example #4
0
 public SpeciesReference getSpeciesReference(int linkNumber, ComponentLinkType linkType)
 {
     switch (linkType)
     {
         case ComponentLinkType.Input:
             return reactants[linkNumber];
         case ComponentLinkType.Output:
             return products[linkNumber];
     }
     return null;
 }
Example #5
0
 public float getLinkPointRadius(int linkNumber, ComponentLinkType linkType)
 {
     return 4f;
 }
Example #6
0
        public Vector2 getLinkPointOffset(int linkNumber, ComponentLinkType linkType)
        {
            Vector2 offset = new Vector2();

            float angle = (float)Math.PI * -0.5f;
            float angleSpacePerLink;
            if (linkType == ComponentLinkType.Input)
            {
                //the angle given to each link around the circle
                angleSpacePerLink = -(float)Math.PI / (reactants.Length+1f);
            }
            else
            {
                angleSpacePerLink = (float)Math.PI / (products.Length+1f);
            }
            angle += angleSpacePerLink * (1+linkNumber);

            offset.x = (float)Math.Cos(angle) * ((this.getWidth()*0.5f)+getLinkPointRadius(linkNumber,linkType)*0.5f);
            offset.y = (float)Math.Sin(angle) * ((this.getHeight() * 0.5f) + getLinkPointRadius(linkNumber, linkType)*0.5f);

            return offset;
        }
Example #7
0
 public String getLinkPointName(int linkNumber, ComponentLinkType linkType)
 {
     switch (linkType)
     {
         case ComponentLinkType.Input:
             return getReactantNames()[linkNumber];
         case ComponentLinkType.Output:
             return getProductNames()[linkNumber];
     }
     return "Unknown";
 }
Example #8
0
 public ComponentLink getLinkPoint(int linkNumber, ComponentLinkType linkType)
 {
     if (linkComponents == null)
     {
         generateLinkComponents();
     }
     int address=linkNumber;
     if (linkType == ComponentLinkType.Output)
     {
         address += reactants.Length;
     }
     ComponentLink link=linkComponents[address];
     return link;
 }