コード例 #1
0
    // Adjust the location of any guidelines being drawn
    private void OnGuideLinesChange(List <Tuple <DataPoint, DataPoint> > lines)
    {
        foreach (VisualLine line in trackedGuideLines)
        {
            line.Destroy();
        }

        trackedGuideLines.Clear();

        foreach (GameObject obj in trackedGuideLineCaps)
        {
            Destroy(obj);
        }

        trackedGuideLineCaps.Clear();

        foreach (Tuple <DataPoint, DataPoint> line in lines)
        {
            trackedGuideLines.Add(lineManager.CreateLine(line.Item1, line.Item2, guideLineColor, .075f));

            GameObject endcap = Instantiate(lineEndCap, this.gameObject.transform);
            endcap.transform.position = line.Item1;
            VisualObjectFadeInDirection vofid = endcap.GetComponent <VisualObjectFadeInDirection>();

            if (vofid != null)
            {
                vofid.direction = (new Vector2(line.Item2.X - line.Item1.X, line.Item2.Y - line.Item1.Y)).normalized;
            }

            trackedGuideLineCaps.Add(endcap);
        }
    }
コード例 #2
0
    private void OnLineDestroyed(DataPoint start, DataPoint end, DataEarnedScore points)
    {
        line?.Destroy();

        if (points.total > 0)
        {
            DataPoint s        = inputManager.ConvertToScreenPoint(start);
            DataPoint e        = inputManager.ConvertToScreenPoint(end);
            DataPoint worldPos = new DataPoint((s.X + e.X) / 2, (s.Y + e.Y) / 2);

            foreach (DataPoint point in points.locations)
            {
                DataPoint loc = inputManager.ConvertToScreenPoint(point);
                visualTextFeedback.CreateText(loc, "+" + GameCore.pointsPerBubble, TextType.ScoreAddition);
            }

            if (points.bonus != 0)
            {
                visualTextFeedback.CreateText(worldPos, "Bonus! +" + points.bonus, TextType.ScoreAdditionBonus);
            }
        }

        line = null;
    }