示例#1
0
    void ObjectCapture()
    {
        //additional check if in camera
        RaycastHit2D cast = PointInDirection();

        if (cast.collider != null)
        {
            toCapture = PointInDirection().collider.gameObject;
        }
        else
        {
            toCapture = null;
        }

        if (toCapture != null)
        {
            CaptureObject cap = toCapture.GetComponent <CaptureObject>();
            if (cap != null)
            {
                if (cap.Capturable())
                {
                    if (TheBar.GetCount() > 2)
                    {
                        Launch(0, direction, director.transform.position);
                    }
                    cap.IsLaunched = false;
                    TheBar.OnCapture(toCapture);
                }
            }
        }
    }
示例#2
0
    void Highlight()
    {
        GameObject   toHighlight = null;
        RaycastHit2D cast        = PointInDirection();

        if (cast.collider != null)
        {
            toHighlight = PointInDirection().collider.gameObject;
        }
        else
        {
            toHighlight = null;
        }

        if (toHighlight != null)
        {
            CaptureObject cap = toHighlight.GetComponent <CaptureObject>();
            if (cap != null)
            {
                if (cap.Capturable())
                {
                    //put a highlight behind the object, or enable highlight effect
                }
            }
        }
    }
示例#3
0
    void Highlight()
    {
        GameObject   toHighlight = null;
        RaycastHit2D cast        = PointInDirection(LayerMask.GetMask("Objects"));
        RaycastHit2D groundCast  = PointInDirection(groundMask);

        if (groundCast.distance < cast.distance)
        {
            return;
        }

        if (cast.collider != null)
        {
            toHighlight = cast.collider.gameObject;
        }
        else
        {
            toHighlight = null;
        }

        if (toHighlight != null)
        {
            CaptureObject cap = toHighlight.GetComponent <CaptureObject>();
            if (cap != null)
            {
                if (cap.Capturable())
                {
                    //put a highlight behind the object, or enable highlight effect
                }
            }
        }
    }
示例#4
0
    void ObjectCapture()
    {
        //additional check if in camera
        RaycastHit2D cast       = PointInDirection(LayerMask.GetMask("Objects"));
        RaycastHit2D groundCast = PointInDirection(groundMask);

        if (groundCast.distance < cast.distance)
        {
            return;
        }

        if (cast.collider != null)
        {
            toCapture = cast.collider.gameObject;
        }
        else
        {
            toCapture = null;
        }

        if (toCapture != null)
        {
            CaptureObject cap = toCapture.GetComponent <CaptureObject>();
            if (cap != null)
            {
                if (cap.Capturable())
                {
                    if (TheBar.GetCount() > 2)
                    {
                        Launch(0, direction, director.transform.position);
                    }
                    cap.IsLaunched = false;
                    TheBar.OnCapture(toCapture);
                }
            }
        }
    }