Beispiel #1
0
    public void CopyProperties(Base_BHV other)
    {
        for (int i = 0; i < other.childrenProperties.Length; i++)
        {
            SectionProperties otherProp = other.childrenProperties[i];

            childrenProperties[i].parentSection = otherProp.parentSection;
            childrenProperties[i].rotation      = otherProp.rotation;
            childrenProperties[i].scale         = otherProp.scale;

            SectionProperties.AnimationPatternProperties otherAnim = otherProp.animationProperties;
            childrenProperties[i].animationProperties.animationAxis        = otherAnim.animationAxis;
            childrenProperties[i].animationProperties.animationStartOffset = otherAnim.animationStartOffset;
            childrenProperties[i].animationProperties.cycleTime            = otherAnim.cycleTime;
            childrenProperties[i].animationProperties.animationCurve       = otherAnim.animationCurve;
            childrenProperties[i].animationProperties.animationAttribute   = PatternTransformAnimation_BHV.AnimAttrib.Rotation;
            childrenProperties[i].animationProperties.animationAmplitude   = otherAnim.animationAmplitude;
        }
    }
Beispiel #2
0
    public void DefinePropertiesFrom(Base_BHV first, Base_BHV second)
    {
        for (int i = 0; i < childrenProperties.Length; i++)
        {
            SectionProperties firstProp  = first.childrenProperties[i];
            SectionProperties secondProp = second.childrenProperties[i];

            int fp = firstProp.parentSection;
            int sp = secondProp.parentSection;
            childrenProperties[i].parentSection = Random.Range(((fp > sp)? sp:fp), ((fp < sp)? sp:fp) + 1);
            childrenProperties[i].rotation      = (firstProp.rotation + secondProp.rotation) / 2f;
            childrenProperties[i].scale         = (firstProp.scale + secondProp.scale) / 2f;

            SectionProperties.AnimationPatternProperties firstAnim  = firstProp.animationProperties;
            SectionProperties.AnimationPatternProperties secondAnim = secondProp.animationProperties;
            childrenProperties[i].animationProperties.animationAxis        = (Random.value > 0.5f)? firstAnim.animationAxis : secondAnim.animationAxis;
            childrenProperties[i].animationProperties.animationStartOffset = (firstAnim.animationStartOffset + secondAnim.animationStartOffset) / 2f;
            childrenProperties[i].animationProperties.cycleTime            = (firstAnim.cycleTime + secondAnim.cycleTime) / 2f;
            childrenProperties[i].animationProperties.animationCurve       = (Random.value > 0.5f) ? firstAnim.animationCurve : secondAnim.animationCurve;
            childrenProperties[i].animationProperties.animationAttribute   = PatternTransformAnimation_BHV.AnimAttrib.Rotation;
            childrenProperties[i].animationProperties.animationAmplitude   = (firstAnim.animationAmplitude + secondAnim.animationAmplitude) / 2f;
        }
    }