Пример #1
0
 public static void DebugPath(List <Vector3> path)
 {
     for (int i = 1; i < path.Count; i++)
     {
         Vector3 prev = path[i - 1];
         Vector3 pos  = path [i];
         DebugFn.arrow(prev, pos);
     }
 }
Пример #2
0
 public static void arrows(List <Vector3> vectors)
 {
     for (int i = 1; i < vectors.Count; i++)
     {
         Vector3 prev = vectors[i - 1];
         Vector3 curr = vectors[i];
         DebugFn.arrow(prev, curr);
     }
 }
Пример #3
0
    public void setStartAndEndInfo(Tuple3 <Pos, WayReference, Vector3> startInfo, Tuple3 <Pos, WayReference, Vector3> endInfo, Setup.PersonSetup personality, Pos targetPos)
    {
        setWaypointsInfo(personality);

        path     = Game.calculateCurrentPaths(startInfo.First, endInfo.First, null, wayPoints, false, true);
        walkPath = Misc.posToVector3(path);

        this.targetPos = targetPos;
        InformationHuman informationHuman = GetComponent <InformationHuman> ();

        PubSub.publish("TargetPOI(" + targetPos.Id + "):Add", informationHuman);

        if (path.Count == 1)
        {
            Destroy(gameObject);
            return;
        }
        // Rotate human...
        Pos pos1 = path [0];
        Pos pos2 = path [1];

        Pos lastPos         = path [path.Count - 1];
        Pos secondToLastPos = path [path.Count - 2];

        WayReference startWay = startInfo.Second;

        if (personality != null && personality.startVector != null || startWay.hasNodes(pos1, pos2))
        {
            walkPath.RemoveAt(0);
            path.RemoveAt(0);
        }
        walkPath.Insert(0, startInfo.Third);
        path.Insert(0, Game.createTmpPos(startInfo.Third));

        endWay = endInfo.Second;
        if (endWay.hasNodes(secondToLastPos, lastPos))
        {
            walkPath.RemoveAt(walkPath.Count - 1);
            path.RemoveAt(path.Count - 1);
        }
        walkPath.Add(endInfo.Third);
        path.Add(Game.createTmpPos(endInfo.Third));

        // Adjust position to side of bigger ways
        adjustPositionsOnBiggerWays(path, walkPath, startWay, endWay);

        DebugFn.DebugPath(walkPath);

        Vector3 vec1 = walkPath [0];
        Vector3 vec2 = walkPath [1];

        positionHuman(vec1);
        rotateHuman(vec2, vec1);

        walkPath.RemoveAt(0);
    }
Пример #4
0
    public static void DebugPath(List <Pos> path)
    {
        Pos prev = null;

        foreach (Pos pos in path)
        {
            if (prev != null)
            {
                DebugFn.arrow(prev, pos);
            }
            prev = pos;
        }
    }
Пример #5
0
 public static void print(List <DrivePath> drivePaths)
 {
     if (enabled)
     {
         Debug.Log("[");
         DrivePath prev = null;
         foreach (DrivePath curr in drivePaths)
         {
             if (prev == null)
             {
                 DebugFn.print(curr.startVector);
             }
             DebugFn.print(curr.endVector);
             prev = curr;
         }
         Debug.Log("]");
     }
 }
Пример #6
0
    public void reportChange()
    {
        checkObjectives();
        bool haveWon  = checkCombos(winCombos, "win");
        bool haveLost = checkCombos(loseCombos, "lose");

/*		if (haveLost && haveWon) {
 *                      // Won AND lost same frame... do what?
 *          Game.instance.gameEnd("win", this);
 *                      DebugFn.print ("You WON & LOST!");
 *              } else */
        if (haveWon)
        {
            // Won the level!
            Game.instance.gameEnd("win", this);
            DebugFn.print("You WON!");
        }
        else if (haveLost)
        {
            // Won the level!
            Game.instance.gameEnd("lose", this);
            DebugFn.print("You Lost!");
        }
    }
Пример #7
0
 public static void print(Pos pos)
 {
     DebugFn.print(Game.getCameraPosition(pos));
 }
Пример #8
0
 public static void square(Pos pos)
 {
     DebugFn.square(Game.getCameraPosition(pos));
 }