コード例 #1
0
 public void DrawObstacle(Canvas mapCanvas)
 {
     mapCanvas.DrawPath(obstacle, PaintManager.GetPainter("Obstacle"));
     mapCanvas.DrawText("Max :" + maxDisplay, 225, 25, PaintManager.GetPainter("Stat"));
     mapCanvas.DrawText("Min :" + minDisplay, 325, 25, PaintManager.GetPainter("Stat"));
     mapCanvas.DrawText("Moyenne :" + averageDisplay, 425, 25, PaintManager.GetPainter("Stat"));
 }
コード例 #2
0
 public void ChangeTile(PaintManager paintManager)
 {
     if (paintManager.Painting && paintManager.CurrentTileType != Declarations.TileType.Unknown && paintManager.CurrentTileType != Type)
     {
         Type = paintManager.CurrentTileType;
     }
 }
コード例 #3
0
    void Start()
    {
        // Set up SerializableModel's
        sModels = ScriptableObject.CreateInstance <SerializeModels>();
        sModels.Init();
        sModels.prefabs[0] = modelPrefab;

        sPaintStrokes = ScriptableObject.CreateInstance <SerializePaintStrokes>();
        sPaintStrokes.Init();

        sPeople = ScriptableObject.CreateInstance <SerializePeople>();
        sPeople.Init();

        InitUI();

        currentMapId    = "";
        mappingStarted  = false;
        hasLocalized    = false;
        mPNPlaneManager = GameObject.FindWithTag("PNPlaneManager").GetComponent <PlacenoteARGeneratePlane>();

        Input.location.Start();

        mSession = UnityARSessionNativeInterface.GetARSessionNativeInterface();
        StartARKit();
        FeaturesVisualizer.EnablePointcloud();
        LibPlacenote.Instance.RegisterListener(this);

        paintManager                 = GameObject.FindWithTag("PaintManager").GetComponent <PaintManager>();
        ARPlanePaintingStatus        = mPlaneDetectionToggle.GetComponent <Toggle>().isOn;
        paintManager.ARPlanePainting = ARPlanePaintingStatus;
        paintManager.paintOnTouch    = !ARPlanePaintingStatus; // TODO: make an enum to replace multiple bools
    }
コード例 #4
0
    void Start()
    {
        PlayerStats.DocumentsDepositedCount--;

        GetComponent <Button>().onClick.AddListener(() => {
            _conditionsMet = PaintManager.CheckAllFields();
            if (_conditionsMet)
            {
                if (PlayerStats.DocumentsDepositedCount > 0)
                {
                    PlayerStats.DocumentsDepositedCount--;
                    PaintManager.ClearAllFields();
                    GameObject.Find("Contract").GetComponent <ContractInitiator>().GenerateNew();
                }
                else
                {
                    FadeManager.FadeOut(this, () => {
                        SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex + 1);
                    });
                }
            }
            else
            {
                SoundManager.Play(this, "error", Vector3.zero, 0.2f);
                StartCoroutine(WarnAWhile());
            }
        });
    }
コード例 #5
0
ファイル: VMIBrush.cs プロジェクト: jama1017/FlowAR
    // Use this for initialization
    protected override void Start()
    {
        base.Start();

        int tmpLeftID = -1;

        // Set some initializing work
        if (leftMaterialID < 0 && targetMat != null)
        {
            // It means insert new material
            if (hand_l != null)
            {
                PaintManager pm = hand_l.GetComponent <PaintManager>();
                if (pm != null)
                {
                    tmpLeftID = pm.AddALineMaterial(targetMat);
                }
            }
        }
        else
        {
            Debug.LogError("A brush virtual menu item has invalid left hand parameters");
            return;
        }

        // Check right hand
        if (rightMaterialID < 0)
        {
            // Mean automatic right hand material
            // If left hand is available, use the same ID
            if (leftMaterialID >= 0)
            {
                rightMaterialID = leftMaterialID;
            }
            else if (targetMat != null)
            {
                if (hand_r != null)
                {
                    PaintManager pm = hand_r.GetComponent <PaintManager>();
                    if (pm != null)
                    {
                        rightMaterialID = pm.AddALineMaterial(targetMat);
                    }
                }
            }
            else
            {
                // Error
                Debug.LogError("A brush virtual menu item has invalid right hand parameters");
                return;
            }
        }

        if (leftMaterialID < 0 && tmpLeftID >= 0)
        {
            leftMaterialID = tmpLeftID;
        }

        itemAvailable = true;
    }
コード例 #6
0
        public async Task <ActionResult> Get()
        {
            var colors = (await PaintManager.GetAllAsync <Paint>())
                         .Select(Mapper.Map <Paint, PaintResponseModel>)
                         .OrderBy(x => x.Name).ToArray();

            return(Json(colors, AllowGet));
        }
コード例 #7
0
    public void Init()
    {
        infoList = new List <PaintStrokeInfo>();
        objList  = new List <PaintStroke>();
        jsonKey  = "paintstrokes";

        paintManager = GameObject.FindWithTag("PaintManager").GetComponent <PaintManager>();
    }
コード例 #8
0
ファイル: PaintManager.cs プロジェクト: hainam125/Painter
 private void Awake()
 {
     Instance      = this;
     paintMaterial = new Material(texturePaint);
     maskMaterial  = new Material(texturePaint);
     command       = new CommandBuffer();
     command.name  = "CommandBuffer - " + gameObject.name;
 }
コード例 #9
0
 void Awake()
 {
     if (instance)
     {
         Debug.Log("There are two PaintManagers");
         return;
     }
     instance = this;
 }
コード例 #10
0
 void Awake()
 {
     if (instance != null)
     {
         Destroy(this);
     }
     instance  = this;
     curAmount = maxAmount;
     CanPaint  = true;
 }
コード例 #11
0
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     else
     {
         Destroy(this);
     }
 }
コード例 #12
0
 private void Start()
 {
     maxAllowedSizeChange = 1.3f;
     touchIsOverUI        = false;
     hitGrid                   = false;
     paintManager              = GameObject.FindWithTag("PaintManager").GetComponent <PaintManager>();
     paintTarget               = GameObject.FindWithTag("PaintTarget");
     PaintingPlane             = GameObject.FindWithTag("CamPaintingPlane");
     localPlaneTransformValues = new TransformValues();
     localPlaneTransformValues.TransferValues(PaintingPlane.transform);
 }
コード例 #13
0
ファイル: HandManager.cs プロジェクト: jasonta/Portalble
    // Use this for initialization
    void Start()
    {
        dataManager    = GameObject.Find("gDataManager").GetComponent <DataManager> ();
        gestureManager = this.GetComponent <GestureControl> ();
        paintManager   = this.GetComponent <PaintManager> ();
        palm           = this.transform.GetChild(5).gameObject;
        grabHolder     = this.transform.GetChild(5).GetChild(0).gameObject;
        thumbFinger    = this.transform.GetChild(0).GetChild(2).gameObject;
        indexFinger    = this.transform.GetChild(1).GetChild(2).gameObject;

        indexFingerPos  = new Vector3[10];
        thumbFingerPos  = new Vector3[10];
        pIndexFingerPos = Vector3.zero;
        pThumbFingerPos = Vector3.zero;

        _handThrowingPowerMultiplier = dataManager.handThrowingPowerMultiplier;

        context_buff = new int[context_buff_len];
        context_dict.Add(0, "object");
        context_dict.Add(1, "paint");
        context_dict.Add(2, "menu");
        context_dict.Add(3, "brush");

        // Get menus
        if (GameObject.Find("FurnitureMenu") != null)
        {
            m_furnitureMenu = GameObject.Find("FurnitureMenu").GetComponent <VirtualFurnitureMenu>();
            m_paintMenu     = GameObject.Find("PaintMenu").GetComponent <VirtualPaintMenu>();
            m_brushMenu     = GameObject.Find("strokeMatMenu").GetComponent <VirtualMenuBrush>();

            m_furnitureMenu.close();
            m_paintMenu.close();
            m_brushMenu.close();
        }

        /*initial all user-defined settings*/
        DataManager data_mngr = GameObject.Find("gDataManager").GetComponent <DataManager> ();

        palm_collider_delay = data_mngr.getPalmColliderDelay();
        palm.GetComponent <Rigidbody> ().maxAngularVelocity = 0;

        //use for disable UI for photo
        //smallMenu = GameObject.Find("GameControlPanel");
        //smallMenu.SetActive (false);

        // register new motion
        if (HandActionRecog.getInstance() != null && HandActionRecog.getInstance().BeginMotion("OpenMenu"))
        {
            HandActionRecog.getInstance().DefineTransform("palm|pinch|undefined", "palm|pinch|undefined", Vector3.up, -Vector3.up, 1.0f);
            HandActionRecog.getInstance().DefineTransform("palm|pinch|undefined", "palm|pinch|undefined", -Vector3.up, Vector3.up, 1.0f);
            HandActionRecog.getInstance().EndMotion();
        }
    }
コード例 #14
0
    void Update()
    {
        if (_lastPenCount != PlayerStats.PenCount)
        {
            DisplayPens(PlayerStats.PenCount);
        }
        if (_lastPaintUsed != PaintManager.PaintUsed())
        {
            DecreaseInc();
        }

        _lastPaintUsed = PaintManager.PaintUsed();
        _lastPenCount  = PlayerStats.PenCount;
    }
コード例 #15
0
    // Use this for initialization
    void Start()
    {
        Input.location.Start();

        mMapListPanel.SetActive(false);

        mSession = UnityARSessionNativeInterface.GetARSessionNativeInterface();
        UnityARSessionNativeInterface.ARFrameUpdatedEvent += ARFrameUpdated;
        StartARKit();
        FeaturesVisualizer.EnablePointcloud();
        LibPlacenote.Instance.RegisterListener(this);

        GameObject pmgo = GameObject.FindWithTag("PaintManager");

        paintManager = pmgo.GetComponent <PaintManager>();
    }
コード例 #16
0
        public void DrawFrame(Canvas mapCanvas)
        {
            mapCanvas.DrawColor(Color.MistyRose);
            mapCanvas.DrawArc(screen.DemiCercle, 180, 180, false, PaintManager.GetPainter("Circle"));
            mapCanvas.DrawLine(5, 444, 805, 444, PaintManager.GetPainter("Frame"));
            foreach (RectF arc in screen.DistanceCircles)
            {
                mapCanvas.DrawArc(arc, 180, 180, false, PaintManager.GetPainter("Frame"));
            }

            mapCanvas.DrawLine(405, 444, 405, 44, PaintManager.GetPainter("Frame"));
            mapCanvas.DrawLine(405, 444, screen.Angles[0], screen.Angles[1], PaintManager.GetPainter("Frame"));
            mapCanvas.DrawLine(405, 444, screen.Angles[2], screen.Angles[3], PaintManager.GetPainter("Frame"));
            mapCanvas.DrawLine(405, 444, screen.Angles[4], screen.Angles[5], PaintManager.GetPainter("Frame"));
            mapCanvas.DrawLine(405, 444, screen.Angles[6], screen.Angles[7], PaintManager.GetPainter("Frame"));
        }
コード例 #17
0
 private void LooeadDependencies(string sceneName)
 {
     if (sceneName == "Level")
     {
         BuildManager = FindObjectOfType <BuildManager>();
         MapGenerator = FindObjectOfType <MapGenerator>();
         SpawnManager = FindObjectOfType <SpawnManager>();
         UIManager    = FindObjectOfType <UIManager>();
     }
     else if (sceneName == "MainMenu")
     {
         MainMenu = FindObjectOfType <MainMenu>();
     }
     else if (sceneName == "LevelCreator")
     {
         MapGenerator = FindObjectOfType <MapGenerator>();
         PaintManager = FindObjectOfType <PaintManager>();
         LevelCreator = FindObjectOfType <LevelCreator>();
     }
 }
コード例 #18
0
    void Start()
    {
        isJoystickTouched = false;
        //if (singleJoystickBackgroundImage.GetComponent<ColorJoystick>() == null)
        //{
        //    Debug.LogError("There is no joystick attached to this script.");
        //}
        //else
        //{
        //    colorJoystick = singleJoystickBackgroundImage.GetComponent<ColorJoystick>(); // gets the single joystick script
        //    singleJoystickBackgroundImage.enabled = singleJoyStickAlwaysVisible; // sets single joystick background image to be always visible or not
        //}
        joystick      = GameObject.FindWithTag("ColorJoystick");
        colorJoystick = joystick.GetComponent <ColorJoystick>();
        paintManager  = GameObject.FindWithTag("PaintManager").GetComponent <PaintManager>();
        scaleVector   = new Vector3(scaleFactor, scaleFactor, scaleFactor);

        if (colorJoystick == null)
        {
            Debug.LogError("There is no joystick attached to this script.");
        }
        else
        {
            colorJoystick.GetComponent <ColorJoystick>();                        // gets the color joystick script
            singleJoystickBackgroundImage.enabled = singleJoyStickAlwaysVisible; // sets single joystick background image to be always visible or not
        }

        if (colorJoystick.transform.GetChild(0).GetComponent <Image>() == null)
        {
            Debug.LogError("There is no joystick handle (knob) attached to this script.");
        }
        else
        {
            singleJoystickHandleImage         = colorJoystick.transform.GetChild(0).GetComponent <Image>(); // gets the handle (knob) image of the single joystick
            singleJoystickHandleImage.enabled = singleJoyStickAlwaysVisible;                                // sets single joystick handle (knob) image to be always visible or not
        }
        initialPosition = joystick.transform.localPosition;
        shift           = (200f * scaleFactor) * 0.5f - 100f; // assuming button width = 200
    }
コード例 #19
0
    void Awake()
    {
        if (Instance == null)
        {
            Instance = this;
        }
        else if (Instance != this)
        {
            Destroy(gameObject);
        }

        //initiating board with black
        var v = new Hex();

        boardGO     = new GameObject("Board");
        boardGO.tag = "Board";
        for (int i = -size; i <= size; i++)
        {
            for (int j = -size; j <= size; j++)
            {
                if (i + j <= size && -i - j <= size)
                {
                    v.q      = i;
                    v.r      = j;
                    board[v] = Paint.Empty;
                    Instantiate(slotPrefab, CenterPosAtHex(v, center), Quaternion.Euler(0, 0, 30), boardGO.transform);
                    var          paintGO = Instantiate(paintPrefab, CenterPosAtHex(v, center), Quaternion.Euler(0, 0, 0), boardGO.transform);
                    PaintManager manager = paintGO.GetComponent <PaintManager>();
                    if (manager == null)
                    {
                        Debug.Log("Board manager: cannot update board at " + v + ". Missing paint manager");
                    }
                    graphic[v]      = manager;
                    manager.OnBoard = true;
                }
            }
        }
    }
コード例 #20
0
ファイル: PaintManager.cs プロジェクト: TanYikai/Colour-Shift
    // Use this for initialization
    void Start()
    {
        instance = this;

        //Sample
        pushColor(new ColourObject(true, false, false));
        pushColor(new ColourObject(false, false, true));
        pushColor(new ColourObject(true, false, true));
        pushColor(new ColourObject(false, true, false));
        pushColor(new ColourObject(true, false, false));

        //GameObject barZero = GameObject.Find("Stack 0");
        //GameObject barOne = GameObject.Find("Stack 1");
        //GameObject barTwo = GameObject.Find("Stack 2");
        //GameObject barThree = GameObject.Find("Stack 3");
        //GameObject barFour = GameObject.Find("Stack 4");

        //bars.Add(barZero);
        //bars.Add(barOne);
        //bars.Add(barTwo);
        //bars.Add(barThree);
        //bars.Add(barFour);
    }
コード例 #21
0
    void Start()
    {
        // 線に必要な情報を取得

        isDraw = true;
        touch = new Touch();
        inputPos = Vector3.zero;

        lineManager = FindObjectOfType(typeof(PaintManager)) as PaintManager;
        line = GetComponent<LineRenderer>();
        var component = gameObject.GetComponent<LineRenderer>();
        var color = lineManager.lineColor;
        var offset = lineManager.lineCount;
        var width = lineManager.lineWidth;

        // 線の情報を設定
        component.renderer.material.color = color;
        gameObject.renderer.sortingOrder = offset;
        line.SetWidth(width, width);
        line.renderer.sortingLayerName = "Line";
        line.renderer.sortingOrder = offset;

        campusSize = lineManager.campusSize;
        campusOffSet = lineManager.campusOffSet;

        if (Input.touchCount > 0)
        {
            touchID = Input.touchCount;
            touch = Input.GetTouch(touchID - 1);
            oldInputPos = touch.position;
        }
        else
        {
            oldInputPos = Input.mousePosition;
        }
    }
コード例 #22
0
 void Start()
 {
     colorWheelRectTransform = colorWheel.GetComponent <RectTransform>();
     paintManager            = GameObject.FindWithTag("PaintManager").GetComponent <PaintManager>();
     CreateTapGesture();
 }
コード例 #23
0
 private void Start()
 {
     paintManager = FindObjectOfType <PaintManager>();
 }
コード例 #24
0
 private void Start()
 {
     paintManager = PaintManager.paintManagerInstance;
 }
コード例 #25
0
 public float CompareFields()
 {
     //Compares init field against m_field. If you want to compare the field against other, then just use the static PaintManager function.
     return(PaintManager.CompareFields(m_field_matrix, m_init_field_matrix));
 }
コード例 #26
0
    void Update()
    {
        //float fill = focusTime - timer;
        focusDial.fillAmount = 1;

        if (DetectFocus())
        {
            focusDial.enabled = false;

            timer += Time.unscaledDeltaTime;

            if (isDialShown)
            {
                focusDial.enabled = true;
                //bug in 5.40, setting float crashes app in android
                focusDial.fillAmount = focusTime - timer;                //timer / focusTime;
            }

            if (timer > 0.5f && !isDialShown)
            {
                isDialShown = true;
                timer       = 0f;
            }
        }
        else
        {
            timer = 0;
            focusDial.fillAmount = 1;
            focusDial.enabled    = false;
            //isDialShown = false;
        }
        if (timer > focusTime)
        {
            isFocused            = true;
            focusDial.fillAmount = 0;
            //	isDialShown = false;
        }
        else
        {
            isFocused = false;
            //	isDialShown = false;
        }

        camDir = cam.transform.rotation * Vector3.forward;

        Ray ray = new Ray(cam.transform.position, cam.transform.rotation * Vector3.forward);

        RaycastHit hit;

        //In order to start this focus on area for a few seconds
        if (Physics.Raycast(ray, out hit, 20, layerMaskDraw))
        {
            if (camDir == currentLookHit)
            {
                return;
            }
            else
            {
                currentLookHit = camDir;
            }

            PointInSurface = hit.point - (Vector3.forward * 0.001f);
            //	focusDialCanvas.transform.position = PointInSurface; new
            focusDial.transform.position = PointInSurface;

            isMovingSlow = DetectMovingSlow();
            if (!isMovingSlow)
            {
                isDialShown = false;
                timer       = 0;
            }
            if (!isFocused || !isMovingSlow)
            {
                //
                return;
            }


            //	if (DetectNotMoving ())
            //		timer = 0;

            //	if (!hit.transform.CompareTag ("Paint"))//!DetectNotMoving())//

            PaintOn(PointInSurface, curColor);
        }
        else if (Physics.Raycast(ray, out hit, 20, layerMaskDrawTool))
        {
            Vector3 PointInSurface = hit.point - (Vector3.forward * 0.001f);
            //focusDialCanvas.transform.position = PointInSurface; new
            focusDial.transform.position = PointInSurface;

            isMovingSlow = DetectMovingSlow();
            if (!isMovingSlow)
            {
                isDialShown = false;
                timer       = 0;
            }
            if (!isFocused || !isMovingSlow)
            {
                //isDialShown = false;
                return;
            }

            string typeOfTool = hit.transform.GetComponent <PaintTool> ().ToolType;

            if (string.Equals(typeOfTool, "Undo", System.StringComparison.CurrentCultureIgnoreCase))
            {
                timer = 0;

                for (int i = 0; i < amountToUndo; i++)
                {
                    Stack <Transform> sta = PaintManager.GetCurrentStack();

                    Transform despawnPrefab = sta.Pop() as Transform;
                    despawnPrefab.gameObject.SetActive(false);
                }
            }
            else if (string.Equals(typeOfTool, "Red", System.StringComparison.CurrentCultureIgnoreCase))
            {
//				isColorChaged = !isColorChaged;

//				if (isColorChaged) {
                curColor = Color.red;
                previewImageColor.color = curColor;
                timer = 0;


//				} //else {
                //curCollor = Color.black;
                //timer = 0;
                //}
            }
            else if (string.Equals(typeOfTool, "Blue", System.StringComparison.CurrentCultureIgnoreCase))
            {
//				isColorChaged = !isColorChaged;

//				if (isColorChaged) {
                curColor = Color.blue;
                previewImageColor.color = curColor;
                timer = 0;
//				} //else {
                //curCollor = Color.black;
                //timer = 0;
                //}
            }
            else if (string.Equals(typeOfTool, "Black", System.StringComparison.CurrentCultureIgnoreCase))
            {
//				isColorChaged = !isColorChaged;
//
//				if (isColorChaged) {
                curColor = Color.black;
                previewImageColor.color = curColor;
                timer = 0;
//				} //else {
                //curCollor = Color.black;
                //timer = 0;
                //}
            }
        }
        else
        {
            focusDial.enabled = false;
        }
    }
コード例 #27
0
 private void PaintOn(Vector3 pos, Color col)
 {
     PaintManager.PaintObject(pos, col);
 }
コード例 #28
0
 private void Start()
 {
     paintManager = GameObject.Find("PaintManager").GetComponent <PaintManager>();
     ResetSelection();
     SelectBrush(2);
 }
コード例 #29
0
 void Start()
 {
     _paintManager = FindObjectOfType <PaintManager>();
 }
コード例 #30
0
ファイル: PaintViewModel.cs プロジェクト: mchilicki/paint
 public PaintViewModel(PaintManager paintManager)
 {
     _paintManager    = paintManager;
     _currentToolType = ToolType.Pencil;
 }