コード例 #1
0
    public void AssignARModel(GameObject obj)
    {
        ARModel model = obj.AddComponent <ARModel>();

        model.ModelTexture = this;
        ARModel            = model;
    }
コード例 #2
0
 public override void Action(ARModel model)
 {
     transform.LookAt(Enemy.transform);
     rotation = transform.eulerAngles;
     if (_shieldObj == null)
     {
         if (GetComponentInChildren <Shield>() != null)
         {
             var shield = GetComponentInChildren <Shield>();
             shield.enabled = true;
             shield.Reset();
             var obj = GetComponentInChildren <Shield>().gameObject;
             if (obj != null)
             {
                 _shieldObj = obj;
             }
         }
     }
     if (Input.GetKeyDown(keyCode))
     {
         //Debug.Log(keyCode + " : ペンデュラム : " + Enemy.transform.name);
         if (_shieldObj == null)
         {
             return;
         }
         _shieldObj.GetComponent <Shield>().PushOn();
     }
     //if (Input.GetKey(keyCode))
     //{
     //transform.Rotate(5.0f, 0.0f, 0.0f);
     //}
 }
コード例 #3
0
        public void ARModelPredict()
        {
            var ar1 = new ARModel(0, new double[] { 0.5 });
            var X   = new double[] {
                1,
                1,
                1.0 * 0.5,
                1.0 * 0.5 * 0.5,
                1.0 * 0.5 * 0.5 * 0.5,
                1.0 * 0.5 * 0.5 * 0.5 * 0.5,
            };

            for (int i = 0; i < X.Length - 1; i++)
            {
                Assert.AreEqual(X[i + 1], ar1.Predict(X[i]));
            }

            var ar2 = new ARModel(0, new double[] { 0.3, 0.3 });

            X = new double[] {
                1,
                1,
                1,
                0.6,
                0.48,
                0.324,
                0.2412,
                0.16956,
            };

            for (int i = 0; i < X.Length - 1; i++)
            {
                IsWithinThreshold(X[i + 1], ar2.Predict(X[i]));
            }
        }
コード例 #4
0
ファイル: Artifacts.cs プロジェクト: berkona/SharpBCI
        public void DetectModelChange()
        {
            // change underlying model and see if it adapts
            var model    = new ARModel(0, new double[] { 0.5 });
            var detector = new TournamentArtifactDetector(3, 1000, 1, 1);
            var r        = new Random(12345);
            var last     = 10 * r.NextDouble();

            // extra 2 to ensure underlying ARArtifactDetector is primed
            for (int i = 0; i < 1002; i++)
            {
                Assert.False(detector.Detect(last));
                last = model.Predict(last) + 10 * r.NextDouble();
            }

            model = new ARModel(100, new double[] { 0.5 });
            for (int i = 0; i < 1000; i++)
            {
                detector.Detect(last);
                last = model.Predict(last) + 10 * r.NextDouble();
            }

            for (int i = 0; i < 100; i++)
            {
                Assert.False(detector.Detect(last));
                last = model.Predict(last) + 10 * r.NextDouble();
            }
        }
コード例 #5
0
ファイル: Pendulum.cs プロジェクト: ooHIROoo/Imagine2016
 public override void Action(ARModel model)
 {
     transform.LookAt(Enemy.transform);
     rotation = transform.eulerAngles;
     if (_shieldObj == null)
     {
         if (GetComponentInChildren<Shield>() != null)
         {
             var shield = GetComponentInChildren<Shield>();
             shield.enabled = true;
             shield.Reset();
             var obj = GetComponentInChildren<Shield>().gameObject;
             if (obj != null) { _shieldObj = obj; }
         }
     }
     if (Input.GetKeyDown(keyCode))
     {
         //Debug.Log(keyCode + " : ペンデュラム : " + Enemy.transform.name);
         if (_shieldObj == null) { return; }
         _shieldObj.GetComponent<Shield>().PushOn();
     }
     //if (Input.GetKey(keyCode))
     //{
         //transform.Rotate(5.0f, 0.0f, 0.0f);
     //}
 }
コード例 #6
0
 /* Add model to scene */
 private void Add(ARModel model)
 {
     ModelsInScene.Add(model);
     model.transform.SetParent(transform);
     model.gameObject.SetActive(true);
     Debug.Log($"\nmodel added with scale {model.transform.localScale}\n");
     SelectedModel = model;
 }
コード例 #7
0
    // TIPS: マーカーを規定数、認識できているかどうか
    bool EnableUpdate(ARModel model)
    {
        var enable = (_models.Count < _existsCount);

        if (enable)
        {
            enable = _arSystem.isExistMarker(model.id);
        }
        return(enable);
    }
コード例 #8
0
    void Shot(ARModel player, ARModel target)
    {
        var shot = Instantiate(_shot);

        shot.transform.position = player.transform.position + shot.offset;
        shot.transform.Translate(shot.transform.forward * 50f);
        shot.target   = target.transform;
        shot.listener = (player == _device.player1 ? (System.Action)ShotHitP1 : ShotHitP2);
        _audio.Play(20);
    }
コード例 #9
0
 /// <summary>
 /// <para>Converts an ARModel entity to its corresponding View Model.</para>
 /// <para>The following rules should always hold true:</para>
 /// <code>
 ///		model.Promotion == promotion.Id
 ///		<br></br>
 ///		promotion.Sponsor == sponsor.Id
 /// </code>
 /// </summary>
 /// <param name="model"></param>
 /// <param name="promotion"></param>
 /// <param name="sponsor"></param>
 /// <returns></returns>
 public static ARModelViewModel ToViewModel(this ARModel model, Promotion promotion, Sponsor sponsor)
 {
     return(new ARModelViewModel
     {
         Id = model.Id,
         Name = model.Name,
         FileName = model.FileName,
         Promotion = promotion?.ToViewModel(sponsor) ?? null,
         Cost = model.Cost
     });
 }
コード例 #10
0
 /// <summary>
 /// <para>Converts an Anchor entity to its corresponding View Model.</para>
 /// <para>The following rules should always hold true:</para>
 /// <code>
 ///		anchor.CreatedBy == user.Id
 ///		<br></br>
 ///		anchor.Model == model.Id
 ///		<br></br>
 ///		anchor.Promotion == promotion.Id
 ///		<br></br>
 ///		promotion.Sponsor == sponsor.Id
 /// </code>
 /// </summary>
 /// <param name="anchor"></param>
 /// <param name="user"></param>
 /// <param name="model"></param>
 /// <param name="promotion"></param>
 /// <param name="sponsor"></param>
 /// <returns></returns>
 public static AnchorViewModel ToViewModel(this Anchor anchor, User user, ARModel model, Promotion promotion, Sponsor sponsor)
 {
     return(new AnchorViewModel
     {
         Id = anchor.Id,
         Model = model?.ToViewModel(promotion, sponsor) ?? null,
         Location = anchor.Location,
         CreatedBy = user?.ToViewModelPublic() ?? null,
         CreatedAt = anchor.CreatedAt,
         LikedBy = anchor.LikedBy
     });
 }
コード例 #11
0
ファイル: Barrage.cs プロジェクト: ooHIROoo/Imagine2016
    int Barragebutton(ARModel model)
    {
        if (_timeCount.time <= 1) return 0;
        if (model.inputKey())
        {
            _audioPlayer.Play(20, false);
            StartCoroutine(BulletCreate(_waitTime));
            return 1;
        }

        return 0;
    }
コード例 #12
0
    public override void Action(ARModel model)
    {
        // もういらない
        //Vector3 myRotate = transform.eulerAngles;
        //transform.LookAt(Enemy.transform);
        //rotation = transform.eulerAngles;
        //transform.eulerAngles = myRotate;

        if (_startCount.countFinish)
        {
            _keyCount += Barragebutton(model);
        }
    }
コード例 #13
0
ファイル: Barrage.cs プロジェクト: ooHIROoo/Imagine2016
    public override void Action(ARModel model)
    {
        // もういらない
        //Vector3 myRotate = transform.eulerAngles;
        //transform.LookAt(Enemy.transform);
        //rotation = transform.eulerAngles;
        //transform.eulerAngles = myRotate;

        if (_startCount.countFinish)
        {
            _keyCount += Barragebutton(model);
        }
    }
コード例 #14
0
ファイル: Artifacts.cs プロジェクト: berkona/SharpBCI
        public void DetectNormal()
        {
            var generator  = new ARModel(0, new double[] { 1 });
            var arDetector = new ARArtifactDetector(generator);

            double last = 1.0;

            for (int i = 0; i < 1000; i++)
            {
                var next = generator.Predict(last);
                Assert.False(arDetector.Detect(next));
                last = next;
            }
        }
コード例 #15
0
    //Add event listeners to buttons
    void Awake()
    {
        if (BackButton != null)
        {
            BackButton.AddEventListener("onclick", () => {
                App.MoveTo(App.ProductPage);
                ARScene.Clear();
            });
        }
        if (HomeButton != null)
        {
            HomeButton.AddEventListener("onclick", () => {
                App.MoveToCollections(true);
                ARScene.Clear();
            });
        }
        AddButton.AddEventListener("onclick", () => {
            App.MoveToCollections(true);
        });

        Reset.AddEventListener("onclick", () => {
            ARScene.Reset();
        });

        Info.AddEventListener("onclick", () => {
            ARToolPanel.ARProductInfo.Build(ARScene.ModelTexturesInScene);
            ARToolPanel.ARProductInfo.SetScrollPosition("top");
            ARToolPanel.ARProductInfo.OnSelect = (model) => {
                Variant v        = model.GetParent <Variant>();
                ARToolPanel.Mode = ARTool.Hidden;
                App.MoveToInfo(v);
            };
            ARToolPanel.Mode = ARTool.ProductInfo;
        });

        Help.AddEventListener("onclick", () => {
            ARToolPanel.Mode = ARTool.Help;
        });

        Color.AddEventListener("onclick", () => {
            ARModel toReplace = ARScene.SelectedModel;
            ARToolPanel.ARColorPicker.Build(ARScene.SelectedModelTexture);
            ARToolPanel.ARColorPicker.SetScrollPosition("top");
            ARToolPanel.ARColorPicker.OnSelect = (model) => {
                ARScene.AddModel(model, toReplace);
            };
            ARToolPanel.Mode = ARTool.ColorPicker;
        });
    }
コード例 #16
0
    int Barragebutton(ARModel model)
    {
        if (_timeCount.time <= 1)
        {
            return(0);
        }
        if (model.inputKey())
        {
            _audioPlayer.Play(20, false);
            StartCoroutine(BulletCreate(_waitTime));
            return(1);
        }

        return(0);
    }
コード例 #17
0
    //make a new model
    private ARModel newModel(ModelTexture mtex)
    {
        if (Contains(mtex))
        {
            GameObject obj   = Instantiate(library[mtex]);
            ARModel    model = obj.AddComponent <ARModel>();
            model.ModelTexture = mtex;

            Model parent = mtex.GetParent <Model>();
            model.baseScale = model.baseScale * parent.Scale;
            model.AddColliders();
            return(model);
        }
        return(null);
    }
コード例 #18
0
    public override void Action(ARModel model)
    {
        transform.LookAt(Enemy.transform);
        if (Input.GetKeyDown(keyCode))
        {
            Debug.Log(keyCode + " : ゲーム01テスト : " + Enemy.transform.name);

            var obj   = Instantiate(bulletObj);
            var value = Enemy.transform.position - transform.position;
            obj.transform.position  = transform.position;
            obj.transform.position += value.normalized;
            obj.GetComponent <BulletShot>()._vectorValue = value.normalized;
            obj.GetComponent <BulletShot>()._parent      = gameObject;
        }
        //if (Input.GetKey(keyCode)) {
        //    transform.Rotate(5.0f, 0.0f, 0.0f);
        //}
    }
コード例 #19
0
ファイル: GameTest1.cs プロジェクト: ooHIROoo/Imagine2016
    public override void Action(ARModel model)
    {
        transform.LookAt(Enemy.transform);
        if (Input.GetKeyDown(keyCode))
        {
            Debug.Log(keyCode + " : ゲーム01テスト : " + Enemy.transform.name);

            var obj = Instantiate(bulletObj);
            var value = Enemy.transform.position - transform.position;
            obj.transform.position = transform.position;
            obj.transform.position += value.normalized;
            obj.GetComponent<BulletShot>()._vectorValue = value.normalized;
            obj.GetComponent<BulletShot>()._parent = gameObject;
        }
        //if (Input.GetKey(keyCode)) {
        //    transform.Rotate(5.0f, 0.0f, 0.0f);
        //}
    }
コード例 #20
0
ファイル: Artifacts.cs プロジェクト: berkona/SharpBCI
        public void DetectArtifact()
        {
            var model    = new ARModel(0, new double[] { 0.5 });
            var detector = new TournamentArtifactDetector(1, 1000, 1, 1);
            var r        = new Random(12345);
            var last     = 10 * r.NextDouble();

            // extra 2 to ensure underlying ARArtifactDetector is primed
            for (int i = 0; i < 1002; i++)
            {
                Assert.False(detector.Detect(last));
                last = model.Predict(last) + 10 * r.NextDouble();
            }

            // high-amplitude artifact for 100 samples
            for (int i = 0; i < 100; i++)
            {
                Assert.True(detector.Detect(last + 1000));
            }
        }
コード例 #21
0
ファイル: Artifacts.cs プロジェクト: berkona/SharpBCI
        public void DetectNormal()
        {
            var model    = new ARModel(0, new double[] { 0.5 });
            var detector = new TournamentArtifactDetector(1, 1000, 1, 100);
            var r        = new Random(12345);
            var last     = r.NextDouble();

            // prime detector
            for (int i = 0; i < 1005; i++)
            {
                detector.Detect(last);
                last = model.Predict(last) + r.NextDouble();
            }

            //last = model.Predict(last) + r.NextDouble();
            for (int i = 0; i < 10; i++)
            {
                Assert.False(detector.Detect(last));
                last = model.Predict(last) + r.NextDouble();
            }
        }
コード例 #22
0
    /* Remove model from scene */
    public void Remove(ARModel model)
    {
        if (!Contains(model))
        {
            return;               //Model not in this scene
        }
        if (SelectedModel == model)
        {
            SelectedModel = null;
        }

        //Last of type remove from memory
        ModelTexture dmt = model.ModelTexture;

        ModelsInScene.Remove(model);
        Destroy(model.gameObject);

        if (!ContainsModelTexture(dmt))
        {
            Assets.RemoveModel(dmt);
        }
    }
コード例 #23
0
    /* PlaceModel, places a new ARModel into the scene at the origin pose
     * or replaces a given ARModel.
     *
     * @param modelTexture, the modelTexture who's ARModel is to be added
     *                      and place into the scene
     *
     * @param model*, optional a given ARModel to replace.
     */
    private void PlaceModel(ARModel model, ARModel replace = null)
    {
        //model texture does not have an ARModel
        if (model == null)
        {
            Debug.Log("\nARScene: new model made was null\n");
            return;
        }

        if (replace == null)
        {
            Debug.Log("\nARScene: new model set to pose of origin\n");
            model.Pose      = PointOfView; //Place at origin pose
            model.yRotation = 180;         //Rotate to face user
        }
        else
        {
            Debug.Log("\nARScene: new model set to pose of other model\n");
            model.Pose = replace.Pose; //Place at given models pose
            Remove(replace);           //Remove model being replaced
        }
        Add(model);                    //Add new model to scene
    }
コード例 #24
0
    public bool SelectModel(Vector2 touch)
    {
        if (camera == null)
        {
            return(false);
        }

        Ray        ray = camera.ScreenPointToRay(touch);
        RaycastHit hit;

        if (Physics.Raycast(ray, out hit))
        {
            // no collider hit
            if (hit.collider == null || hit.collider.gameObject == null)
            {
                return(false);
            }

            // get ARModel of collider
            Transform trans = hit.collider.gameObject.transform;
            while (trans != null)
            {
                ARModel model = trans.gameObject.GetComponent <ARModel>();
                if (model != null)
                {
                    offset_plane  = new Plane(Vector3.up, new Vector3(0, hit.point.y, 0));
                    point_offset  = (model.position - hit.point) / model.size;
                    SelectedModel = model;
                    drag_start    = true;
                    return(true);
                }
                trans = trans.parent;
            }
        }
        //No model hit, return current selected model.
        return(false);
    }
コード例 #25
0
    public async void AddModel(ModelTexture modelTexture, ARModel replace = null, int depth = 0)
    {
        if (modelTexture == null || adding)
        {
            return;
        }
        adding = true;

        //Select loader tool and show loading
        ARToolPanel.Mode = ARTool.Loader;
        showLoading();

        while (App.moving)
        {
            await Task.Yield();
        }
        ARView.LockIcons(true);
        ARSession.matchFrameRate = true;

        if (!PlaneIcon.planeSelected && !PlaneIcon.On)
        {
            PlaneIcon.On = true;
        }

        //get model
        Assets.OnProgress = (f) => { ARLoader.Progress = (int)Mathf.Round(f * 100); };
        ARModel model = await Assets.GetModel(modelTexture);

        //error occured display error
        if (model == null)
        {
            //memory at capacity
            if (Assets.memoryLimitFlag)
            {
                //show promt for 4 seconds
                showMemoryLimit(depth);
                await Task.Delay(3500);

                //model to be deleted, or back navigation
                int count = ModelsInScene.Count;

                //Hide tools to allow delete
                if (count != 0)
                {
                    ARToolPanel.Mode = ARTool.Hidden;
                }

                while (count == ModelsInScene.Count && App.cPage == ARView.gameObject && adding)
                {
                    await Task.Yield();
                }

                if (!adding)
                {
                    return;
                }

                // we are still in ar view then add the model again
                if (App.cPage == ARView.gameObject)
                {
                    adding = false;
                    AddModel(modelTexture, replace, depth + 1);
                    return;
                }

                //loading error
            }
            else
            {
                showError();
            }
            adding = false;
            return;
        }

        //Wait for plane selection
        await planeSelector();

        // place model, and hide tool panel and unlock icons
        PlaceModel(model, replace);
        adding = false;

        //Hide loader
        if (firstAdd)
        {
            ARToolPanel.Mode = ARTool.Help;
            firstAdd         = false;
        }
        else
        {
            ARToolPanel.Mode = ARTool.Hidden;
        }
        CIcon.Mode = CenterIcon.Screenshot;
        ARToolPanel.AlignBottom = false;

        //unlock icons
        ARView.LockIcons(false);
    }
コード例 #26
0
 void ModelReset(ARModel model)
 {
     model.transform.position = Vector3.back * 100f;
     model.isVisible = false;
 }
コード例 #27
0
 // TIPS: マーカーを規定数、認識できているかどうか
 bool EnableUpdate(ARModel model)
 {
     var enable = (_models.Count < _existsCount);
     if (enable) { enable = _arSystem.isExistMarker(model.id); }
     return enable;
 }
コード例 #28
0
    /**
     * Initialization code.
     *
     * Set up distances and origin points.
     */
    void Start()
    {
        controller = GetComponent <CharacterController>();

        // Adjust the collider size to fit a fish
        controller.height = colliderHeight;
        controller.radius = colliderRadius;

        model = this.GetComponent <ARModel>();
        cam   = Camera.main;

        float   componentMaxDistance = maxDistance / 2;
        float   x          = Random.Range(-componentMaxDistance, componentMaxDistance);
        float   y          = Random.Range(0, componentMaxDistance * 2);
        float   z          = Random.Range(-componentMaxDistance, componentMaxDistance);
        Vector3 startPoint = origin + new Vector3(x, y, z);

        transform.Translate(startPoint);
        centerPoint = origin;

        affected = gameObject.name.Contains("affected");

        //  ------------------------ Set up GUI ----------------------------------- \\
        // Create affected button
        GUIButton isAffected = new GUIButton();

        isAffected.SetText("Yes");
        isAffected.SetBox(new Box()
                          .SetMarginTop("auto")
                          .SetMarginRight(0.01f)
                          .SetMarginLeft("auto")
                          .SetMarginBottom(0.01f)
                          .SetWidth(Screen.width * 0.2 + "px")
                          .SetHeight(0.4f));

        isAffected.OnClick(this.IThinkItsAffected);

        // Create not affected button
        GUIButton isNotAffected = new GUIButton();

        isNotAffected.SetText("No");
        isNotAffected.SetBox(new Box()
                             .SetMarginTop("auto")
                             .SetMarginRight("auto")
                             .SetMarginLeft(0.01f)
                             .SetMarginBottom(0.01f)
                             .SetWidth(Screen.width * 0.2 + "px")
                             .SetHeight(0.4f));


        isNotAffected.OnClick(this.IThinkItsNotAffected);

        GUIFactory factory = new GUIFactory();

        factory.CreateLabel("Has this fish been affected by oil?")
        .SetBox(new Box()
                .SetMarginBottom(0.1f)
                .SetMarginTop(0.6f)
                .SetMarginLeft(0.1f)
                .SetMarginRight(0.1f))
        .Append(isAffected)
        .Append(isNotAffected);


        gui = factory.Build();

        // -------------------- Look closely GUI Set up ----------------------------------- \\
        // Create Confirm button
        GUIButton confirm = new GUIButton();

        confirm.SetText("Okay");
        confirm.SetBox(new Box()
                       .SetMarginTop("auto")
                       .SetMarginRight(0.01f)
                       .SetMarginLeft("auto")
                       .SetMarginBottom(0.01f)
                       .SetWidth(Screen.width * 0.2 + "px")
                       .SetHeight(0.4f));

        confirm.OnClick(this.Confirm);

        GUIFactory lookCloselyGUIFactory = new GUIFactory();

        GUIComponent gc = lookCloselyGUIFactory.CreateLabel("Look closely! Fish affected by pollution will have splotches of oil across their scales.")
                          .SetBox(new Box()
                                  .SetMarginBottom(0.1f)
                                  .SetMarginTop(0.6f)
                                  .SetMarginLeft(0.1f)
                                  .SetMarginRight(0.1f));

        GUILabel gl = (GUILabel)gc;
        GUIStyle gs = GUIStyles.GetInstance().DEFAULT_WHITE_STYLE;

        gs.wordWrap = true;
        gl.SetStyle(gs);
        gc.Append(confirm);


        lookCloselyGUI = lookCloselyGUIFactory.Build();

        // --------------------- alreadyExaminedGUI -------------------------------------- \\
        // Create Confirm button
        GUIButton confirmAlreadyExamined = new GUIButton();

        confirmAlreadyExamined.SetText("Okay");
        confirmAlreadyExamined.SetBox(new Box()
                                      .SetMarginTop("auto")
                                      .SetMarginRight(0.01f)
                                      .SetMarginLeft("auto")
                                      .SetMarginBottom(0.01f)
                                      .SetWidth(Screen.width * 0.2 + "px")
                                      .SetHeight(0.4f));

        confirmAlreadyExamined.OnClick(this.ConfirmAlreadyExamined);

        GUIFactory alreadyExaminedGUIFactory = new GUIFactory();

        alreadyExaminedGUIFactory.CreateLabel("You have already examined this fish.")
        .SetBox(new Box()
                .SetMarginBottom(0.1f)
                .SetMarginTop(0.6f)
                .SetMarginLeft(0.1f)
                .SetMarginRight(0.1f))
        .Append(confirmAlreadyExamined);


        alreadyExaminedGUI = alreadyExaminedGUIFactory.Build();
    }
コード例 #29
0
 //これを書いとかないとウザイ
 public override void Action(ARModel model)
 {
 }
コード例 #30
0
ファイル: GameManager.cs プロジェクト: ooHIROoo/Imagine2016
 void Shot(ARModel player, ARModel target)
 {
     var shot = Instantiate(_shot);
     shot.transform.position = player.transform.position + shot.offset;
     shot.transform.Translate(shot.transform.forward * 50f);
     shot.target = target.transform;
     shot.listener = (player == _device.player1 ? (System.Action)ShotHitP1 : ShotHitP2);
     _audio.Play(20);
 }
    /**
     * Initialization code.
     *
     * Set up distances and origin points.
     */
    void Start()
    {
        controller = GetComponent<CharacterController>();

        // Adjust the collider size to fit a fish
        controller.height = colliderHeight;
        controller.radius = colliderRadius;

        model = this.GetComponent<ARModel>();
        cam = Camera.main;

        float componentMaxDistance = maxDistance / 2;
        float x = Random.Range(-componentMaxDistance, componentMaxDistance);
        float y = Random.Range(0, componentMaxDistance * 2);
        float z = Random.Range(-componentMaxDistance, componentMaxDistance);
        Vector3 startPoint = origin + new Vector3(x, y, z);

        transform.Translate(startPoint);
        centerPoint = origin;

        affected = gameObject.name.Contains("affected");

        //  ------------------------ Set up GUI ----------------------------------- \\
        // Create affected button
        GUIButton isAffected = new GUIButton ();
        isAffected.SetText("Yes");
        isAffected.SetBox (new Box()
            .SetMarginTop("auto")
            .SetMarginRight(0.01f)
            .SetMarginLeft("auto")
            .SetMarginBottom(0.01f)
            .SetWidth(Screen.width * 0.2 + "px")
            .SetHeight (0.4f));

        isAffected.OnClick (this.IThinkItsAffected);

        // Create not affected button
        GUIButton isNotAffected = new GUIButton ();
        isNotAffected.SetText("No");
        isNotAffected.SetBox (new Box()
            .SetMarginTop("auto")
            .SetMarginRight("auto")
            .SetMarginLeft(0.01f)
            .SetMarginBottom(0.01f)
            .SetWidth(Screen.width * 0.2 + "px")
            .SetHeight (0.4f));

        isNotAffected.OnClick (this.IThinkItsNotAffected);

        GUIFactory factory = new GUIFactory ();

        factory.CreateLabel ("Has this fish been affected by oil?")
            .SetBox(new Box()
                .SetMarginBottom(0.1f)
                .SetMarginTop(0.6f)
                .SetMarginLeft(0.1f)
                .SetMarginRight(0.1f))
                        .Append(isAffected)
                        .Append(isNotAffected);

        gui = factory.Build ();

        // -------------------- Look closely GUI Set up ----------------------------------- \\
        // Create Confirm button
        GUIButton confirm = new GUIButton ();
        confirm.SetText("Okay");
        confirm.SetBox (new Box()
                           .SetMarginTop("auto")
                           .SetMarginRight(0.01f)
                           .SetMarginLeft("auto")
                           .SetMarginBottom(0.01f)
                           .SetWidth(Screen.width * 0.2 + "px")
                           .SetHeight (0.4f));

        confirm.OnClick (this.Confirm);

        GUIFactory lookCloselyGUIFactory = new GUIFactory ();

        GUIComponent gc = lookCloselyGUIFactory.CreateLabel ("Look closely! Fish affected by pollution will have splotches of oil across their scales.")
            .SetBox (new Box ()
                    .SetMarginBottom (0.1f)
                    .SetMarginTop (0.6f)
                    .SetMarginLeft (0.1f)
                     .SetMarginRight (0.1f));

        GUILabel gl = (GUILabel)gc;
        GUIStyle gs = GUIStyles.GetInstance ().DEFAULT_WHITE_STYLE;
        gs.wordWrap = true;
        gl.SetStyle (gs);
        gc.Append (confirm);

        lookCloselyGUI = lookCloselyGUIFactory.Build ();

        // --------------------- alreadyExaminedGUI -------------------------------------- \\
        // Create Confirm button
        GUIButton confirmAlreadyExamined = new GUIButton ();
        confirmAlreadyExamined.SetText("Okay");
        confirmAlreadyExamined.SetBox (new Box()
                           .SetMarginTop("auto")
                           .SetMarginRight(0.01f)
                           .SetMarginLeft("auto")
                           .SetMarginBottom(0.01f)
                           .SetWidth(Screen.width * 0.2 + "px")
                           .SetHeight (0.4f));

        confirmAlreadyExamined.OnClick (this.ConfirmAlreadyExamined);

        GUIFactory alreadyExaminedGUIFactory = new GUIFactory ();

        alreadyExaminedGUIFactory.CreateLabel ("You have already examined this fish.")
            .SetBox (new Box ()
                     .SetMarginBottom (0.1f)
                     .SetMarginTop (0.6f)
                     .SetMarginLeft (0.1f)
                     .SetMarginRight (0.1f))
                .Append (confirmAlreadyExamined);

        alreadyExaminedGUI = alreadyExaminedGUIFactory.Build ();
    }
コード例 #32
0
 // TIPS: 派生クラスで必ず実装してください
 public abstract void Action(ARModel model);
コード例 #33
0
ファイル: ChargePlayer.cs プロジェクト: ooHIROoo/Imagine2016
 //これを書いとかないとウザイ
 public override void Action(ARModel model)
 {
 }
コード例 #34
0
 void ModelReset(ARModel model)
 {
     model.transform.position = Vector3.back * 100f;
     model.isVisible          = false;
 }
コード例 #35
0
    // /* planeManagerEnabled, enables or disables the ARPlaneManager.
    // */
    // public bool planeManagerEnabled {
    //   get {return ARPlaneManager.enabled;}
    //   set {
    //     if (value != ARPlaneManager.enabled)
    //       ARPlaneManager.enabled = value;
    //   }
    // }

    /* Contains, returns true if an ar model is contained within the scene.
     */
    public bool Contains(ARModel model)
    {
        return(ModelsInScene.Contains(model));
    }
コード例 #36
0
ファイル: ActionManager.cs プロジェクト: ooHIROoo/Imagine2016
 // TIPS: 派生クラスで必ず実装してください
 public abstract void Action(ARModel model);