예제 #1
0
    //------------------------------------------------------------------------------------------------------------------------//

    void Awake()
    {
        //-- 필요 컴포넌트 받아오기-------------------------------//
        m_skletonAnimation = this.GetComponent <SkeletonAnimation>();
        m_bgCurve          = this.GetComponent <BansheeGz.BGSpline.Curve.BGCurve>();
        m_rigidBody        = this.GetComponent <Rigidbody2D>();
        m_climb            = transform.GetChild(2).GetComponent <SkeletonAnimation>();
        m_meshRenderer     = this.GetComponent <MeshRenderer>();
        //-------------------------------------------------------//
    }
예제 #2
0
 public BGCurveChangedArgs(BGCurve curve, ChangeTypeEnum changeType)
 {
     this.curve      = curve;
     this.changeType = changeType;
 }
예제 #3
0
 public BGCurvePoint CloneTo(BGCurve curve)
 {
     return(new BGCurvePoint(curve, PositionLocal, ControlType, ControlFirstLocal, ControlSecondLocal));
 }
예제 #4
0
 /// <summary> All coordinates are Local by default. positionLocal relative to curve's transform, controls are relative to positionLocal. Set useWorldCoordinates to true to use world coordinates</summary>
 public BGCurvePoint(BGCurve curve, Vector3 position, ControlTypeEnum controlType, bool useWorldCoordinates = false)
     : this(curve, position, controlType, Vector3.zero, Vector3.zero, useWorldCoordinates)
 {
 }
예제 #5
0
 /// <summary> All coordinates are Local by default. positionLocal relative to curve's transform, controls are relative to positionLocal. Set useWorldCoordinates to true to use world coordinates</summary>
 public BGCurvePoint(BGCurve curve, Vector3 position, bool useWorldCoordinates = false) : this(curve, position, ControlTypeEnum.Absent, useWorldCoordinates)
 {
 }
예제 #6
0
        //=================================================================================
        //                                                    This is not copy/pasted part
        //=================================================================================

        /// <summary>all methods, prefixed with Private, are not meant to be called from outside of BGCurve package </summary>
        //Init with data. No events are fired. point==null for pointsMode switching.
        public void PrivateInit(BGCurvePoint point, BGCurve.PointsModeEnum pointsMode)
        {
            if (point != null)
            {
                // init from new point
                curve          = point.Curve;
                controlType    = point.ControlType;
                pointTransform = point.PointTransform;

                switch (pointsMode)
                {
                case BGCurve.PointsModeEnum.GameObjectsNoTransform:
                    positionLocal      = point.PositionLocal;
                    controlFirstLocal  = point.ControlFirstLocal;
                    controlSecondLocal = point.ControlSecondLocal;
                    break;

                case BGCurve.PointsModeEnum.GameObjectsTransform:
                    transform.localPosition = point.PositionLocal;

                    //transformed locals are always the same
                    var targetTransform = pointTransform != null ? pointTransform : transform;
                    controlFirstLocal  = targetTransform.InverseTransformVector(point.ControlFirstLocalTransformed);
                    controlSecondLocal = targetTransform.InverseTransformVector(point.ControlSecondLocalTransformed);
                    break;

                default:
                    throw new ArgumentOutOfRangeException("pointsMode", pointsMode, null);
                }
            }
            else
            {
                // change pointsMode
                Transform targetTransform;
                switch (pointsMode)
                {
                case BGCurve.PointsModeEnum.GameObjectsNoTransform:
                {
                    if (Curve.PointsMode != BGCurve.PointsModeEnum.GameObjectsTransform)
                    {
                        throw new ArgumentOutOfRangeException("Curve.PointsMode", "Curve points mode should be equal to GameObjectsTransform");
                    }

                    positionLocal = transform.localPosition;

                    //transformed locals are always the same
                    targetTransform = pointTransform != null ? pointTransform : curve.transform;
                    break;
                }

                case BGCurve.PointsModeEnum.GameObjectsTransform:
                {
                    if (Curve.PointsMode != BGCurve.PointsModeEnum.GameObjectsNoTransform)
                    {
                        throw new ArgumentOutOfRangeException("Curve.PointsMode", "Curve points mode should be equal to GameObjectsNoTransform");
                    }

                    transform.position = PositionWorld;

                    //transformed locals are always the same
                    targetTransform = pointTransform != null ? pointTransform : transform;
                    break;
                }

                default:
                    throw new ArgumentOutOfRangeException("pointsMode", pointsMode, null);
                }

                controlFirstLocal  = targetTransform.InverseTransformVector(ControlFirstLocalTransformed);
                controlSecondLocal = targetTransform.InverseTransformVector(ControlSecondLocalTransformed);
            }
        }
예제 #7
0
        /// <summary>all methods, prefixed with Private, are not meant to be called from outside of BGCurve package </summary>
        // field added callback
        public static void PrivateFieldAdded(BGCurvePointField field, FieldsValues fieldsValues)
        {
            var type = FieldTypes.GetType(field.Type);
            var item = BGReflectionAdapter.IsValueType(type) ? Activator.CreateInstance(type) : null;

            switch (field.Type)
            {
            case BGCurvePointField.TypeEnum.Bool:
                Ensure(ref fieldsValues.boolValues);
                fieldsValues.boolValues = BGCurve.Insert(fieldsValues.boolValues, fieldsValues.boolValues.Length, (bool)item);
                break;

            case BGCurvePointField.TypeEnum.Int:
                Ensure(ref fieldsValues.intValues);
                fieldsValues.intValues = BGCurve.Insert(fieldsValues.intValues, fieldsValues.intValues.Length, (int)item);
                break;

            case BGCurvePointField.TypeEnum.Float:
                Ensure(ref fieldsValues.floatValues);
                fieldsValues.floatValues = BGCurve.Insert(fieldsValues.floatValues, fieldsValues.floatValues.Length, (float)item);
                break;

            case BGCurvePointField.TypeEnum.Vector3:
                Ensure(ref fieldsValues.vector3Values);
                fieldsValues.vector3Values = BGCurve.Insert(fieldsValues.vector3Values, fieldsValues.vector3Values.Length, (Vector3)item);
                break;

            case BGCurvePointField.TypeEnum.Bounds:
                Ensure(ref fieldsValues.boundsValues);
                fieldsValues.boundsValues = BGCurve.Insert(fieldsValues.boundsValues, fieldsValues.boundsValues.Length, (Bounds)item);
                break;

            case BGCurvePointField.TypeEnum.Color:
                Ensure(ref fieldsValues.colorValues);
                fieldsValues.colorValues = BGCurve.Insert(fieldsValues.colorValues, fieldsValues.colorValues.Length, (Color)item);
                break;

            case BGCurvePointField.TypeEnum.String:
                Ensure(ref fieldsValues.stringValues);
                fieldsValues.stringValues = BGCurve.Insert(fieldsValues.stringValues, fieldsValues.stringValues.Length, (string)item);
                break;

            case BGCurvePointField.TypeEnum.Quaternion:
                Ensure(ref fieldsValues.quaternionValues);
                fieldsValues.quaternionValues = BGCurve.Insert(fieldsValues.quaternionValues, fieldsValues.quaternionValues.Length, (Quaternion)item);
                break;

            case BGCurvePointField.TypeEnum.AnimationCurve:
                Ensure(ref fieldsValues.animationCurveValues);
                fieldsValues.animationCurveValues = BGCurve.Insert(fieldsValues.animationCurveValues, fieldsValues.animationCurveValues.Length, (AnimationCurve)item);
                break;

            case BGCurvePointField.TypeEnum.GameObject:
                Ensure(ref fieldsValues.gameObjectValues);
                fieldsValues.gameObjectValues = BGCurve.Insert(fieldsValues.gameObjectValues, fieldsValues.gameObjectValues.Length, (GameObject)item);
                break;

            case BGCurvePointField.TypeEnum.Component:
                Ensure(ref fieldsValues.componentValues);
                fieldsValues.componentValues = BGCurve.Insert(fieldsValues.componentValues, fieldsValues.componentValues.Length, (Component)item);
                break;

            case BGCurvePointField.TypeEnum.BGCurve:
                Ensure(ref fieldsValues.bgCurveValues);
                fieldsValues.bgCurveValues = BGCurve.Insert(fieldsValues.bgCurveValues, fieldsValues.bgCurveValues.Length, (BGCurve)item);
                break;

            case BGCurvePointField.TypeEnum.BGCurvePointComponent:
                Ensure(ref fieldsValues.bgCurvePointComponentValues);
                fieldsValues.bgCurvePointComponentValues = BGCurve.Insert(fieldsValues.bgCurvePointComponentValues, fieldsValues.bgCurvePointComponentValues.Length, (BGCurvePointComponent)item);
                break;

            case BGCurvePointField.TypeEnum.BGCurvePointGO:
                Ensure(ref fieldsValues.bgCurvePointGOValues);
                fieldsValues.bgCurvePointGOValues = BGCurve.Insert(fieldsValues.bgCurvePointGOValues, fieldsValues.bgCurvePointGOValues.Length, (BGCurvePointGO)item);
                break;

            default:
                throw new ArgumentOutOfRangeException("field.Type", field.Type, "Unsupported type " + field.Type);
            }
        }
예제 #8
0
        /// <summary>all methods, prefixed with Private, are not meant to be called from outside of BGCurve package </summary>
        // field deleted callback
        public static void PrivateFieldDeleted(BGCurvePointField field, int indexOfField, FieldsValues fieldsValues)
        {
            switch (field.Type)
            {
            case BGCurvePointField.TypeEnum.Bool:
                Ensure(ref fieldsValues.boolValues);
                fieldsValues.boolValues = BGCurve.Remove(fieldsValues.boolValues, indexOfField);
                break;

            case BGCurvePointField.TypeEnum.Int:
                Ensure(ref fieldsValues.intValues);
                fieldsValues.intValues = BGCurve.Remove(fieldsValues.intValues, indexOfField);
                break;

            case BGCurvePointField.TypeEnum.Float:
                Ensure(ref fieldsValues.floatValues);
                fieldsValues.floatValues = BGCurve.Remove(fieldsValues.floatValues, indexOfField);
                break;

            case BGCurvePointField.TypeEnum.Vector3:
                Ensure(ref fieldsValues.vector3Values);
                fieldsValues.vector3Values = BGCurve.Remove(fieldsValues.vector3Values, indexOfField);
                break;

            case BGCurvePointField.TypeEnum.Bounds:
                Ensure(ref fieldsValues.boundsValues);
                fieldsValues.boundsValues = BGCurve.Remove(fieldsValues.boundsValues, indexOfField);
                break;

            case BGCurvePointField.TypeEnum.Color:
                Ensure(ref fieldsValues.colorValues);
                fieldsValues.colorValues = BGCurve.Remove(fieldsValues.colorValues, indexOfField);
                break;

            case BGCurvePointField.TypeEnum.String:
                Ensure(ref fieldsValues.stringValues);
                fieldsValues.stringValues = BGCurve.Remove(fieldsValues.stringValues, indexOfField);
                break;

            case BGCurvePointField.TypeEnum.Quaternion:
                Ensure(ref fieldsValues.quaternionValues);
                fieldsValues.quaternionValues = BGCurve.Remove(fieldsValues.quaternionValues, indexOfField);
                break;

            case BGCurvePointField.TypeEnum.AnimationCurve:
                Ensure(ref fieldsValues.animationCurveValues);
                fieldsValues.animationCurveValues = BGCurve.Remove(fieldsValues.animationCurveValues, indexOfField);
                break;

            case BGCurvePointField.TypeEnum.GameObject:
                Ensure(ref fieldsValues.gameObjectValues);
                fieldsValues.gameObjectValues = BGCurve.Remove(fieldsValues.gameObjectValues, indexOfField);
                break;

            case BGCurvePointField.TypeEnum.Component:
                Ensure(ref fieldsValues.componentValues);
                fieldsValues.componentValues = BGCurve.Remove(fieldsValues.componentValues, indexOfField);
                break;

            case BGCurvePointField.TypeEnum.BGCurve:
                Ensure(ref fieldsValues.bgCurveValues);
                fieldsValues.bgCurveValues = BGCurve.Remove(fieldsValues.bgCurveValues, indexOfField);
                break;

            case BGCurvePointField.TypeEnum.BGCurvePointComponent:
                Ensure(ref fieldsValues.bgCurvePointComponentValues);
                fieldsValues.bgCurvePointComponentValues = BGCurve.Remove(fieldsValues.bgCurvePointComponentValues, indexOfField);
                break;

            case BGCurvePointField.TypeEnum.BGCurvePointGO:
                Ensure(ref fieldsValues.bgCurvePointGOValues);
                fieldsValues.bgCurvePointGOValues = BGCurve.Remove(fieldsValues.bgCurvePointGOValues, indexOfField);
                break;

            default:
                throw new ArgumentOutOfRangeException("field.Type", field.Type, "Unsupported type " + field.Type);
            }
        }
예제 #9
0
 /// <summary> All coordinates are Local by default. positionLocal relative to curve's transform, controls are relative to positionLocal. Set useWorldCoordinates to true to use world coordinates</summary>
 public BGCurvePoint(BGCurve curve, Vector3 position, ControlTypeEnum controlType, Vector3 controlFirst, Vector3 controlSecond, bool useWorldCoordinates = false)
     : this(curve, null, position, controlType, controlFirst, controlSecond, useWorldCoordinates)
 {
 }
예제 #10
0
 public BGCurveFormulaMath(BGCurve curve, Config config)
     : base(curve, config)
 {
 }