public override ActorComponent MakeInstance(Actor resetActor) { ActorColliderCircle instanceCollider = new ActorColliderCircle(); instanceCollider.Copy(this, resetActor); return(instanceCollider); }
public static ActorColliderCircle Read(Actor actor, BinaryReader reader, ActorColliderCircle property = null) { if (property == null) { property = new ActorColliderCircle(); } ActorCollider.Read(actor, reader, property); property.m_Radius = reader.ReadSingle(); return(property); }
private void ReadComponentsBlock(BlockReader block) { int componentCount = block.ReadUInt16(); m_Components = new ActorComponent[componentCount + 1]; m_Components[0] = m_Root; // Guaranteed from the exporter to be in index order. BlockReader nodeBlock = null; int componentIndex = 1; m_NodeCount = 1; while ((nodeBlock = block.ReadNextBlock()) != null) { ActorComponent component = null; if (Enum.IsDefined(typeof(BlockTypes), nodeBlock.BlockType)) { BlockTypes type = (BlockTypes)nodeBlock.BlockType; switch (type) { case BlockTypes.ActorNode: component = ActorNode.Read(this, nodeBlock); break; case BlockTypes.ActorBone: component = ActorBone.Read(this, nodeBlock); break; case BlockTypes.ActorRootBone: component = ActorRootBone.Read(this, nodeBlock); break; case BlockTypes.ActorImage: m_ImageNodeCount++; component = ActorImage.Read(this, nodeBlock, makeImageNode()); if ((component as ActorImage).TextureIndex > m_MaxTextureIndex) { m_MaxTextureIndex = (component as ActorImage).TextureIndex; } break; case BlockTypes.ActorIKTarget: component = ActorIKTarget.Read(this, nodeBlock); break; case BlockTypes.ActorEvent: component = ActorEvent.Read(this, nodeBlock); break; case BlockTypes.CustomIntProperty: component = CustomIntProperty.Read(this, nodeBlock); break; case BlockTypes.CustomFloatProperty: component = CustomFloatProperty.Read(this, nodeBlock); break; case BlockTypes.CustomStringProperty: component = CustomStringProperty.Read(this, nodeBlock); break; case BlockTypes.CustomBooleanProperty: component = CustomBooleanProperty.Read(this, nodeBlock); break; case BlockTypes.ActorColliderRectangle: component = ActorColliderRectangle.Read(this, nodeBlock); break; case BlockTypes.ActorColliderTriangle: component = ActorColliderTriangle.Read(this, nodeBlock); break; case BlockTypes.ActorColliderCircle: component = ActorColliderCircle.Read(this, nodeBlock); break; case BlockTypes.ActorColliderPolygon: component = ActorColliderPolygon.Read(this, nodeBlock); break; case BlockTypes.ActorColliderLine: component = ActorColliderLine.Read(this, nodeBlock); break; case BlockTypes.ActorNodeSolo: component = ActorNodeSolo.Read(this, nodeBlock); break; case BlockTypes.ActorJellyBone: component = ActorJellyBone.Read(this, nodeBlock); break; case BlockTypes.JellyComponent: component = JellyComponent.Read(this, nodeBlock); break; case BlockTypes.ActorIKConstraint: component = ActorIKConstraint.Read(this, nodeBlock); break; case BlockTypes.ActorDistanceConstraint: component = ActorDistanceConstraint.Read(this, nodeBlock); break; case BlockTypes.ActorTranslationConstraint: component = ActorTranslationConstraint.Read(this, nodeBlock); break; case BlockTypes.ActorScaleConstraint: component = ActorScaleConstraint.Read(this, nodeBlock); break; case BlockTypes.ActorRotationConstraint: component = ActorRotationConstraint.Read(this, nodeBlock); break; case BlockTypes.ActorTransformConstraint: component = ActorTransformConstraint.Read(this, nodeBlock); break; } } if (component is ActorNode) { m_NodeCount++; } m_Components[componentIndex] = component; if (component != null) { component.Idx = (ushort)(componentIndex); } componentIndex++; } m_ImageNodes = new ActorImage[m_ImageNodeCount]; m_Nodes = new ActorNode[m_NodeCount]; m_Nodes[0] = m_Root; // Resolve nodes. int imgIdx = 0; int anIdx = 0; ActorComponent[] components = m_Components; for (int i = 1; i <= componentCount; i++) { ActorComponent c = components[i]; // Nodes can be null if we read from a file version that contained nodes that we don't interpret in this runtime. if (c != null) { c.ResolveComponentIndices(components); } ActorImage ain = c as ActorImage; if (ain != null) { m_ImageNodes[imgIdx++] = ain; } ActorNode an = c as ActorNode; if (an != null) { m_Nodes[anIdx++] = an; } } for (int i = 1; i <= componentCount; i++) { ActorComponent c = components[i]; if (c != null) { c.CompleteResolve(); } } SortDependencies(); }
public void Copy(ActorColliderCircle prop, Actor resetActor) { base.Copy(prop, resetActor); m_Radius = prop.m_Radius; }