Beispiel #1
0
    void Start()
    {
        this.HeroController = this.GetComponent <HeroController> ();
        this.forceGenerator = this.GetComponentInChildren <ForceGenerator> ();
        this.magneticObject = this.GetComponent <MagneticObject> ();
        this.anim           = this.GetComponent <Animator> ();

        JollyDebug.Watch(this, "FacingRight", delegate() {
            return(this.FacingRight);
        });
    }
Beispiel #2
0
    void Update()
    {
        bool grounded = Physics2D.Linecast(this.transform.position, this.GroundDetector.transform.position, 1 << LayerMask.NameToLayer("Ground"));

        JollyDebug.Watch(this, "Grounded", grounded);
        if (this.HeroController.Jump && grounded)
        {
            this.ShouldJump = true;
        }
        float viewportPointOfEdgeDetector = this.RenderingCamera.WorldToViewportPoint(this.ScreenEdgeDetector.transform.position).x;

        this.AtEdgeOfScreen = viewportPointOfEdgeDetector < 0.0f || viewportPointOfEdgeDetector >= 1.0f;
    }