Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            QueueParams param = new QueueParams(ConfigurationManager.AppSettings.Get("RabbitMQServerIP"), "Xml-Queue");
            QueueObj    Qobj  = QueueObj.GetQueueObj(param);

            Qobj.ConsumeMessages <string>(SomeMethods.MessageProcces, true);
        }
    private void updateQueue(QueueObj queueObj, int newSize, EleDirection?dir)
    {
        int sizeDiff = Mathf.Abs(newSize - queueObj.q.Count);

        if (newSize > queueObj.q.Count)
        {
            for (int i = 0; i < sizeDiff; i++)
            {
                GameObject currCicle = Instantiate(person);
                currCicle.transform.SetParent(this.transform);
                currCicle.SetActive(true);
                currCicle.transform.position = queueObj.offset - Vector3.right * xSpace * queueObj.q.Count;
                PersonScript currCircleScript = currCicle.GetComponent <PersonScript>();
                if (dir == EleDirection.UP)
                {
                    Transform arrowTransform = currCicle.transform.GetChild(0);
                    arrowTransform.gameObject.SetActive(true);
                }
                if (dir == EleDirection.DOWN)
                {
                    Transform arrowTransform = currCicle.transform.GetChild(0);
                    arrowTransform.Rotate(0, 0, 180, Space.Self);
                    arrowTransform.gameObject.SetActive(true);
                }
                queueObj.q.Enqueue(currCicle);
            }
        }
        if (newSize < queueObj.q.Count)
        {
            for (int i = 0; i < sizeDiff; i++)
            {
                lastPerson       = queueObj.q.Peek();
                lastPersonScript = lastPerson.GetComponent <PersonScript>();
                lastPersonScript.animateDestroy();
                //lastPerson.transform.position += xSpace * Vector3.right;
                //lastPerson.transform.SetParent(elevatorObj.transform);
                queueObj.q.Dequeue();
            }

            foreach (GameObject curr in queueObj.q)
            {
                personTransitionList.Add(new GameObjectTransition(curr, curr.transform.position + sizeDiff * Vector3.right * xSpace));
            }
        }
        else
        {
            return;
        }
    }
Ejemplo n.º 3
0
        public void topView2(Node root)
        {
            Queue <QueueObj>             queue      = new Queue <QueueObj>();
            SortedDictionary <int, Node> topViewMap = new SortedDictionary <int, Node>();

            if (root == null)
            {
                return;
            }
            else
            {
                queue.Enqueue(new QueueObj(root, 0));
            }

            // count function returns 1 if the container
            // contains an element whose key is equivalent
            // to hd, or returns zero otherwise.
            while (queue.Count != 0)
            {
                QueueObj tmpNode = queue.Dequeue();

                if (!topViewMap.ContainsKey(tmpNode.hd))
                {
                    topViewMap[tmpNode.hd] = tmpNode.node;
                }

                if (tmpNode.node.left != null)
                {
                    queue.Enqueue(new QueueObj(tmpNode.node.left, tmpNode.hd - 1));
                }
                if (tmpNode.node.right != null)
                {
                    queue.Enqueue(new QueueObj(tmpNode.node.right, tmpNode.hd + 1));
                }
            }

            foreach (var entry in topViewMap.Values)
            {
                Console.Write(entry.data + " ");
            }
        }
    private QueueObj[] initQueue(Vector3 xoffSet)
    {
        RectTransform rtEle = elevatorObj.GetComponent <RectTransform>();

        QueueObj[] q    = new QueueObj[elevatorScript.numFloors];
        Vector3[]  vEle = new Vector3[4];
        rtEle.GetWorldCorners(vEle);

        RectTransform rtPerson = person.GetComponent <RectTransform>();

        Vector3[] vPerson = new Vector3[4];
        rtPerson.GetWorldCorners(vPerson);
        float personWidth = vPerson[2].x - vPerson[1].x;

        float marginBot = 0.03f;

        for (int i = 0; i < elevatorScript.numFloors; i++)
        {
            q[i] = new QueueObj(new Vector3(vEle[0].x, vEle[0].y + personWidth / 2 + marginBot, 0) + Vector3.up * (i * sizeFloor) + xoffSet);
        }
        return(q);
    }
Ejemplo n.º 5
0
        public static void Print(BinaryTreeNode <int> root)
        {
            if (root == null)
            {
                return;
            }

            Queue <QueueObj> queueObjs = new Queue <QueueObj>();

            queueObjs.Enqueue(new QueueObj(root, 0));

            SortedDictionary <int, BinaryTreeNode <int> > topNodes = new SortedDictionary <int, BinaryTreeNode <int> >();

            while (queueObjs.Any())
            {
                QueueObj currentQueueObj = queueObjs.Dequeue();
                if (!topNodes.ContainsKey(currentQueueObj.Hd))
                {
                    topNodes[currentQueueObj.Hd] = currentQueueObj.Node;
                }

                if (currentQueueObj.Node.LeftNode != null)
                {
                    queueObjs.Enqueue(new QueueObj(currentQueueObj.Node.LeftNode, currentQueueObj.Hd - 1));
                }

                if (currentQueueObj.Node.RightNode != null)
                {
                    queueObjs.Enqueue(new QueueObj(currentQueueObj.Node.RightNode, currentQueueObj.Hd + 1));
                }
            }

            foreach (KeyValuePair <int, BinaryTreeNode <int> > item in topNodes)
            {
                Console.Write(item.Value.Data + " ");
            }
        }
Ejemplo n.º 6
0
    public void Add(int length, string primaryText, string secondaryText)
    {
        if (queue == null)
        {
            queue = new List <QueueObj>();
        }
        QueueObj obj = new QueueObj();

        obj.length        = length;
        obj.primaryText   = primaryText;
        obj.secondaryText = secondaryText;

        obj.instance = GameObject.Instantiate(ItemBackground);
        var rt = obj.instance.GetComponent <RectTransform>();

        obj.instance.transform.SetParent(Canvas, false);
        float xPos     = (queue.Any() ? queue.Sum(x => x.length) : 0) * incrementWidth;
        float startPos = -bg.GetComponent <RectTransform>().sizeDelta.x / 2;

        rt.sizeDelta     = new Vector2(length * incrementWidth, height);
        startPos        += rt.sizeDelta.x / 2;
        rt.localPosition = new Vector3(xPos + startPos, 0f);
        obj.instance.transform.Find("Text").GetComponent <RectTransform>().sizeDelta = new Vector2(length * incrementWidth * 10, height * 10);
        obj.instance.transform.Find("Text").GetComponent <Text>().text = primaryText;
        obj.instance.transform.Find("itemBackground").Find("Text").GetComponent <Text>().text = secondaryText;

        //if secondary text obj is smaller than main obj, set width equal (only occurs with length == 1)
        if (obj.instance.transform.Find("itemBackground").GetComponent <RectTransform>().sizeDelta.x > rt.sizeDelta.x)
        {
            obj.instance.transform.Find("itemBackground").GetComponent <RectTransform>().sizeDelta = new Vector2(rt.sizeDelta.x,
                                                                                                                 obj.instance.transform.Find("itemBackground").GetComponent <RectTransform>().sizeDelta.y);
            obj.instance.transform.Find("itemBackground").Find("Text").GetComponent <RectTransform>().sizeDelta =
                obj.instance.transform.Find("itemBackground").GetComponent <RectTransform>().sizeDelta * 10;
        }

        queue.Add(obj);
    }
Ejemplo n.º 7
0
        static void Main(string[] args)
        {
            QueueParams param = new QueueParams(ConfigurationManager.AppSettings.Get("RabbitMQServerIP"), "Xml-Queue");
            QueueObj    Qobj  = QueueObj.GetQueueObj(param);

            string address    = RequestApi.AddressForm(1);
            int    pageAmount = RequestApi.GetPageAmount(address);

            for (int i = 1; i <= pageAmount; i++)
            {
                IEnumerable <string> idList = RequestApi.RequestIdList(address);

                foreach (string id in idList)
                {
                    address = id.AddressForm();
                    XmlDocument xDoc      = RequestApi.HttpRequest(address);
                    string      xmlString = xDoc.OuterXml;
                    Qobj.PublishMessage <string>(xmlString);
                }
                Console.WriteLine($"Выполнена загрузка документов со страницы {i}");
                address = RequestApi.AddressForm(i + 1);
            }
            Console.ReadKey();
        }
    public static void callNextStep()
    {
        string curLine = null;// = inputFile.ReadLine ();
        string[] parsedLine = null;
        bool firstiteration = true;

        while (firstiteration || (curLine != null && parsedLine[0] != "N")) {
            firstiteration = false;
           		curLine = inputFile.ReadLine ();
            if (curLine != null) {

        //            currentMessageNum++;
                parsedLine = curLine.Split ('\t');
                Debug.Log ("CJT LINE="+curLine);
                //Debug.Log ("First item=" +parsedLine[0]);
                switch (parsedLine [1]) {
                    case "MOVE":
                        //Debug.Log ("CJT MESSAGE="+parsedLine [1] + " " + parsedLine [2] + " CJT" + currentMessageNum + " " + parsedLine [3]);
                        //vhmsg.SendVHMsg ("vrExpress", parsedLine [1] + " " + parsedLine [2] + " CJT" + currentMessageNum + " " + parsedLine [3]);
                        //Debug.Log ("Doing movement for "+parsedLine[2]+" doing:"+parsedLine[4]);
                        if (mode == playmodes.random) {
                            doRandomMvmt(parsedLine[2], parsedLine[4]);
                        } else {
                            parseMovement(parsedLine[2], parsedLine[4]);
                        }
                        break;
                    case "SPEAK":
                        //if (parsedLine [1] == actor) {
                            // find the speech tags & display only that text, start listening for enter key or mouse click?
                        //    showtext = findSpeech (parsedLine [3]);
                        //} else {
                            // else send the message to be spoken by the character
                        //Debug.Log ("CJT MESSAGE="+parsedLine [1] + " " + parsedLine [2] + " CJT" + currentMessageNum + " " + parsedLine [3]);

                        CharFuncs who = GlobalObjs.getCharFunc(parsedLine[2]);
                        string saywhat = findSpeech(parsedLine[4]);
                        Debug.Log (who.name+" says: "+saywhat);
                        who.doSpeak (saywhat);
                        if (mode == playmodes.random) {
                            int temp = UnityEngine.Random.Range (0,2);
                            if (temp == 1) {
                                doRandomMvmt(parsedLine[2], parsedLine[4]);
                            }
                        }
                        //vhmsg.SendVHMsg ("vrSpeak", parsedLine [1] + " " + parsedLine [2] + " CJT" + currentMessageNum + " " + parsedLine [3]);
                        //}
                        break;
                    case "BREAK":
                        Debug.Log ("Start Intermission");
                        intermission = true;
                        QueueObj temp = new QueueObj(null, null, new Vector3(0,0,0), QueueObj.actiontype.intermission);
                        inum = temp.msgNum;
                        GlobalObjs.globalQueue.Add(temp);
                        Debug.Log ("Starting inum="+inum);
                        break;
                    case "PRINT":
                        Debug.Log (Time.time);
                        Debug.Log ("Coordinates:");
                        Debug.Log ("Hamlet="+GlobalObjs.Hamlet.transform.position+","+GlobalObjs.Hamlet.transform.rotation);
                        Debug.Log ("Horatio="+GlobalObjs.Horatio.transform.position+","+GlobalObjs.Horatio.transform.rotation);
                        Debug.Log ("GraveDigger="+GlobalObjs.GraveDigger.transform.position+","+GlobalObjs.GraveDigger.transform.rotation);
                        Debug.Log ("GraveDigger2="+GlobalObjs.GraveDiggerTwo.transform.position+","+GlobalObjs.GraveDiggerTwo.transform.rotation);
                        if (GlobalObjs.Hamlet.transform.childCount != 0) {
                            Debug.Log ("Hamlet children=");
                            for (int i=0; i< GlobalObjs.Hamlet.transform.childCount; i++) {
                                Debug.Log (GlobalObjs.Hamlet.transform.GetChild(i).name);
                            }
                            Debug.Log ("End Hamlet children");
                        }
                        if (GlobalObjs.Horatio.transform.childCount != 0) {
                            Debug.Log ("Horatio children=");
                            for (int i=0; i< GlobalObjs.Horatio.transform.childCount; i++) {
                                Debug.Log (GlobalObjs.Horatio.transform.GetChild(i).name);
                            }
                            Debug.Log ("End Horatio children");
                        }
                        if (GlobalObjs.GraveDigger.transform.childCount != 0) {
                            Debug.Log ("GraveDigger children=");
                            for (int i=0; i< GlobalObjs.GraveDigger.transform.childCount; i++) {
                                Debug.Log (GlobalObjs.GraveDigger.transform.GetChild(i).name);
                            }
                            Debug.Log ("End GraveDigger children");
                        }
                        if (GlobalObjs.GraveDiggerTwo.transform.childCount != 0) {
                            Debug.Log ("GraveDiggerTwo children=");
                            for (int i=0; i< GlobalObjs.GraveDiggerTwo.transform.childCount; i++) {
                                Debug.Log (GlobalObjs.GraveDiggerTwo.transform.GetChild(i).name);
                            }
                            Debug.Log ("End GraveDiggerTwo children");
                        }
                        break;
                    default:
                        // bad command, ignore
                    Debug.Log ("Bad command");
                        break;
                }
                //curLine = null;
                //parsedLine = null;
            } else {
                // exit - nothing left to do
                Debug.Log ("CJT MESSAGE=DONE!!");
                inputFile.Close ();
                started = false;
                inputFile = null;
                //currentMessageNum = 0;
               // Application.Quit ();
            }

        } //while (curLine != null && parsedLine[0] != "N");
    }
    void OnGUI()
    {
        if (intermission) {
            // show blue screen for intermission with text
            //GUIStyle newstyle = new GUIStyle();
            //newstyle.normal.background = new Texture2D(Screen.width, Screen.height);
            //GUI.backgroundColor = Color.blue;
            //GUI.Box (new Rect(0,0,Screen.width, Screen.height), "", newstyle);
            if (indexNumber == 1 || indexNumber == 0) {
                GUI.DrawTexture(new Rect(0,0,Screen.width, Screen.height), mytexture, ScaleMode.ScaleToFit, false, 0);
                GUI.Label (new Rect((Screen.width/2) - 130, (Screen.height/2) + 60, Screen.width, 50), "This screen is orange", newstyle);
            } else if (indexNumber == 2) {
                GUI.DrawTexture(new Rect(0,0,Screen.width, Screen.height), mytexture3, ScaleMode.ScaleToFit, false, 0);
                GUI.Label (new Rect((Screen.width/2) - 130, (Screen.height/2) + 60, Screen.width, 50), "This screen is yellow", newstyle);
            } else {
                GUI.DrawTexture(new Rect(0,0,Screen.width, Screen.height), mytexture2, ScaleMode.ScaleToFit, false, 0);
                GUI.Label (new Rect((Screen.width/2) - 120, (Screen.height/2) + 60, Screen.width, 50), "This screen is brown", newstyle);
            }
            GUI.Label (new Rect((Screen.width/2) - 85, (Screen.height/2) - 120, Screen.width, 50), "INTERMISSION", newstyle);

        } else {
            GUI.backgroundColor = mycolor;
            // legend
            GUI.BeginGroup(new Rect(1200, -3, 200, 900));
                GUI.Box (new Rect(0,-3, 200,900), legendBkgrd);

                GUIStyle mystyle = new GUIStyle();
                mystyle.fontSize = 30;
                mystyle.normal.textColor = Color.white;
                GUI.Label (new Rect(20, startx1+20, widthtext*2, heighttext*2), "LEGEND", mystyle);

                GUI.Label (new Rect(startx2, starty, widthtext, heighttext), "Hamlet:");
                GUI.Label(new Rect(startximg2, startyimg,widthimg,heightimg), new GUIContent(hamletT));

                GUI.Label (new Rect(startx2, starty+(spacing*1), widthtext, heighttext), "Horatio:");
                GUI.Label(new Rect(startximg2, startyimg+(spacing*1),widthimg,heightimg), new GUIContent(horatioT));

                GUI.Label (new Rect(startx1, starty, widthtext, heighttext), "GraveDigger 1:");
                GUI.Label(new Rect(startximg1, startyimg,widthimg,heightimg), new GUIContent(gravediggerT));

                GUI.Label (new Rect(startx1, starty+(spacing*1), widthtext, heighttext), "GraveDigger 2:");
                GUI.Label(new Rect(startximg1, startyimg+(spacing*1),widthimg,heightimg), new GUIContent(gravediggertwoT));

                GUI.Label (new Rect(startx1, starty+(spacing*2), widthtext*2, heighttext*2), "--------------------------------------------");

                GUI.Label (new Rect(startx1, starty+30+(spacing*2), widthtext, heighttext), "Shovel:");
                GUI.Label(new Rect(startximg1, startyimg+30+(spacing*2),widthimg,heightimg*2), new GUIContent(shovelT));

                GUI.Label (new Rect(startx1, starty+30+(spacing*2.5f), widthtext, heighttext), "Lantern:");
                GUI.Label(new Rect(startximg1, startyimg+30+(spacing*2.5f),widthimg,heightimg*2), new GUIContent(lanternT));

                GUI.Label (new Rect(startx2, starty+30+(spacing*2), widthtext, heighttext), "Skull 1:");
                GUI.Label(new Rect(startximg2, startyimg+30+(spacing*2),widthimg,heightimg), new GUIContent(skull1T));

                GUI.Label (new Rect(startx2, starty+30+(spacing*2.5f), widthtext, heighttext), "Skull 2:");
                GUI.Label(new Rect(startximg2, startyimg+30+(spacing*2.5f),widthimg,heightimg), new GUIContent(skull2T));

            GUI.EndGroup();
            //GUI.DrawTexture(new Rect(100,60, 50,50), hamletT, ScaleMode.ScaleToFit, true, 0);
            // end legend

            if (started) {
                // show nothing
            } else {
                //txtmuch = GUI.TextField(new Rect(780, 30, 40, 30), txtmuch, 4);
                txtmuchx = GUI.TextField (new Rect(780, 30, 40, 30), txtmuchx, 4);
                txtmuchy = GUI.TextField (new Rect(830, 30, 40, 30), txtmuchy, 4);
                if (GUI.Button(new Rect(500,30,250,30),"Click to Rotate Hamlet")) {
                    float howmuchx;
                    float howmuchy;
                    bool success = float.TryParse(txtmuchx, out howmuchx);
                    success = float.TryParse (txtmuchy, out howmuchy);
                    GlobalObjs.HamletFunc.doRotate(howmuchx, howmuchy, null);
                    Debug.Log("Clicked the button to rotate");
                }
                txtx = GUI.TextField (new Rect(780, 70, 40, 30), txtx, 4);
                txty = GUI.TextField (new Rect(830, 70, 40, 30), txty, 4);
                if (GUI.Button (new Rect(500, 70, 250, 30), "Click to Move Hamlet FWD")) {
                    float x;
                    float y;
                    bool success = float.TryParse (txtx, out x);
                    success = float.TryParse (txty, out y);
                    GlobalObjs.HamletFunc.doWalk(x, y, null, false);
                    Debug.Log ("Clicked the button to walk");
                }
                txtsay = GUI.TextField (new Rect(780, 110, 100, 30), txtsay, 100);
                if (GUI.Button (new Rect(500, 110, 250, 30), "Speak")) {
                    GlobalObjs.HamletFunc.doSpeak(txtsay);
                    Debug.Log ("Said something");
                }
                if (GUI.Button (new Rect(500, 150, 250, 30), "Stop")) {
                    GlobalObjs.HamletFunc.doStopAll();
                    Debug.Log ("Stopped everything");
                }
                txtforward = GUI.TextField (new Rect(780, 190, 100, 30), txtforward, 4);
                if (GUI.Button (new Rect(500, 190, 250, 30), "Move Forward")) {
                    float thisamt;
                    bool success = float.TryParse (txtforward, out thisamt);
                    GlobalObjs.HamletFunc.doForward(thisamt);
                    Debug.Log ("Moved forward "+thisamt);
                }
                if (GUI.Button (new Rect(125, 150, 100, 30), "Pickup")) {
                    Debug.Log ("Pickup");
                    //shrinking = true;
                    GlobalObjs.HamletFunc.doPickup(GlobalObjs.Lantern);//.animation.Play("Shrink");
                }
                if (GUI.Button (new Rect(125, 190, 100, 30), "Putdown")) {
                    Debug.Log ("Putdown");
                    GlobalObjs.HamletFunc.doPutDown(GlobalObjs.Lantern);
                }
                if (GUI.Button (new Rect(125, 230, 100, 30), "Follow")) {
                    Debug.Log ("Following");
                    GlobalObjs.GraveDiggerFunc.doWalk (GlobalObjs.Grave.transform.position.x, GlobalObjs.Grave.transform.position.z, GlobalObjs.Grave, false);
                    GlobalObjs.GraveDiggerTwoFunc.doWalk (GlobalObjs.GraveDigger.transform.position.x, GlobalObjs.GraveDigger.transform.position.z, GlobalObjs.GraveDigger, true);
                }
                if (GUI.Button (new Rect(125, 270, 100, 30), "Point")) {
                    Debug.Log ("Pointing");
                    GlobalObjs.HamletFunc.doPoint (GlobalObjs.Skull1);
                }
                if (GUI.Button(new Rect(125, 310, 100, 30), "Check Visible")) {
                    Debug.Log ("Checking if Grave is visible");
                    GlobalObjs.HamletFunc.moveTo = GlobalObjs.Grave.transform.position;
                    Debug.Log ("Grave="+GlobalObjs.Grave.transform.position+", Hamlet="+GlobalObjs.Hamlet.transform.position);
                    Debug.Log (GlobalObjs.HamletFunc.isVisible());
                }
                if (GUI.Button (new Rect(125, 350, 100, 30), "Look at")) {
                    Debug.Log ("Look at Grave");
                    GlobalObjs.GraveDiggerFunc.doRotate(GlobalObjs.Grave.transform.position.x, GlobalObjs.Grave.transform.position.z, GlobalObjs.Grave);
                }
                if (GUI.Button (new Rect(125, 390, 100, 30), "Intermission")) {
                    Debug.Log ("Start Intermission");
                    intermission = true;
                    QueueObj temp = new QueueObj(null, null, new Vector3(0,0,0), QueueObj.actiontype.intermission);
                    inum = temp.msgNum;
                    GlobalObjs.globalQueue.Add(temp);
                    Debug.Log ("Starting inum="+inum);
                }
                if (GUI.Button (new Rect(125, 470, 100, 30), "Run Short Version")) {
                    runshort = !runshort;
                    Debug.Log ("Run Short="+runshort);
                }
                if (GUI.Button (new Rect(125, 430, 100, 30), "Long Speech")) {
                    Debug.Log ("Saying long message");
                    GlobalObjs.HamletFunc.doSpeak("He hath borne me on his back a thousand times,and now how abhorred in my imagination it is--my gorge rises at it. Here hung those lips that I have kissed I know not how oft.Where be your gibes now? Your gambols, your songs, your flashes of merriment, that were wont to set the table on a roar? No tone now to mock your own grinning? Quite chop-fallen.");
                    Debug.Log ("Done long message");
                }

                //bool useBML = GUI.Toggle(new Rect(500, 30, 100, 30), BML, "Use BML File?");
                if (GUI.Button (new Rect(25, 20, 100, 30), "Start Play")) {
                    Debug.Log ("Starting Play "+Time.time);
                    //RunPlay();
                    starting = true;
                    timer = 0.0f;
                }

                // shows dropdown to choose what to run
                if(GUI.Button(new Rect((dropDownRect.x - 100), dropDownRect.y, dropDownRect.width, 25), ""))
                {
                    if(!show)
                    {
                        show = true;
                    }
                    else
                    {
                        show = false;
                    }
                }
                if(show)
                {
                    scrollViewVector = GUI.BeginScrollView(new Rect((dropDownRect.x - 100), (dropDownRect.y + 25), dropDownRect.width, dropDownRect.height),scrollViewVector,new Rect(0, 0, dropDownRect.width, Mathf.Max(dropDownRect.height, (list.Length*25))));
                    GUI.Box(new Rect(0, 0, dropDownRect.width, Mathf.Max(dropDownRect.height, (list.Length*25))), "");
                    for(int index = 0; index < list.Length; index++)
                    {
                        if(GUI.Button(new Rect(0, (index*25), dropDownRect.height, 25), ""))
                        {
                            show = false;
                            indexNumber = index;
                            Debug.Log("Index="+indexNumber);
                            if (index == 0 || index == 1) {
                                newstyle.normal.background = mytexture;
                                newstyle.normal.textColor = Color.black;
                            } else {
                                newstyle.normal.background = mytexture2;
                                newstyle.normal.textColor = Color.white;
                            }
                        }
                        GUI.Label(new Rect(5, (index*25), dropDownRect.height, 25), list[index]);
                    }
                    GUI.EndScrollView();
                }
                else
                {
                    GUI.Label(new Rect((dropDownRect.x - 95), dropDownRect.y, 300, 25), list[indexNumber]);
                }
            }
        }
    }
Ejemplo n.º 10
0
    public static void callNextStep()
    {
        string curLine = null;// = inputFile.ReadLine ();
        string[] parsedLine = null;
        bool firstiteration = true;

        while (firstiteration || (curLine != null && parsedLine[0] != "N")) {
            firstiteration = false;
           		curLine = inputFile.ReadLine ();
            if (curLine != null) {

        //            currentMessageNum++;
                parsedLine = curLine.Split ('\t');
                Debug.Log ("CJT LINE="+curLine);
                //Debug.Log ("First item=" +parsedLine[0]);
                switch (parsedLine [1]) {
                    case "MOVE":
                        //Debug.Log ("CJT MESSAGE="+parsedLine [1] + " " + parsedLine [2] + " CJT" + currentMessageNum + " " + parsedLine [3]);
                        //vhmsg.SendVHMsg ("vrExpress", parsedLine [1] + " " + parsedLine [2] + " CJT" + currentMessageNum + " " + parsedLine [3]);
                        //Debug.Log ("Doing movement for "+parsedLine[2]+" doing:"+parsedLine[4]);
                        if (mode == playmodes.random) {
                            doRandomMvmt(parsedLine[2], parsedLine[4]);
                        } else {
                            parseMovement(parsedLine[2], parsedLine[4]);
                        }
                        break;
                    case "SPEAK":
                        //if (parsedLine [1] == actor) {
                            // find the speech tags & display only that text, start listening for enter key or mouse click?
                        //    showtext = findSpeech (parsedLine [3]);
                        //} else {
                            // else send the message to be spoken by the character
                        //Debug.Log ("CJT MESSAGE="+parsedLine [1] + " " + parsedLine [2] + " CJT" + currentMessageNum + " " + parsedLine [3]);

                        CharFuncs who = GlobalObjs.getCharFunc(parsedLine[2]);
                        string saywhat = findSpeech(parsedLine[4]);
                        Debug.Log (who.name+" says: "+saywhat);
                        who.doSpeak (saywhat);
                        if (mode == playmodes.random) {
                            int temp = UnityEngine.Random.Range (0,2);
                            if (temp == 1) {
                                doRandomMvmt(parsedLine[2], parsedLine[4]);
                            }
                        }
                        //vhmsg.SendVHMsg ("vrSpeak", parsedLine [1] + " " + parsedLine [2] + " CJT" + currentMessageNum + " " + parsedLine [3]);
                        //}
                        if (mode == playmodes.rules || mode == playmodes.fdg) {
                            // add rule to get everyone to look at the speaker
                            Debug.Log ("Adding Look at Speaker "+who.thisChar.name);
                            foreach (CharFuncs c in GlobalObjs.listOfChars) {
                                if (c.onstage() && c != who) {
                                    c.doRotate(who.thisChar.transform.position.x, who.thisChar.transform.position.z, who.gameObject);
                                }
                            }
                        }
                        break;
                    case "BREAK":
                        Debug.Log ("Start Intermission");
                        intermission = true;
                        QueueObj temp = new QueueObj(null, null, new Vector3(0,0,0), QueueObj.actiontype.intermission);
                        inum = temp.msgNum;
                        GlobalObjs.globalQueue.Add(temp);
                        Debug.Log ("Starting inum="+inum);
                        break;
                    case "PRINT":
                        Debug.Log (Time.time);
                        Debug.Log ("Coordinates:");
                        Debug.Log ("Hamlet="+GlobalObjs.Hamlet.transform.position+","+GlobalObjs.Hamlet.transform.rotation);
                        Debug.Log ("Horatio="+GlobalObjs.Horatio.transform.position+","+GlobalObjs.Horatio.transform.rotation);
                        Debug.Log ("GraveDigger="+GlobalObjs.GraveDigger.transform.position+","+GlobalObjs.GraveDigger.transform.rotation);
                        Debug.Log ("GraveDigger2="+GlobalObjs.GraveDiggerTwo.transform.position+","+GlobalObjs.GraveDiggerTwo.transform.rotation);
                        if (GlobalObjs.Hamlet.transform.childCount != 0) {
                            Debug.Log ("Hamlet children=");
                            for (int i=0; i< GlobalObjs.Hamlet.transform.childCount; i++) {
                                Debug.Log (GlobalObjs.Hamlet.transform.GetChild(i).name);
                            }
                            Debug.Log ("End Hamlet children");
                        }
                        if (GlobalObjs.Horatio.transform.childCount != 0) {
                            Debug.Log ("Horatio children=");
                            for (int i=0; i< GlobalObjs.Horatio.transform.childCount; i++) {
                                Debug.Log (GlobalObjs.Horatio.transform.GetChild(i).name);
                            }
                            Debug.Log ("End Horatio children");
                        }
                        if (GlobalObjs.GraveDigger.transform.childCount != 0) {
                            Debug.Log ("GraveDigger children=");
                            for (int i=0; i< GlobalObjs.GraveDigger.transform.childCount; i++) {
                                Debug.Log (GlobalObjs.GraveDigger.transform.GetChild(i).name);
                            }
                            Debug.Log ("End GraveDigger children");
                        }
                        if (GlobalObjs.GraveDiggerTwo.transform.childCount != 0) {
                            Debug.Log ("GraveDiggerTwo children=");
                            for (int i=0; i< GlobalObjs.GraveDiggerTwo.transform.childCount; i++) {
                                Debug.Log (GlobalObjs.GraveDiggerTwo.transform.GetChild(i).name);
                            }
                            Debug.Log ("End GraveDiggerTwo children");
                        }
                    Debug.Log ("Lantern="+GlobalObjs.Lantern.transform.position+","+GlobalObjs.Lantern.transform.rotation);
                    Debug.Log ("Shovel="+GlobalObjs.Shovel.transform.position+","+GlobalObjs.Shovel.transform.rotation);
                    Debug.Log ("Skull1="+GlobalObjs.Skull1.transform.position+","+GlobalObjs.Skull1.transform.rotation);
                    Debug.Log ("Skull2="+GlobalObjs.Skull2.transform.position+","+GlobalObjs.Skull2.transform.rotation);

                        break;
                    default:
                        // bad command, ignore
                    Debug.Log ("Bad command");
                        break;
                }
                //curLine = null;
                //parsedLine = null;
            } else {
                // exit - nothing left to do
                Debug.Log ("CJT MESSAGE=DONE!!");
                inputFile.Close ();
                started = false;
                inputFile = null;
                //currentMessageNum = 0;
               // Application.Quit ();
            }

        } //while (curLine != null && parsedLine[0] != "N");

        if (mode == playmodes.fdg && movementfound) {
            Debug.Log("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!Forces & movement found");
            movementfound = false;
            Forces.setupForces ();
            Forces.g.printall();
            Forces.recalculate ();
            // apply forces to forcequeue
        //}
        //if (mode == playmodes.fdg) { // does this have to fire if no movement was found??  I say no...???
            // apply all forcequeue items to character funcs
            Forces.unsetupForces();
            Forces.applyChanges();
        }
    }
Ejemplo n.º 11
0
        public void DataInit()
        {
            QueueParams param = new QueueParams("localhost", "Test-Queue");

            Qobj = QueueObj.GetQueueObj(param);
        }
Ejemplo n.º 12
0
    public void doWalk(float x, float y, GameObject towhatobj, bool tofollow)
    {
        // add to global queue
        GlobalObjs.printQueue("Start Walk "+thisChar.name);
        QueueObj temp = new QueueObj(thisChar, towhatobj, (towhatobj == null)?(new Vector3(x, 0, y)):(towhatobj.transform.position), QueueObj.actiontype.move);
        GlobalObjs.globalQueue.Add(temp);
        Debug.Log ("*********************Added "+temp.msgNum+" for "+thisChar.name);
        // do something
        Debug.Log("In doWalk for "+thisChar.name);
        if (moving) {
            // wait & try again when done moving
            Debug.Log ("Already Walking for "+thisChar.name);
            if (towhatobj == null) {
                moveQueue.Enqueue (new miniQueueObj(new Vector3(x, 0, y), null, temp.msgNum, tofollow));
            } else {
                moveQueue.Enqueue (new miniQueueObj(new Vector3(towhatobj.transform.position.x, 0, towhatobj.transform.position.z),towhatobj, temp.msgNum, tofollow));
            }
        } else if (rotating) {
            // wait until done rotating then try again
            Debug.Log ("Rotating, wait to walk for "+thisChar.name);
            if (towhatobj == null) {
                moveQueue.Enqueue (new miniQueueObj(new Vector3(x, 0, y), null, temp.msgNum, tofollow));
            } else {
                moveQueue.Enqueue (new miniQueueObj(new Vector3(towhatobj.transform.position.x, 0, towhatobj.transform.position.z),towhatobj, temp.msgNum, tofollow));
            }
        } else {
            workingNum = temp.msgNum;//temp.msgNum;
            following = tofollow;
            //Debug.Log ("Starting walk with workingnum="+temp.msgNum+ " for "+thisChar.name);
            moving = true;
            Debug.Log ("No queue or rotation occurring for "+thisChar.name);
            if (towhatobj == null) {
                moveToObj = null;
                moveTo = new Vector3(x,0,y);
                if (getAngle(moveTo) == 0) {
                    waitToRotate = false;
                } else {
                    Debug.Log ("Need to rotate first for "+thisChar.name);
                    waitToRotate = true; // need to check if need to rotate first
                    rotating = true;
                    rotateTo = moveTo;
                    rotateToObj = null;
                    rotateDir = getDirection (rotateTo);
                }
                moving = true;

            } else {
                moveToObj = towhatobj;
                moveTo = calculateObjPostn(towhatobj);//new Vector3(towhatobj.transform.position.x, 0, towhatobj.transform.position.z);
                if (getAngle (moveTo) == 0) {
                    waitToRotate = false;
                } else {
                    waitToRotate = true; // need to check if need to rotate first
                    rotating = true;
                    rotateTo = moveTo;
                    rotateToObj = moveToObj;
                    rotateDir = getDirection (rotateTo);
                }
                moving = true;
            }
            Debug.Log ("Starting walk with rotate to " + x + ", "+ y +" with working #="+workingNum+" for "+thisChar.name);
        }
        //Debug.Log ("END Walk with Rotate="+rotating+" Move="+moving+" for "+thisChar.name+" num="+temp.msgNum);
        GlobalObjs.printQueue("End Walk "+thisChar.name);
    }
Ejemplo n.º 13
0
 public void doPickup(GameObject obj)
 {
     // add to global queue
     QueueObj temp = new QueueObj(thisChar, obj, obj.transform.position, QueueObj.actiontype.pickup);
     GlobalObjs.globalQueue.Add(temp);
     workingNum = temp.msgNum;
     //Debug.Log ("Changed working num in doPickup to "+workingNum+ " for "+thisChar.name);
     shrinking = true;
     manipObj = obj;
     pickup = true;
     curscalesize = obj.transform.localScale;
 }
Ejemplo n.º 14
0
    // functions for the character
    public void doRotate(float towherex, float towherey, GameObject towhatobj)
    {
        // add to global queue!!!
        // add to global queue
        GlobalObjs.printQueue("Start Rotate "+thisChar.name);
        //Debug.Log ("Rotate="+rotating+" Move="+moving+" for "+thisChar.name);
        QueueObj temp = new QueueObj(thisChar, towhatobj, (towhatobj == null)?(new Vector3(towherex, 0, towherey)):(towhatobj.transform.position), QueueObj.actiontype.rotate);
        GlobalObjs.globalQueue.Add(temp);

        if (rotating) {
            // wait & try again when done rotating
            Debug.Log ("Already rotating for "+thisChar.name);
            if (towhatobj == null) {
                rotateQueue.Enqueue(new miniQueueObj(new Vector3(towherex, 0, towherey), null, temp.msgNum, false));
            } else {
                rotateQueue.Enqueue (new miniQueueObj(new Vector3(towhatobj.transform.position.x, 0, towhatobj.transform.position.z), towhatobj, temp.msgNum, false));
            }
        } else {
            workingNum = temp.msgNum;
            //Debug.Log ("Changed working num in doRotate to "+workingNum+" for "+thisChar.name);
            rotating = true;

            // set RotateDir as appropriate
            if (towhatobj == null) {
                rotateTo = new Vector3(towherex, 0, towherey);
                rotateToObj = null;
                rotateDir = getDirection (rotateTo);
            } else {
                rotateTo = new Vector3(towhatobj.transform.position.x, 0, towhatobj.transform.position.z);
                rotateToObj = towhatobj;
                rotateDir = getDirection (rotateTo);
            }
            Debug.Log ("Starting rotation to " + towhatobj + " for " + this.name);
        }
        //Debug.Log ("END Rotate with Rotate="+rotating+" Move="+moving+" for "+thisChar.name+" msg="+temp.msgNum);
        GlobalObjs.printQueue("End Rotate "+thisChar.name);
    }
Ejemplo n.º 15
0
 public void doSpeak(string toSay)
 {
     // add to global queue
     QueueObj temp = new QueueObj(thisChar, null, nullVector, QueueObj.actiontype.speak);
     GlobalObjs.globalQueue.Add(temp);
     speakNum = temp.msgNum;
     //speechfunc.showbubble = true;
     saywhat = toSay;
     //Debug.Log ("Said:"+toSay);
     // clean up all ' and " to be /' and /"
     toSay = toSay.Replace("'", "");//"\\'");
     toSay = toSay.Replace ("\"", " ");
     toSay = toSay.ToLower ();
     //Debug.Log ("Cleaned said:"+toSay);
     speaking=true;
     myProcess = System.Diagnostics.Process.Start ("say", "-v "+voice + " \"" + toSay+"\"");
 }
Ejemplo n.º 16
0
 public void doPoint(GameObject target)
 {
     QueueObj temp = new QueueObj(thisChar, target, target.transform.position, QueueObj.actiontype.point);
     GlobalObjs.globalQueue.Add(temp);
     pointnum = temp.msgNum;
     pointing = true;
     pointertimer = 0.0f;
     pointtarget = target;
     Vector3 relativePoint = thisChar.transform.InverseTransformPoint(pointtarget.transform.position);
     if (relativePoint.x < 0.0f) {
         left = true;
     } else {
         left = false;
     }
     Vector3 correctedstart;
     if (!left) {
         correctedstart = thisChar.transform.position + thisChar.transform.right.normalized;
     } else {
         correctedstart = thisChar.transform.position - thisChar.transform.right.normalized;
     }
     Vector3 newstart = new Vector3(correctedstart.x, 3.5f, correctedstart.z);
     Vector3 offset = target.transform.position - newstart;
     //Vector3 scale = new Vector3(0.5f, 2.0f, 0.5f);
     Vector3 position = newstart + (offset / 2.0f);
     GameObject myarm = Instantiate (prefabarm, position, Quaternion.identity) as GameObject;
     arm = myarm;
     myarm.transform.localScale = new Vector3(.5f, 1f, .5f);
     myarm.transform.position = newstart+ offset.normalized;
     myarm.transform.up = offset;
     Debug.Log ("Material name="+armmat.name);
     myarm.renderer.material = armmat;
     // need to attach to character so can move with character
     myarm.transform.parent = thisChar.transform;
     //myarm.transform.localScale = scale;
 }
Ejemplo n.º 17
0
    public void doPutDown()
    {
        // add to global queue
        QueueObj temp = new QueueObj(thisChar, thisChar.transform.GetChild (0).gameObject, thisChar.transform.GetChild (0).gameObject.transform.position, QueueObj.actiontype.putdown);
        GlobalObjs.globalQueue.Add(temp);
        if (thisChar.transform.GetChildCount () == 0) {
            // do nothing since not holding anything
            GlobalObjs.removeOne(temp.msgNum);
        } else {
            workingNum = temp.msgNum;
            //Debug.Log ("Changed working num in doPutDown to "+workingNum+ " for " +thisChar.name);
            shrinking = true;
            // figure out what object we are carrying
            if (thisChar.transform.childCount == 0) {
                // error no children
                Debug.Log ("No object to put down!");
            } else if (thisChar.transform.childCount == 1) {
                if (thisChar.transform.GetChild(0).gameObject.name == "ArmPrefab") {
                    // no children
                    Debug.Log ("Only child is an arm!");
                } else {
                    manipObj = thisChar.transform.GetChild (0).gameObject;
                }
            } else {
                if (thisChar.transform.GetChild (0).gameObject.name == "ArmPrefab") {
                    manipObj = thisChar.transform.GetChild (1).gameObject;
                } else {
                    manipObj = thisChar.transform.GetChild (0).gameObject;
                }
            }

            //manipObj = thisChar.transform.GetChild(0).gameObject;
            pickup = false;
            Vector3 curpostn = manipObj.transform.position;
            Quaternion currot = manipObj.transform.rotation;
            //Debug.Log("manip local="+manipObj.transform.localPosition);
            //Debug.Log ("manip postn="+manipObj.transform.position);
            //Debug.Log ("parent postn="+thisChar.transform.position);
            //Debug.Log ("parent local="+thisChar.transform.localPosition);
            //manipObj.transform.position = thisChar.transform.right.normalized*.35f;//new Vector3(thisChar.transform.position.x+.35f, 0, thisChar.transform.position.z);
            //manipObj.transform.rotation = thisChar.transform.rotation;
        //			thisChar.transform.DetachChildren();
            //Debug.Log("after manip local="+manipObj.transform.localPosition);
            //Debug.Log ("after manip postn="+manipObj.transform.position);
            //Debug.Log ("after parent postn="+thisChar.transform.position);
            //Debug.Log ("after parent local="+thisChar.transform.localPosition);
            manipObj.transform.position = new Vector3(curpostn.x, carrydropheight, curpostn.z);//curpostn;
            //thisChar.transform.right.normalized*.35f;//new Vector3(thisChar.transform.position.x+.35f, 0, thisChar.transform.position.z);
            //manipObj.transform.position.y = carrydropheight;
            manipObj.transform.rotation = currot;//thisChar.transform.rotation;
            curscalesize = manipObj.transform.localScale;

        }
    }
    void Update()
    {
        // skip to next level
        if (Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift))
        {
            if (Input.GetKeyDown(KeyCode.S))
            {
                Debug.Log("CJT MESSAGE=DONE!!");
                InitScript.inputFile.Close();
                QueueObj temp = new QueueObj(null, null, new Vector3(0, 0, 0), QueueObj.actiontype.intermission);
                InitScript.inum = temp.msgNum;
                GlobalObjs.globalQueue.Add(temp);
                InitScript.alldone = true;
//	            started = false;
                InitScript.inputFile = null;
            }
        }

        // exit application
        if (Input.GetKey("escape"))
        {
            Application.Quit();
        }

        // in case character got stuck, use Shift-Q to invoke the stop all function for all characters
        if (Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift))
        {
            if (Input.GetKeyDown(KeyCode.Q))
            {
                foreach (CharFuncs c in GlobalObjs.listOfChars)
                {
                    c.doStopAll();
                }
                Debug.Log("Stopped everything");
            }
        }

        // find any mouse clicks
        if (Input.GetMouseButtonDown(0) && InitScript.c == 0 && InitScript.started)          // if left button pressed & no menu showing...
        // only act upon clicks inside window (not legend or script areas)
        {
            if (Input.mousePosition.x > 1250 || Input.mousePosition.y < Screen.height - 640)               // ignore
            {
            }
            else
            {
                Ray        ray = Camera.main.ScreenPointToRay(Input.mousePosition);
                RaycastHit hit;
                if (Physics.Raycast(ray, out hit))
                {
                    // the object identified by hit.transform was clicked
                    // do whatever you want
                    Debug.Log("Clicked on " + hit.transform.gameObject.name + " type=" + hit.transform.gameObject.tag);
                    InitScript.a       = Input.mousePosition.x;
                    InitScript.b       = Input.mousePosition.y;
                    InitScript.what    = hit.transform.gameObject;
                    InitScript.atwhere = hit.point;
                    switch (hit.transform.gameObject.tag)
                    {
                    case "Pawn":
                        // show menu with go to, point to, look at, pick up OR put down if human holding it
                        // make sure if someone else is holding this pawn we add a put down for that character
                        InitScript.c = 4;
                        if (GlobalObjs.human.transform.GetChildCount() > 0)
                        {
                            if (GlobalObjs.human.transform.GetChildCount() > 1)
                            {
                                if (GlobalObjs.human.transform.GetChild(0).gameObject.name == hit.transform.gameObject.name || GlobalObjs.human.transform.GetChild(1).gameObject.name == hit.transform.gameObject.name)
                                {
                                    InitScript.c = 1;
                                }
                            }
                            else
                            {
                                if (GlobalObjs.human.transform.GetChild(0).gameObject.name == hit.transform.gameObject.name)
                                {
                                    InitScript.c = 1;
                                }
                            }
                        }

                        break;

                    case "Person":
                        // show menu with go to, point to, look at
                        //CharFuncs personfunc = (CharFuncs) hit.transform.GetComponent (typeof(CharFuncs));
                        // if self, don't show any menu unless holding something show put down
                        InitScript.c = 3;                                           //or 1
                        if (hit.transform.gameObject.name == GlobalObjs.human.name) // if click on self, show 0 or 1 if holding
                        {
                            if (GlobalObjs.human.transform.GetChildCount() > 0)
                            {
                                if (GlobalObjs.human.transform.GetChildCount() > 1)
                                {
                                    // has to be pointing and holding something
                                    InitScript.c = 1;
                                    if (GlobalObjs.human.transform.GetChild(0).gameObject.name != "ArmPrefab")
                                    {
                                        InitScript.what = GlobalObjs.human.transform.GetChild(0).gameObject;
                                    }
                                    else
                                    {
                                        InitScript.what = GlobalObjs.human.transform.GetChild(1).gameObject;
                                    }
                                }
                                else
                                {
                                    if (GlobalObjs.human.transform.GetChild(0).gameObject.name != "ArmPrefab")
                                    {
                                        InitScript.c    = 1;
                                        InitScript.what = GlobalObjs.human.transform.GetChild(0).gameObject;
                                    }
                                }
                            }
                            else
                            {
                                InitScript.c = 0;
                            }
                        }
                        break;

                    case "Mark":
                        // show menu with go to, point to, look at
                        InitScript.c = 3;
                        break;

                    case "Floor":
                        // show menu with go to, point to, look at -- hide go to if beyond limits of scene?
                        InitScript.c = 3;                                 // or 2
                        if (hit.point.x > 45 || hit.point.x < -45)
                        {
                            InitScript.c = 2;
                        }
                        else
                        {
                            if (hit.point.z > 60 || hit.point.z < 0)
                            {
                                InitScript.c = 2;
                            }
                        }
                        break;

                    default:
                        // do nothing
                        InitScript.c = 0;
                        break;
                    }
                }
            }
        }
    }
Ejemplo n.º 19
0
    public void doPickup(GameObject obj)
    {
        if (obj.name.ToLower() != "skull1" && obj.name.ToLower() != "skull2" && obj.name.ToLower() != "lantern" && obj.name.ToLower () != "shovel") {
            // not valid command - ignore
        } else {
            // add to global queue
            QueueObj temp = new QueueObj(thisChar, obj, obj.transform.position, QueueObj.actiontype.pickup);
            GlobalObjs.globalQueue.Add(temp);
            if (moving || rotating || shrinking || growing) {
                // wait & try again when done moving
                Debug.Log ("Already doing something for "+thisChar.name);
                putInMiniQueue(-1, -1, obj, temp.msgNum, false, miniQueueObj.actiontype.pickup);
            } else {
                rotateToObj = null;
                workingNum = temp.msgNum;
                //Debug.Log ("Changed working num in doPickup to "+workingNum+ " for "+thisChar.name);
                shrinking = true;
                manipObj = obj;
                pickup = true;
                curscalesize = obj.transform.localScale;
                switch (thisChar.transform.childCount) {
                    case 0:
                        break;
                    case 1:
                        if (thisChar.transform.GetChild (0).gameObject.name != "ArmPrefab") {
                            extraObj = thisChar.transform.GetChild (0).gameObject;
                        }
                        break;
                    case 2:
                        if (thisChar.transform.GetChild (0).gameObject.name != "ArmPrefab") {
                            extraObj = thisChar.transform.GetChild (0).gameObject;
                        } else if (thisChar.transform.GetChild (1).gameObject.name != "ArmPrefab") {
                            extraObj = thisChar.transform.GetChild (1).gameObject;
                        }
                        break;
                    default:
                        Debug.Log ("ERROR - too many children");
                        break;

                }
            }
        }
    }
Ejemplo n.º 20
0
    public void doPutDown(GameObject obj)
    {
        // add to global queue
        QueueObj temp = new QueueObj(thisChar, obj, obj.transform.position, QueueObj.actiontype.putdown);
        GlobalObjs.globalQueue.Add(temp);
        if (moving || rotating || shrinking || growing) {
            // wait & try again when done moving
            Debug.Log ("Already doing something for "+thisChar.name);
            putInMiniQueue(-1, -1, obj, temp.msgNum, false, miniQueueObj.actiontype.putdown);
        } else {
            rotateToObj = null;
            if (thisChar.transform.GetChildCount () == 0) {
                // do nothing since not holding anything
                GlobalObjs.removeOne(temp.msgNum);
            } else {

                // figure out what object we are carrying
                if (thisChar.transform.childCount == 1) {
                    if (thisChar.transform.GetChild(0).gameObject.name == "ArmPrefab") {
                        // no children
                        Debug.Log ("Only child is an arm!");
                        GlobalObjs.removeOne(temp.msgNum);
                    } else {
                        if (thisChar.transform.GetChild (0).gameObject.name == obj.name) {
                            workingNum = temp.msgNum;
                            //Debug.Log ("Changed working num in doPutDown to "+workingNum+ " for " +thisChar.name);
                            shrinking = true;
                            manipObj = thisChar.transform.GetChild (0).gameObject;
                        } else {
                            // don't have the object right now
                            GlobalObjs.removeOne(temp.msgNum);
                        }
                    }
                } else {
                    // assume if there is two, one is definitely the object to putdown
                    workingNum = temp.msgNum;
                    //Debug.Log ("Changed working num in doPutDown to "+workingNum+ " for " +thisChar.name);
                    shrinking = true;
                    if (thisChar.transform.GetChild (0).gameObject.name == "ArmPrefab") {
                        if (thisChar.transform.GetChild (1).gameObject.name == obj.name) {
                            manipObj = thisChar.transform.GetChild (1).gameObject;
                        } else {
                            shrinking = false;
                            GlobalObjs.removeOne(temp.msgNum); // don't have the right object
                        }
                    } else {
                        if (thisChar.transform.GetChild (0).gameObject.name == obj.name) {
                            manipObj = thisChar.transform.GetChild (0).gameObject;
                        } else {
                            shrinking = false;
                            GlobalObjs.removeOne(temp.msgNum); // don't have right object
                        }
                    }
                }

                //manipObj = thisChar.transform.GetChild(0).gameObject;
                pickup = false;
                if (manipObj != null) {
                    Vector3 curpostn = manipObj.transform.position;
                    Quaternion currot = manipObj.transform.rotation;
                    //manipObj.transform.position = new Vector3(curpostn.x, carrydropheight, curpostn.z);//curpostn;

                    manipObj.transform.rotation = currot;//thisChar.transform.rotation;
                    curscalesize = manipObj.transform.localScale;
                }

            }
        }
    }
Ejemplo n.º 21
0
    public void doSpeak(string toSay)
    {
        // add to global queue
        QueueObj temp = new QueueObj(thisChar, null, nullVector, QueueObj.actiontype.speak);
        GlobalObjs.globalQueue.Add(temp);
        speakNum = temp.msgNum;
        //speechfunc.showbubble = true;
        saywhat = toSay;
        //Debug.Log ("Said:"+toSay);
        // clean up all ' and " to be /' and /"
        toSay = toSay.Replace("'", "");//"\\'");
        toSay = toSay.Replace ("\"", " ");
        toSay = toSay.ToLower ();
        //Debug.Log ("Cleaned said:"+toSay);
        speaking=true;
        myProcess = System.Diagnostics.Process.Start ("say", "-v "+voice + " \"" + toSay+"\"");

        /*if (InitScript.mode == InitScript.playmodes.rules) {
            // get everyone else that is onstage to look at this person
            Debug.Log ("Adding everyone look at "+thisChar.name);
            foreach(CharFuncs a in GlobalObjs.listOfChars) {
        //			for(CharFuncs a : GlobalObjs.listOfChars) {
                if (a.onstage()) {
                    a.doRotate(thisChar.transform.position.x, thisChar.transform.position.z, thisChar);
                }
            }
        }*/
    }
Ejemplo n.º 22
0
    public void doWalk(float x, float y, GameObject towhatobj, bool tofollow)
    {
        // add to global queue
        GlobalObjs.printQueue("Start Walk "+thisChar.name);
        QueueObj temp = new QueueObj(thisChar, towhatobj, (towhatobj == null)?(new Vector3(x, 0, y)):(towhatobj.transform.position), QueueObj.actiontype.move);
        GlobalObjs.globalQueue.Add(temp);
        Debug.Log ("*********************Added "+temp.msgNum+" for "+thisChar.name);
        // do something
        Debug.Log("In doWalk for "+thisChar.name);
        if (moving || rotating || shrinking || growing) {
            // wait & try again when done moving
            Debug.Log ("Already doing something for "+thisChar.name);
            putInMiniQueue(x, y, towhatobj, temp.msgNum, tofollow, miniQueueObj.actiontype.move);
        } else {
            rotateToObj = null;
            workingNum = temp.msgNum;
            moving = true;
            following = tofollow;
            if (towhatobj == null) {
                moveToObj = null;
                moveTo = new Vector3(x, 0, y);
                moveToObjFunc = null;
            } else {
                moveToObj = towhatobj;
                moveTo = calculateObjPostn(towhatobj);
                if (tofollow) {
                    moveToObjFunc = (CharFuncs)moveToObj.GetComponent(typeof(CharFuncs));
                    moveToObjFunc.beingfollowed = true;
                } else {
                    moveToObjFunc = null;
                }
            }
            Debug.Log ("Starting walk to " + towhatobj + " for " + this.name);
        }

        GlobalObjs.printQueue("End Walk "+thisChar.name);
    }