コード例 #1
0
 void OnEnable()
 {
     curve = target as SceneCurve;
     if (curve && !curve.Created)
     {
         curve.SetInitial();
     }
 }
コード例 #2
0
        /// <summary>
        /// If main object falldown fish swim to side
        /// </summary>
        /// <param name="completeCallBack"></param>
        /// <param name="showPrivateScore"></param>
        /// <param name="addPrivateScore"></param>
        /// <param name="privateScore"></param>
        public override void FallDownCollect(Action completeCallBack, bool showPrivateScore, bool addPrivateScore, int privateScore)
        {
            OverlayObject oO = GetComponent <OverlayObject>();

            if (oO && oO.OOData != null)
            {
                collectSequence = new TweenSeq();// Debug.Log("Fish collect " + ToString());
                float locScale = transform.localScale.x;
                oO.sRenderer.sprite = oO.OOData.GuiImage;

                collectSequence.Add((callBack) => // scale out
                {
                    SimpleTween.Value(gameObject, locScale, locScale * 1.2f, 0.20f).SetOnUpdate((float val) =>
                    {
                        transform.localScale = new Vector3(val, val, val);
                    }).AddCompleteCallBack(callBack);
                });

                collectSequence.Add((callBack) =>  //scale in
                {
                    SimpleTween.Value(gameObject, locScale * 1.2f, locScale, 0.20f).SetOnUpdate((float val) =>
                    {
                        transform.localScale = new Vector3(val, val, val);
                    }).AddCompleteCallBack(callBack);
                });

                collectSequence.Add((callBack) =>
                {
                    SoundMasterController.Instance.SoundPlayClipAtPos(0, oO.OOData.privateClip, null, transform.position, 1.0f);
                    GameObject aP = oO.OOData.hitAnimPrefab;
                    Transform rel = GetComponentInParent <GridCell>().transform;

                    SceneCurve path = (UnityEngine.Random.Range(0, 2) == 0) ? pathToLeft : pathToRight;
                    path.MoveAlongPath(gameObject, rel, path.Length / speed, 0, EaseAnim.EaseInOutSine, callBack);
                });

                collectSequence.Add((callBack) =>
                {
                    //   if (showPrivateScore) EffectsHolder.Instance.InstantiateScoreFlyerAtPosition(privateScore, transform.position, oO.OOData.privateFont);
                    //  if (addPrivateScore) BubblesPlayer.Instance.AddScore(privateScore);
                    if (completeCallBack != null)
                    {
                        completeCallBack();
                    }
                    DestroyImmediate(gameObject);
                    callBack();
                });

                collectSequence.Start();
            }
            else
            {
                if (completeCallBack != null)
                {
                    completeCallBack();
                }
            }
        }
コード例 #3
0
        private void OnSceneGUI()
        {
            curve           = target as SceneCurve;
            handleTransform = curve.transform;
            handleRotation  = (Tools.pivotRotation == PivotRotation.Local) ? handleTransform.rotation : Quaternion.identity;

            ShowControlPoints();
            Handles.color = Color.gray;
            ShowPivot();
        }
コード例 #4
0
        private void ShowControlPoints()
        {
            if (!curve)
            {
                curve = target as SceneCurve;
            }

            for (int i = 0; i < curve.HandlesCount; i++)
            {
                ShowControlPoint(i);
            }
        }
コード例 #5
0
        public override void OnInspectorGUI()
        {
            DrawDefaultInspector();
            if (!curve)
            {
                curve = target as SceneCurve;
            }
            if (!curve)
            {
                return;
            }
            DrawPointsInspector();

            if (selectedIndex >= 0 && selectedIndex < curve.HandlesCount - 1)
            {
                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField("Press to add or remove curve control point.");

                if (GUILayout.Button("Add Point"))
                {
                    Undo.RecordObject(curve, "Add Point");
                    EditorUtility.SetDirty(curve);
                    curve.AddPoint(selectedIndex);
                }

                if (curve.HandlesCount > 3)
                {
                    if (GUILayout.Button("Remove Point"))
                    {
                        Undo.RecordObject(curve, "Remove Point");
                        EditorUtility.SetDirty(curve);
                        curve.RemovePoint(selectedIndex);
                    }
                }
                EditorGUILayout.EndHorizontal();
            }
            if (selectedIndex >= 0 && selectedIndex < curve.HandlesCount)
            {
                DrawSelectedPointInspector();
            }
            else
            {
                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField("Select curve control point for curve edit.");
                EditorGUILayout.EndHorizontal();
            }

            if (!curve.Created)
            {
                if (GUILayout.Button("Create curve"))
                {
                    curve.SetInitial();
                }
            }
            else
            {
                if (GUILayout.Button("Rebuild curve"))
                {
                    curve.SetInitial();
                }
            }
        }