Exemple #1
0
        public void NextForm()
        {
            switch (birdform)
            {
            case BirdFormE.car:
                birdform = BirdFormE.sphere;
                break;

            case BirdFormE.person:
                birdform = BirdFormE.car;
                break;

            case BirdFormE.hummingbird:
                birdform = BirdFormE.person;
                break;

            case BirdFormE.sphere:
                birdform = BirdFormE.longsphere;
                break;

            case BirdFormE.longsphere:
                birdform = BirdFormE.hummingbird;
                break;
            }
        }
Exemple #2
0
 void initValues()
 {
     BirdSpeed     = 0;
     BirdFlyHeight = 1.5f;
     lookaheadtime = 1.1f;
     initBirdSpeed = 1;
     rundist       = 0;
     curpt         = Vector3.zero;
     birdform      = BirdFormE.person;
     birdStopped   = true;
     BirdState     = BirdStateE.dormant;
     //Debug.Log("birdctrl initValues called");
 }
Exemple #3
0
        void initValues()
        {
            BirdVel       = 0;
            BirdFlyHeight = 1.2f;
            lookaheadtime = 1.1f;
            initBirdVel   = 1;
            rundist       = 0;
            curptlc       = Vector3.zero;
            birdform      = BirdFormE.hummingbird;
            BirdState     = BirdStateE.unbuilt;

            //RouteMan.Log("birdctrl initValues called");
        }
Exemple #4
0
        public void DeleteBird()
        {
            if (birdgo != null)
            {
                // need to delete old bird form or it will hang around
                Destroy(birdgo);
                birdgo = null;
                //lastcurptlc = Vector3.zero;
            }
            var lastbirdform = birdform;

            initValues();
            if (lastbirdform != BirdFormE.none)
            {
                // have to do this becaues initValues sets the lastbirdform
                birdform = lastbirdform;
            }
        }
Exemple #5
0
        public void NextForm()
        {
            switch (birdform)
            {
            case BirdFormE.hummingbird:
                birdform = BirdFormE.sphere;
                break;

            case BirdFormE.sphere:
                birdform = BirdFormE.olive;
                break;

            case BirdFormE.olive:
                birdform = BirdFormE.utahteapot;
                break;

            case BirdFormE.utahteapot:
                birdform = BirdFormE.hummingbird;
                break;
            }
        }
Exemple #6
0
        public void CalcJourneyFrames(BirdFormE formfilter, personDetectModeE personDetectMode)
        {
            if (!frameJourneys.Get())
            {
                return;
            }
            var vz       = Vector3.zero;
            int icnt     = 0;
            var journeys = sman.jnman.GetJourneys();

            foreach (Journey jny in journeys)
            {
                if (jny.status == JourneyStatE.WaitingToStart)
                {
                    continue;
                }

                var visible   = false;
                var birdThing = jny.birdctrl.birdform;
                if (birdThing == formfilter)
                {
                    var rendgo = jny.birdctrl.birdformgo;
                    if (formfilter == BirdFormE.person)
                    {
                        //if (showOnlyFlaggedPeople && !jny.person.flagged) continue;
                        rendgo = GetBodyPart(jny.person, personDetectMode);
                        if (rendgo == null)
                        {
                            continue;
                        }
                    }

                    if (!GraphAlgos.GraphUtil.ClipToCameraBox(rendgo, clipdist: maxFrameDist))
                    {
                        continue;
                    }

                    jny.birdrect        = GraphAlgos.GraphUtil.GUIRectWithObject(rendgo);
                    visible             = GraphAlgos.GraphUtil.ClipToScreen(jny.birdrect);
                    visible             = visible && GraphAlgos.GraphUtil.IsInFrontOfMainCamera(rendgo);
                    jny.birdrectvisible = visible;
                    if (visible)
                    {
                        var id    = jny.person.personName;
                        var id2   = jny.person.empStatus.ToString();
                        var model = jny.person.avatarName;
                        if (birdThing == BirdFormE.car)
                        {
                            id  = jny.vehicle.vehicleId;
                            id2 = jny.vehicle.formName;
                        }
                        else
                        {
                            var person = jny.person;
                        }
                        var cmt = jny.birdctrl.birdresourcename + "  journeying";
                        //cmt += " Sc w,h:" + Screen.width + "," + Screen.height;
                        var clr = Color.cyan;
                        if (formfilter == BirdFormE.person)
                        {
                            clr = GetPersColor(jny.person, clr);
                        }
                        var pt      = rendgo.transform.position;
                        var rot     = rendgo.transform.localEulerAngles;
                        var vel     = jny.birdctrl.birdVelVek;
                        var locname = jny.birdctrl.pathweg.link.name;
                        //var thing = (birdThing == BirdFormE.car ? LableClassE.vehicle : LableClassE.person);
                        //AddFoundLabel(thing, model, id, id2, debstr, jny.birdrect, pt, rot, vel, locname, cmt, clr, 2);
                        if (birdThing == BirdFormE.person)
                        {
                            AddFoundLabel(jny.person, jny.birdrect, pt, rot, vel, locname, cmt, clr, 2);
                        }
                        else
                        {
                            AddFoundLabel(jny.vehicle, jny.birdrect, pt, rot, vel, locname, cmt, clr, 2);
                        }
                        icnt++;
                    }
                }
            }
            //Debug.Log("CalcJourneyFrames added " + icnt + " label/frames");
        }
Exemple #7
0
        void CreateBirdFormGos()
        {
            if (birdgoes == null)
            {
                birdgoes                  = new GameObject();
                birdgoes.name             = "Birds";
                birdgoes.transform.parent = sman.rgo.transform;
            }
            if (birdformgo != null)
            {
                Destroy(birdformgo);
                birdformgo = null;
            }
            var curpos = birdgo.transform.position;
            var currot = birdgo.transform.localRotation;

            switch (birdform)
            {
            case BirdFormE.sphere:
            {
                birdformgo = GraphUtil.CreateMarkerSphere("sphere", Vector3.zero, size: 0.3f, clr: "yellow");
                birdformgo.transform.localRotation = currot;
                birdformgo.transform.localPosition = curpos;
                movingAnimationScript  = "";
                restingAnimationScript = "";
                //BirdFlyHeight = 1.5f;
                birdgo.name = "Sphere";
                break;
            }

            case BirdFormE.longsphere:
            {
                birdformgo = GraphUtil.CreateMarkerSphere("sphere", Vector3.zero, size: 0.2f, clr: "yellow");
                var nosept = new Vector3(0, 0, 0.1f);

                var gonose = GraphUtil.CreateMarkerSphere("nose", nosept, size: 0.1f, clr: "red");
                gonose.transform.parent = birdformgo.transform;

                birdformgo.transform.localScale    = new Vector3(0.25f, 0.25f, 0.5f);      // somehow adding the nose made the sphere bigger ??
                birdformgo.transform.localRotation = currot;
                birdformgo.transform.localPosition = curpos;
                movingAnimationScript  = "";
                restingAnimationScript = "";
                //BirdFlyHeight = 1.5f;
                //                        birdformgo.transform.Rotate(90, 0, 0);
                birdgo.name = "Olive";
                break;
            }

            default:
            case BirdFormE.hummingbird:
            {
                var objPrefab = Resources.Load <GameObject>("hummingbird");
                birdformgo = Instantiate <GameObject>(objPrefab) as GameObject;
                var s = 0.5e-3f;
                birdformgo.transform.localScale    = new Vector3(s, s, s);
                birdformgo.transform.localRotation = currot;
                birdformgo.transform.localPosition = curpos;
                movingAnimationScript  = "";
                restingAnimationScript = "";
                //BirdFlyHeight = 1.5f;
                birdgo.name = "Bird";
                break;
            }

            case BirdFormE.person:
            {
                //if (birdresourcename=="")
                //{
                //    birdresourcename = "girl004";
                //}
                birdformgo = person.LoadPersonGo("-ava-bc");
                if (person.hasHololens)
                {
                    person.ActivateHololens(true);
                }
                var s = 1.0f;
                birdformgo.transform.localScale    = new Vector3(s, s, s);
                birdformgo.transform.localRotation = currot;
                //var noise = GraphAlgos.GraphUtil.GetRanFloat(0, 0.6f,"jnygen");
                var newpos = new Vector3(curpos.x + 0.3f, curpos.y - 1.55f, curpos.z);
                birdformgo.transform.localPosition = newpos;
                movingAnimationScript  = "Animations/PersonWalk";
                restingAnimationScript = "Animations/PersonIdle";
                //BirdFlyHeight = 1.5f;
                birdgo.name = birdresourcename;
                if (person)
                {
                    if (person.hasCamera)
                    {
                        person.AddCamera(birdformgo, "BirdCtrl CreateBirdFormGos");
                    }
                    if (person.grabbedMainCamera)
                    {
                        person.GrabMainCamera();
                    }
                }
                break;
            }

            case BirdFormE.car:
            {
                //Debug.Log("Loading car resourcename:" + birdresourcename);
                if (birdresourcename == "")
                {
                    birdresourcename = "car001";
                }
                //var objPrefab = Resources.Load<GameObject>("Cars/"+birdresourcename);
                //birdformgo = Instantiate<GameObject>(objPrefab);
                birdformgo = VehicleMan.LoadCarGo(birdgo, birdresourcename);
                //var s = 1.0f;
                //birdformgo.transform.localScale = new Vector3(s, s, s);
                birdformgo.transform.localRotation = currot;
                var noise  = GraphAlgos.GraphUtil.GetRanFloat(0, 0.5f, "jnygen");
                var newpos = new Vector3(curpos.x + 1.2f + noise, curpos.y - 1.55f, curpos.z);
                birdformgo.transform.localPosition += newpos;
                movingAnimationScript  = "";
                restingAnimationScript = "";
                //BirdFlyHeight = 1.5f;
                birdgo.name = birdresourcename;
                if (person)
                {
                    if (person.hasCamera)
                    {
                        person.AddCamera(birdformgo, "BirdCtrl CreateBirdFormGos");
                    }
                    if (person.grabbedMainCamera)
                    {
                        person.GrabMainCamera();
                    }
                }
                break;
            }
            }
//            birdformgo.transform.parent = birdgo.transform;
            birdformgo.transform.SetParent(birdgo.transform, true);// should be false....

            lastbirdform = birdform;
        }