コード例 #1
0
    /// <summary>
    /// chekovat pouze jeden směr nestačí
    /// </summary>
    /// <param name="center"></param>
    /// <returns></returns>
    public bool CharacterCollides(Vector2 center)
    {
        Vector2 colliderOffset = aiBase.GetComponent <Collider2D>().offset;
        float   colliderWidth  = aiBase.GetComponent <Collider2D>().bounds.size.x;
        float   distance       = 0.1f;

        bool colRight = ObjectCollides(center + colliderOffset, colliderWidth, right, distance);
        //bool colLeft = ObjectCollides(center + colliderOffset, colliderWidth, left, distance);
        bool colUp = ObjectCollides(center + colliderOffset / 2, colliderWidth, up, distance);

        //bool colDown = ObjectCollides(center + colliderOffset, colliderWidth, down, distance);

        //return colRight || colLeft || colUp || colDown;
        //return colRight || colLeft;
        //return colRight;
        return(colUp);
    }
コード例 #2
0
    //public AiAvoidBulletLogic aiAvoidBulletLogic;

    public AiMovementLogic(AiBase aiBase)
    {
        this.aiBase = aiBase;

        characterColliderWidth  = aiBase.characterColliderWidth;
        characterColliderHeight = aiBase.characterColliderHeight;
        collider = aiBase.GetComponent <Collider2D>();

        walkingFront = new List <Vector2>();
        barrierMask  = aiBase.barrierMask;

        notproofBarrierMask = 1 << 14;
    }
コード例 #3
0
    private float e = 0.1f; //odchylka

    #endregion Fields

    #region Constructors

    //public AiAvoidBulletLogic aiAvoidBulletLogic;
    public AiMovementLogic(AiBase aiBase)
    {
        this.aiBase = aiBase;

        characterColliderWidth = aiBase.characterColliderWidth;
        characterColliderHeight = aiBase.characterColliderHeight;
        collider = aiBase.GetComponent<Collider2D>();

        walkingFront = new List<Vector2>();
        barrierMask = aiBase.barrierMask;

        notproofBarrierMask = 1 << 14;
    }