Ejemplo n.º 1
0
    //-----------------------------------------------------
    //  ObjectがFastenerの開いている場所かどうか
    //-----------------------------------------------------
    bool ObjectValue(StageObject obj)
    {
        const float SLIDER_HALF_SIZE = 0.45f;

        //位置
        Vector2 objPos     = obj.transform.position;
        Vector2 matchPoint = GetMatchPoint(refarencePoint.position, endPoint.position, objPos);

        Vector2 startPos = new Vector2(refarencePoint.position.x + SLIDER_HALF_SIZE, refarencePoint.position.y);
        Vector2 endPos   = new Vector2(endPoint.position.x - SLIDER_HALF_SIZE, endPoint.position.y);

        //敵と点の距離
        float enemyToStartDif = (matchPoint - startPos).magnitude - obj.GetRadius();
        float enemyToEndDif   = (matchPoint - endPos).magnitude - obj.GetRadius();

        //割合
        enemyToStartDif = enemyToStartDif / sliderRange;
        enemyToEndDif   = enemyToEndDif / sliderRange;

        //開いているところでない
        if (moveValueArr[0] >= enemyToStartDif)
        {
            return(false);
        }
        if (moveValueArr[1] >= enemyToEndDif)
        {
            return(false);
        }

        return(true);
    }