Beispiel #1
0
 public void to(_Location other)
 {
     this.pos = other.pos;
     this.rot = other.rot;
 }
Beispiel #2
0
 public _Location(_Location other)
 {
     this.pos = other.pos;
     this.rot = other.rot;
 }
 public static _Location EditCost(_Location loc, int cost, string costType)
 {
     loc.cost     = cost;
     loc.costType = (CostType)Enum.Parse(typeof(CostType), costType);
     return(loc);
 }
Beispiel #4
0
    public void process(string s)
    {
        stack = new Stack <_Location>();
        _Location last = new _Location();
        _Location curr = new _Location();

        int i = 0;

        foreach (char c in s)
        {
            switch (c)
            {
            case _LSystem.CLOCKKK:
                curr.clockkk(angle);
                break;

            case _LSystem.COUNTERCLOCKKK:
                curr.counterclockkk(angle);
                break;

            case _LSystem.PITCHUP:
                curr.pitchup(angle);
                break;

            case _LSystem.PITCHDOWN:
                curr.pitchdown(angle);
                break;

            case _LSystem.ROLLLEFT:
                curr.rollleft(angle);
                break;

            case _LSystem.ROLLRIGHT:
                curr.rollright(angle);
                break;

            case _LSystem.TURNAROUND:
                curr.turnaround();
                break;

            case _LSystem.PUSH:
                stack.Push(new _Location(curr));
                break;

            case _LSystem.POP:
                curr = stack.Pop();
                break;

            case _LSystem.COLOR:
                if (i + 1 < s.Length)
                {
                    int color_num = int.Parse(s.Substring(i + 1, 1));
                    curr.color = get_color(color_num);
                }
                break;

            default:

                Gizmos.color = curr.color;
                Gizmos.DrawLine(last.pos, curr.pos);

                last.to(curr);
                curr.move(dist);
                break;
            }
            i++;
        }
    }
 public static _Location EditCost(_Location loc, int cost, CostType costType)
 {
     loc.cost     = cost;
     loc.costType = costType;
     return(loc);
 }