コード例 #1
0
    void OnTriggerEnter2D(Collider2D other)
    {
        // remove cars once they leave the intersection
        if (other.gameObject.CompareTag("End Point"))
        {
            Destroy(gameObject);
        }

        else if (other.gameObject.CompareTag("Turning Point") && turningDirection != Turning.None)
        {
            isDeaccelerating = false;
            isTurning        = true;
            TurningPoint turningPoint = other.gameObject.GetComponent <TurningPoint>();

            GameObject path;

            if (turningDirection == Turning.Left)
            {
                path          = turningPoint.leftPath;
                nextDirection = turningPoint.leftExitDirection;
            }
            else
            {
                path          = turningPoint.rightPath;
                nextDirection = turningPoint.rightExitDirection;
            }

            parabolaController.ParabolaRoot = path;
            parabolaController.Speed        = currentSpeed;
            parabolaController.FollowParabola();
        }
    }
コード例 #2
0
ファイル: EdgeDetect.cs プロジェクト: xdedss/BadappleGen
 static void AddTurningPoint(int x, int y)
 {
     if (turningPointsTable[x, y] == null)
     {
         var turningPoint = new TurningPoint(new Vector2(x, y));
         turningPoints.Add(turningPoint);
         turningPointsTable[x, y] = turningPoint;
     }
 }
コード例 #3
0
    void Start()
    {
        vectToNextPoint = new Vector2[nextPoints.Length];

        for (int i = 0; i < nextPoints.Length; i++)
        {
            TurningPoint nextPoint = nextPoints [i];
            Vector2      pointVect = nextPoint.transform.localPosition - transform.localPosition;
            vectToNextPoint[i] = pointVect.normalized;
        }
    }
コード例 #4
0
    //
    // - - - Supplementary File Ops
    //

    /// <summary>
    /// Creates a ginormous dataDump string in a suitable cut and paste, Keep friendly, format, from all Stories in dictOfStories
    /// </summary>
    /// <returns></returns>
    public string CreateExportDataDump()
    {
        StringBuilder builderMain = new StringBuilder();
        Dictionary <string, Story> dictOfStories = ToolManager.i.toolDataScript.GetDictOfStories();

        if (dictOfStories != null)
        {
            int    count;
            string characters;
            foreach (var story in dictOfStories)
            {
                //create an individual story builder
                StringBuilder builderStory = new StringBuilder();
                //Story Details
                builderStory.AppendFormat("- - - NewAdventure{0}", "\n");
                builderStory.AppendFormat("Name: {0}{1}", story.Value.tag, "\n");
                builderStory.AppendFormat("Date: {0}{1}", story.Value.date, "\n");
                builderStory.AppendFormat("NameSet: {0}{1}", story.Value.nameSet, "\n");
                builderStory.AppendFormat("Theme: {0} / {1} / {2} / {3} / {4}{5}{6}", story.Value.theme.GetThemeType(1), story.Value.theme.GetThemeType(2), story.Value.theme.GetThemeType(3),
                                          story.Value.theme.GetThemeType(4), story.Value.theme.GetThemeType(5), "\n", "\n");
                builderStory.AppendFormat("{0}{1}", story.Value.notes, "\n");
                //Turning Point summary
                for (int i = 0; i < story.Value.arrayOfTurningPoints.Length; i++)
                {
                    TurningPoint turningPoint = story.Value.arrayOfTurningPoints[i];
                    builderStory.AppendFormat("{0}TurningPoint {1}: {2}{3}{4}", "\n", i, turningPoint.tag, "\n", "\n");
                    builderStory.AppendFormat("Notes: {0}{1}", turningPoint.notes, "\n");
                    //summary
                    builderStory.AppendFormat("{0}TurningPoint {1} Summary{2}", "\n", i, "\n");
                    for (int j = 0; j < turningPoint.arrayOfDetails.Length; j++)
                    {
                        PlotDetails details = turningPoint.arrayOfDetails[j];
                        characters = "";
                        //only character1 present
                        if (details.character1.tag != null && details.character2.tag == null)
                        {
                            characters = string.Format("{0}", details.character1.tag.Length > 0 ? " -> " + details.character1.tag : "");
                        }
                        //both present
                        else if (details.character1.tag != null && details.character2.tag != null)
                        {
                            characters = string.Format("{0}{1}", details.character1.tag.Length > 0 ? " -> " + details.character1.tag : "", details.character2.tag.Length > 0 ? " / " + details.character2.tag : "");
                        }
                        //neither present -> do nothing
                        else if (details.character1.tag == null && details.character2.tag == null)
                        {
                        }
                        //character1 null and character2 present -> Error condition as shouldn't happen
                        else
                        {
                            Debug.LogWarningFormat("Invalid characters ->  character1.tag {0}, character2.tag {1}, for plotPoint {2}", details.character1.tag == null ? "Null" : "O.K",
                                                   details.character2.tag == null ? "Null" : "O.K", details.plotPoint);
                        }
                        builderStory.AppendFormat("[{0} {1}] {2}{3}", j, details.plotPoint, characters, "\n");
                        if (details.notes != null && details.notes.Length > 0)
                        {
                            builderStory.AppendFormat("{0}~{1}~{2}{3}", "\n", details.notes, "\n", "\n");
                        }
                    }
                }
                //lists -> Active Plotline
                builderStory.AppendFormat("{0}- Active PlotLines{1}", "\n", "\n");
                count = story.Value.lists.listOfPlotLines.Count;
                if (count > 0)
                {
                    for (int i = 0; i < count; i++)
                    {
                        builderStory.AppendFormat("{0}{1}", story.Value.lists.listOfPlotLines[i].tag, "\n");
                    }
                }
                else
                {
                    builderStory.AppendFormat("No active PlotLines remaining{0}{1}", "\n", "\n");
                }
                //lists -> Removed Plotline
                builderStory.AppendFormat("{0}- Removed PlotLines{1}", "\n", "\n");
                count = story.Value.lists.listOfRemovedPlotLines.Count;
                if (count > 0)
                {
                    for (int i = 0; i < count; i++)
                    {
                        builderStory.AppendFormat("{0}{1}", story.Value.lists.listOfRemovedPlotLines[i].tag, "\n");
                    }
                }
                else
                {
                    builderStory.AppendFormat("No plotLines have been Removed{0}{1}", "\n", "\n");
                }
                //lists -> Characters
                builderStory.AppendFormat("{0}- Active Characters{1}", "\n", "\n");
                count = story.Value.lists.listOfCharacters.Count;
                if (count > 0)
                {
                    for (int i = 0; i < count; i++)
                    {
                        builderStory.AppendFormat("{0} -> {1}{2}", story.Value.lists.listOfCharacters[i].tag, story.Value.lists.listOfCharacters[i].dataCreated, "\n");
                    }
                }
                else
                {
                    builderStory.AppendFormat("No active Characters remaining{0}{1}", "\n", "\n");
                }
                //lists -> RemovedCharacters
                builderStory.AppendFormat("{0}- Removed Characters{1}", "\n", "\n");
                count = story.Value.lists.listOfRemovedCharacters.Count;
                if (count > 0)
                {
                    for (int i = 0; i < count; i++)
                    {
                        builderStory.AppendFormat("{0} -> {1}{2}", story.Value.lists.listOfRemovedCharacters[i].tag, story.Value.lists.listOfCharacters[i].dataCreated, "\n");
                    }
                }
                else
                {
                    builderStory.AppendFormat("No characters have been removed{0}{1}", "\n", "\n");
                }
                //Characters in detail -> Active Characters
                builderStory.AppendFormat("{0}- Active Characters in Detail{1}", "\n", "\n");
                count = story.Value.lists.listOfCharacters.Count;
                if (count > 0)
                {
                    for (int i = 0; i < count; i++)
                    {
                        Character character = story.Value.lists.listOfCharacters[i];
                        builderStory.AppendFormat("{0}{1}", character.tag, "\n");
                        builderStory.AppendFormat("  {0}{1}", character.dataCreated, "\n");
                        //notes
                        for (int j = 0; j < character.listOfNotes.Count; j++)
                        {
                            builderStory.AppendFormat("Note: {0}{1}", character.listOfNotes[j], "\n");
                        }
                    }
                }
                else
                {
                    builderStory.AppendFormat("No active Characters remaining{0}{1}", "\n", "\n");
                }
                //Characters in detail -> Removed Characters
                builderStory.AppendFormat("{0}- Removed Characters in Detail{1}", "\n", "\n");
                count = story.Value.lists.listOfRemovedCharacters.Count;
                if (count > 0)
                {
                    for (int i = 0; i < count; i++)
                    {
                        Character character = story.Value.lists.listOfRemovedCharacters[i];
                        builderStory.AppendFormat("{0}{1}", character.tag, "\n");
                        builderStory.AppendFormat("  {0}{1}", character.dataCreated, "\n");
                        //notes
                        for (int j = 0; j < character.listOfNotes.Count; j++)
                        {
                            builderStory.AppendFormat("Note: {0}{1}", character.listOfNotes[j], "\n");
                        }
                    }
                }
                else
                {
                    builderStory.AppendFormat("No characters have been removed{0}{1}", "\n", "\n");
                }
                //PlotLines in detail -> Active
                builderStory.AppendFormat("{0}- Active PlotLines in Detail{1}", "\n", "\n");
                count = story.Value.lists.listOfPlotLines.Count;
                if (count > 0)
                {
                    for (int i = 0; i < count; i++)
                    {
                        PlotLine plotLine = story.Value.lists.listOfPlotLines[i];
                        builderStory.AppendFormat("{0}{1}", plotLine.tag, "\n");
                        //notes
                        for (int j = 0; j < plotLine.listOfNotes.Count; j++)
                        {
                            builderStory.AppendFormat("Note: {0}{1}", plotLine.listOfNotes[j], "\n");
                        }
                        builderStory.AppendLine();
                    }
                }
                else
                {
                    builderStory.AppendFormat("No active plotLines remaining{0}{1}", "\n", "\n");
                }
                //PlotLines in detail -> Removed
                builderStory.AppendFormat("- Removed PlotLines in Detail{0}", "\n");
                count = story.Value.lists.listOfRemovedPlotLines.Count;
                if (count > 0)
                {
                    for (int i = 0; i < count; i++)
                    {
                        PlotLine plotLine = story.Value.lists.listOfRemovedPlotLines[i];
                        builderStory.AppendFormat("{0}{1}", plotLine.tag, "\n");
                        //notes
                        for (int j = 0; j < plotLine.listOfNotes.Count; j++)
                        {
                            builderStory.AppendFormat("Note: {0}{1}", plotLine.listOfNotes[j], "\n");
                        }
                        builderStory.AppendLine();
                    }
                }
                else
                {
                    builderStory.AppendFormat("No plotLines have been removed{0}{1}", "\n", "\n");
                }
                //add story to main builder
                builderMain.Append(builderStory);
                builderMain.AppendLine();
                builderMain.AppendLine();
            }
        }
        else
        {
            Debug.LogError("Invalid dictOfStories (Null)");
        }
        return(builderMain.ToString());
    }
コード例 #5
0
ファイル: EdgeDetect.cs プロジェクト: xdedss/BadappleGen
 public EdgeChain(TurningPoint turningPoint)
 {
     this.pos = turningPoint.pos;
 }