Exemplo n.º 1
0
    // 指定位置に針を生成
    private void bindNeedle(Vector2 position)
    {
        var instance = Needle.instance(position);

        NeedleList.Add(instance);
        Debug.Log("針で綴じた。");
        Debug.Log(string.Format("position.x:{0} position.y:{1}", position.x, position.y));
    }
Exemplo n.º 2
0
        public void judge_error(int xCode, int yCode)
        {
            // 針を生成し、当たり判定許容範囲を取得する
            var instance = Needle.instance(new Vector2(0, 0));
            var range    = getRange(instance);
            // 当たり判定(xとyに1か-1を掛けた上で加算し上限超過と下限未満を調べる)
            var result = instance.isCollision(new Vector2(range * xCode + xCode, range * yCode + yCode));

            Assert.IsFalse(result);
        }
Exemplo n.º 3
0
        public void judge_normal(int xCode, int yCode)
        {
            // 針を生成し、当たり判定許容範囲を取得する
            var instance = Needle.instance(new Vector2(0, 0));
            var range    = getRange(instance);
            // 当たり判定(xとyに1か-1を掛けて上限と下限を調べる)
            var result = instance.isCollision(new Vector2(range * xCode, range * yCode));

            Assert.IsTrue(result);
        }
Exemplo n.º 4
0
        public void instance()
        {
            const float x        = 0;
            const float y        = 0;
            var         instance = Needle.instance(new Vector2(x, y));

            // 生成した針の座標が正しいか確認
            var targetPosition = getPosition(instance);

            Assert.AreEqual(targetPosition.x, x);
            Assert.AreEqual(targetPosition.y, y);
        }
Exemplo n.º 5
0
        // target.NeedleListに針を追加
        private Needle instanceNeedle(Paper target, Vector2 position)
        {
            // NeedleListを取得
            List <Needle> needleList = getNeedleList(target);

            // NeedleListに同じpositionのものがないことを確認
            foreach (var needle in needleList)
            {
                if (needle.isCollision(position))
                {
                    return(null);
                }
            }

            // needleListに新たな針を追加
            var instance = Needle.instance(position);

            needleList.Add(instance);
            return(instance);
        }