//2秒で-1回復 ゲージ
    IEnumerator GaugeRecovery()
    {
        InkAmout.increase_Gauge(0.1f);
        yield return(new WaitForSeconds(1.0f));

        StartCoroutine(GaugeRecovery());
    }
Esempio n. 2
0
    // Start is called before the first frame update
    void Start()
    {
        //自動解除
        StartCoroutine(obj_destroy());

        LineLength = Mathf.Abs(_startPos.y - _endPos.x);
        HP         = 1 + 0.2f * (LineLength - 1);

        //20-12-04 イゴンヒ
        InkAmout.decrease_Gauge(LineLength * 0.1f);

        Dir = Vector3.Normalize(_startPos - _endPos);
        for (int i = 0; i < LineController.Points.Count - 1; i++)
        {
            if (Dir.y < 0)
            {
                _startPos.x -= 0.1f;
                _startPos.y += 0.2f;
                temp         = offset;
            }

            else if (Dir.y > 0)
            {
                _startPos.x += 0.1f;
                _startPos.y -= 0.2f;
                temp         = -offset;
            }

            obj = Instantiate(Wall_prefab, _startPos + temp, Quaternion.identity);
            obj.transform.parent = gameObject.transform;
        }
    }
Esempio n. 3
0
    // Update is called once per frame
    void Update()
    {
        // 水墨モードON
        if (LineController.is_inkMode)
        {
            //image.material.SetFloat("_Width", Width);
            image.color = new Color(image.color.r, image.color.g, image.color.b, 1.0f);
            //Lnow = true;
            InkAmout.ImageOpen();
        }
        // 水墨モードOFF
        if (!LineController.is_inkMode)
        {
            //image.material.SetFloat("_Width", 0);
            image.color = new Color(image.color.r, image.color.g, image.color.b, 1.0f);
            //Lnow = false;
            //if (Input.GetMouseButtonDown(0))    // クリックした瞬間
            //{
            //    rt_temp.y = 1.8f;   // サイズが小さくなる
            //}
            //if (Input.GetMouseButtonUp(0))      // 離した瞬間
            //{
            //    rt_temp.y = 2f;     // サイズが大きくなる
            //}

            InkAmout.ImageClose();
        }
        //rend.material.SetFloat("_Shininess", shininess);
    }
Esempio n. 4
0
    IEnumerator obj_destroy()
    {
        yield return(new WaitForSeconds(10.0f));

        LineController.MaxLine--;
        InkAmout.increase_Gauge(LineLength * 0.1f);
        Destroy(gameObject);
    }
Esempio n. 5
0
 // Update is called once per frame
 void Update()
 {
     if (HP <= 0)
     {
         InkAmout.increase_Gauge(0.1f);
         Destroy(gameObject);
     }
 }
Esempio n. 6
0
 // Update is called once per frame
 void Update()
 {
     if (DeleyTime < 0)
     {
         Destroy(gameObject);
         InkAmout.increase_Gauge(HP);
     }
     DeleyTime -= Time.deltaTime;
 }
Esempio n. 7
0
 private void FixedUpdate()
 {
     if (HP <= 0)
     {
         Destroy(gameObject);
         LineController.MaxLine--;
         InkAmout.increase_Gauge(LineLength * 0.1f);
     }
 }
Esempio n. 8
0
    IEnumerator obj_destroy()
    {
        while (HP > 0)
        {
            yield return(new WaitForSeconds(1.0f));

            HP -= 0.2f;
        }

        InkAmout.increase_Gauge(0.1f);
        Destroy(gameObject);
    }
Esempio n. 9
0
    private void DrawLine()
    {
        if (is_inkMode == false || InkAmout.inkChack() == false)
        {
            return;
        }

        //マウスをクリックして線が始まる地点を決める
        if (Input.GetMouseButtonDown(0))
        {
            //SceenPositionをWorldPositionへ変換
            startPos = Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x,
                                                                  Input.mousePosition.y,
                                                                  -Camera.main.transform.position.z));


            if (!draw_able())
            {
                return;
            }
            is_Drawing = true;

            mouce_obj = Instantiate(Drawing_obj, startPos, Quaternion.identity);


            //list初期化
            //----------------------------------------
            Points.RemoveRange(0, Points.Count);
            Points_X.RemoveRange(0, Points_X.Count);
            Points_Y.RemoveRange(0, Points_Y.Count);
            Points_normal.RemoveRange(0, Points_normal.Count);
        }

        //マウスをドラッグして線が終わる地点を決める
        if (Input.GetMouseButton(0) && is_Drawing)
        {
            endPos = Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x,
                                                                Input.mousePosition.y,
                                                                -Camera.main.transform.position.z));

            if (!draw_able())
            {
                return;
            }
            //マウスを動かないとlistの追加をしない
            if (Vector2.Distance(tempPos, endPos) < 0.5f)
            {
                return;
            }

            Points.Add(endPos);
            Points_X.Add(endPos);
            Points_Y.Add(endPos);

            Drawing_obj.transform.position = endPos;
            mouce_obj.transform.position   = endPos;
            tempPos = endPos;
        }

        //線を書きを終了する。
        if (Input.GetMouseButtonUp(0) && is_Drawing)
        {
            Destroy(mouce_obj);

            is_Drawing = false;

            //--------------------
            Points_X.Sort((s1, s2) => s1.x.CompareTo(s2.x)); //position.xを基準にして配列整列
            Points_Y.Sort((s1, s2) => s1.y.CompareTo(s2.y)); //position.yを基準にして配列整列

            Chack_Point_Normal();

            //直線生成
            if (lineClass.Chack_Line() && Points.Count < 10)
            {
                if (MaxLine > 3 || InkAmout.image.fillAmount < 0.3f)
                {
                    return;
                }
                Instantiate(Wallparent, startPos, Quaternion.identity);
                InkAmout.decrease_Gauge(0.3f);
                MaxLine++;
            }

            //三角形を生成
            else if (triangleClass.Chack_Traiangle(startPos, Points_Y[Points_Y.Count - 1], endPos) &&
                     Points.Count < 10)
            {
                if (InkAmout.image.fillAmount < 0.3f)
                {
                    return;
                }
                float Tri_Height = Mathf.Abs((Points_Y[Points_Y.Count - 1].y - startPos.y));
                float Tri_Width  = Mathf.Abs((endPos.x - startPos.x));
                float Tri_area   = Tri_Height * Tri_Width / 2;

                Vector3 Center  = Vector3.Lerp(startPos, endPos, 0.5f);
                var     Tri_obj = Instantiate(Triangle, new Vector2(0, 0), Quaternion.identity);
                Tri_obj.GetComponent <Triangle>().HP = 10.0f;

                Tri_linRenderer = Tri_obj.GetComponent <LineRenderer>();
                Tri_linRenderer.SetPosition(0, Center);
                Center.y += Tri_Height;
                Tri_linRenderer.SetPosition(1, Center);
                InkAmout.decrease_Gauge(0.3f);
            }

            // draw circle
            else if (circleClass.Chack_Circle(Points_normal))
            {
                if (Points.Count < 8 || Points.Count > 20 || InkAmout.image.fillAmount < 0.5f)
                {
                    return;
                }
                circle_center = new Vector2(
                    (Points_Y[0].x + Points_Y[Points_Y.Count - 1].x) / 2,
                    (Points_X[0].y + Points_X[Points_X.Count - 1].y) / 2
                    );
                Instantiate(circle, circle_center, Quaternion.identity);
                InkAmout.decrease_Gauge(0.5f);
            }
        }
    }
Esempio n. 10
0
 void Update()
 {
     InkAmout.increase_Gauge(Time.deltaTime / 5);
     DrawLine();
 }
 private void FixedUpdate()
 {
     InkAmout.increase_Gauge(Time.deltaTime * 0.02f);
 }
Esempio n. 12
0
 void Start()
 {
     Init();
     InkAmout.decrease_Gauge(HP);
     StartCoroutine(obj_destroy());
 }