Example #1
0
        public void Update()
        {
            BodyAnimation.Update();
            HeadAnimation.Update();
            HandsAnimation.Update();

            Grounded = GroundDetector.GetDetectedItems().Any();

            UpdateHandler.Update();

            if (GrabbedPaper != null)
            {
                if (AnimationFacingRight)
                {
                    GrabbedPaper.X = X;
                }
                else
                {
                    GrabbedPaper.X = X - Width / 2;
                }

                GrabbedPaper.Y = Y - (int)(GrabbedPaper.Height * 1.0f) + World.SPACE_BETWEEN_THINGS;
            }

            if (Game1.World.TrashCount >= TRASH_LIMIT)
            {
                HandlePaperFallingInThehead.DestroyPlayer(this, Game1, AudiosToPlay.Add);
            }

            if (TimeUntilDragDropEnable > 0)
            {
                TimeUntilDragDropEnable--;
            }
        }
Example #2
0
 // Use this for initialization
 void Awake()
 {
     rigidbody2d          = GetComponentInParent <Rigidbody2D>();
     groundDetector       = GetComponentInParent <GroundDetector>();
     animator             = GetComponent <Animator>();
     currentAnimationClip = Stand;
 }
Example #3
0
 void Start()
 {
     rb             = GetComponent <Rigidbody2D>();
     groundDetector = GetComponentInChildren <GroundDetector>();
     spriteRenderer = GetComponent <SpriteRenderer>();
     animator       = GetComponent <Animator>();
 }
Example #4
0
    protected bool MovingForwardsIsSafe()
    {
        //if this thing doesn't look ahead, then it's always safe!
        if (!looksAhead)
        {
            return(true);
        }

        Rigidbody2D rb = GetComponent <Rigidbody2D>();

        //if we're not going anywhere, it's totally safe to move forwards
        if (rb.velocity.x == 0.0f)
        {
            return(true);
        }

        //this is a fancy way to get a normalized value along a single axis:
        //this is, this will always be 1 or -1... it basically gives us just the sign.
        float directionNormal = rb.velocity.x / Mathf.Abs(rb.velocity.x);

        //transform.right is the direction our right side is facing. It's a normalized vector, meaning
        //it is is ONLY direction, and always has a length (magnitude) of 1.
        GroundDetector groundDetector = controlledMover.GetComponent <GroundDetector>();

        return(Physics2D.Raycast((Vector2)(transform.position + lookAheadDistance * transform.right * directionNormal) + groundDetector.colliderCenter,
                                 Vector2.down, groundDetector.collisionRadiusY + 0.1f, groundDetector.onGroundLayerMask));
    }
Example #5
0
 private void Awake()
 {
     _Ani       = GetComponent <Animator>();
     _Rb2d      = GetComponent <Rigidbody2D>();
     _SR        = GetComponent <SpriteRenderer>();
     _GDetector = transform.GetComponentInChildren <GroundDetector>();
 }
Example #6
0
 private void Awake()
 {
     _input   = GetComponent <MarioInput>();
     _motor   = GetComponent <MarioMotor>();
     _grndDet = GetComponent <GroundDetector>();
     // _bonkDet = GetComponent<BonkDetector>();
 }
Example #7
0
    void Awake()
    {
        input        = GetComponent <PlayerInput>();
        camera       = FindObjectOfType <CameraController>();
        audioManager = FindObjectOfType <AudioManager>();

        rb           = GetComponent <Rigidbody>();
        mainCollider = GetComponent <CapsuleCollider>();

        modelTransform = GameObject.Find("PlayerModel").transform;
        animator       = modelTransform.GetComponent <Animator>();

        debugText        = GameObject.Find("debugText").GetComponent <Text>();
        hangCollider     = GameObject.Find("HangCollider").GetComponent <DelayedCollider>();
        grabArmCollider  = GameObject.Find("GrabArmCollider").GetComponent <DelayedCollider>();
        interactHintText = GameObject.Find("InteractHint").GetComponent <Text>();

        groundDetector   = new GroundDetector(transform);
        interactDetector = new InteractDetector(transform, modelTransform);
        ledgeDetector    = new LedgeDetector(transform, modelTransform);

        climbController = GetComponent <ClimbController>();

        dialogueManager = FindObjectOfType <DialogueManager>();

        currentCheckpoint = GameObject.Find(defaultCheckpoint).GetComponent <CheckpointManager>();

        livesUI = new LivesUI(lives);
    }
Example #8
0
    private void Start()
    {
        _body           = GetComponent <Rigidbody>();
        _inputHolder    = GetComponent <InputHolder>();
        _groundDetector = GetComponentInChildren <GroundDetector>();

        desiredRotation = rotationTarget.eulerAngles.y;
    }
Example #9
0
    void Start()
    {
        despawn       = false;
        groundSpawner = GameObject.Find("GroundSpawner");
        GroundDetector gd = groundSpawner.GetComponent <GroundDetector>();

        ground = gd.ground;
    }
Example #10
0
 // Start is called before the first frame update
 void Start()
 {
     rb                 = GetComponent <Rigidbody2D>();
     col                = GetComponent <Collider2D>();
     gd                 = GetComponentInChildren <GroundDetector>();
     gd.Grounded       += OnGrounded;
     gd.MovingPlatform += OnMovingPlatform;
 }
Example #11
0
 void Start()
 {
     CheckPoint.InitialPlayerPosition();
     groundDetector    = GetComponentInChildren <GroundDetector>();
     ceilingDetector   = GetComponentInChildren <CeilingDetector>();
     bodyCollider      = GetComponentInChildren <CapsuleCollider2D>();
     _chipsRigidbody2D = GetComponent <Rigidbody2D>();
     initialScale      = transform.localScale.x;
 }
    private void Awake()
    {
        animator       = GetComponent <Animator>();
        groundDetector = GetComponent <GroundDetector>();
        rigidbody      = GetComponent <Rigidbody>();

        OnJump    += () => { Debug.Log("Jump!"); };
        OnLanding += () => { Debug.Log("Land!"); };
    }
Example #13
0
 void Awake()
 {
     _rb                    = GetComponent <Rigidbody2D>();
     _sr                    = GetComponent <SpriteRenderer>();
     _audio                 = GetComponent <AudioSource>();
     _animator              = GetComponent <Animator>();
     _groundDetector        = GetComponentInChildren <GroundDetector>();
     _state                 = STATE.Grounded;
     _canClimb              = false;
     _isPlayingWalkingSound = false;
     _isLoadingNext         = false;
 }
Example #14
0
 void Start()
 {
     playerRigidbody     = GetComponent <Rigidbody2D>();
     playerStatus        = GetComponent <PlayerStatusManager>();
     animator            = GetComponent <Animator>();
     sprite              = GetComponent <SpriteRenderer>();
     groundDetector      = GetComponentInChildren <GroundDetector>();
     wallclimbDetector   = GetComponentInChildren <WallDetector>();
     IsGrounded          = false;
     HasMovementFreedom  = true;
     regularGravityScale = playerRigidbody.gravityScale;
 }
Example #15
0
 // Start is called before the first frame update
 void Awake()
 {
     rigidbody = this.GetComponent <Rigidbody2D>();
     if (leftBorder is null || rightBorder is null)
     {
         string msg = "There is a problem with borders in unit " + this.name;
         Debug.Log(msg);
     }
     groundDetecor = GetComponent <GroundDetector>();
     if (groundDetecor is null)
     {
         Debug.Log("Can't find groundDetecor for " + name);
     }
 }
Example #16
0
 void Start()
 {
     wdetecdtor      = GameObject.Find("WallDetector");
     wdetector2      = GameObject.Find("WallDetector2");
     GroundDetector  = GameObject.Find("GroundDetector");
     LiftUpDetector  = GameObject.Find("LiftUpDetector");
     LandingDetector = GameObject.Find("LandingDetector");
     fScript         = wdetecdtor.GetComponent <WallDetection>();
     fScript2        = wdetector2.GetComponent <WallDetection2>();
     gScript         = GroundDetector.GetComponent <GroundDetection>();
     lScript         = LiftUpDetector.GetComponent <LiftUpDetection>();
     landingScript   = LandingDetector.GetComponent <LandingDetection>();
     dude            = gameObject.GetComponent <Rigidbody2D>();
     anim            = gameObject.GetComponent <Animator>();
 }
 public override void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.gameObject.CompareTag("Player") && collected == 0)
     {
         if (spriteRenderer.enabled)
         {
             emitter.Play();
         }
         spriteRenderer.enabled = false;
         Shatter();
         soulParticles.Stop();
         GameManager.Instance.ObjectCollected();
         playerHealth   = collision.gameObject.GetComponent <Health>();
         groundDetector = collision.gameObject.GetComponent <Jump>().groundDetector;
         collected      = 1;
     }
 }
Example #18
0
    // Start is called before the first frame update
    void Start()
    {
        character   = transform.Find("Character");
        myRigidbody = character.GetComponent <Rigidbody>();
        playerTouch = character.GetComponent <PlayerTouch>();
        animator    = character.GetComponent <Animator>();
        if (speed <= 0)
        {
            speed = 1f;
        }
        if (jumpForce <= 0)
        {
            jumpForce = 8f;
        }
        if (jumpTime <= 0)
        {
            jumpTime = 0.3f;
        }
        // Yet another small change
        timer = jumpTime + 1;
        alive = true;
        playerTouch.OffTheGround.AddListener(JumpStartForce);
        //playerTouch.DeathTouch.AddListener(Death); -> relegated to Game Manager
        playerTouch.StandUpAnimationEnd.AddListener(RegainMovement);
        playerTouch.PunchAnimationEnd.AddListener(RegainPunch);

        Transform gndTrigger = character.Find("GndTrigger");

        gndDetector = gndTrigger.GetComponent <GroundDetector>();
        gndDetector.BackToGround.AddListener(BackFromJump);

        Transform bdyTrigger = character.Find("BdyTrigger");

        bdyDetector = bdyTrigger.GetComponent <BodyDetector>();
        bdyDetector.NearSwitch.AddListener(NearSwitch);
        bdyDetector.AwayFromSwitch.AddListener(AwayFromSwitch);
        bdyDetector.EnterSunlight.AddListener(ActivateSunlight);
        //bdyDetector.LeaveSunlight.AddListener(DeactivateSunlight);

        Transform fntTrigger = character.Find("FntTrigger");

        fntDetector = fntTrigger.GetComponent <FrontDetector>();
        fntDetector.EnterPushable.AddListener(() => { /*Debug.Log("Can Push");*/ pushing = true; });
        fntDetector.LeavePushable.AddListener(() => { /*Debug.Log("Cannot Push");*/ pushing = false; });
    }
Example #19
0
    void Start()
    {
        //References
        input           = GetComponent <PlayerInput>();
        movement        = GetComponent <PlayerMovement>();
        groundDetector  = GetComponentInChildren <GroundDetector>();
        ceilingDetector = GetComponentInChildren <CeilingDetector>();
        wallrunDetector = GetComponentInChildren <WallrunDetector>();
        frontDetector   = GetComponentInChildren <FrontDetector>();
        coll            = GetComponent <CapsuleCollider>();
        rb            = GetComponent <Rigidbody>();
        camController = GetComponent <CameraController>();
        cam           = Camera.main;

        status = Status.walking;

        InitialAbilityCharge();
    }
Example #20
0
    private void Awake()
    {
        ground       = GetComponent <GroundDetector>();
        interact     = GetComponent <InteractableDetector>();
        rigidbody    = GetComponent <Rigidbody>();
        bodyCollider = GetComponent <CapsuleCollider>();
        sonar        = GetComponent <SonarFx>();
        sonarTimer   = new Timer();

        interact.OnDetectionEnter.AddListener(OnDetectionRaise);
        interact.OnDetectionExit.AddListener(OnDetectionQuit);
        crouchPercentage   = crouchHeight / bodyCollider.height;
        origColliderHeight = bodyCollider.height;
        origColliderCenter = bodyCollider.center;
        origCameraPivotPos = cameraPivot.localPosition;

        ground.OnTouchGround += _onTouchGround;
        ground.OnLeaveGround += _onLeaveGround;
    }
Example #21
0
 void Start()
 {
     _inputHolder    = GetComponent <InputHolder>();
     _body           = GetComponent <Rigidbody>();
     _groundDetector = GetComponentInChildren <GroundDetector>();
 }
Example #22
0
 private void Start()
 {
     player         = GetComponent <Player>();
     charController = GetComponentInChildren <CharacterController>();
     gndDetector    = GetComponentInChildren <GroundDetector>();
 }
Example #23
0
 void Start()
 {
     body           = GetComponent <Rigidbody>();
     groundDetector = GetComponentInChildren <GroundDetector>();
     animator       = GetComponentInChildren <Animator>();
 }
Example #24
0
 static bool Prefix(GroundDetector __instance) => __instance.enabled;
Example #25
0
 public void Awake()
 {
     groundDetector = GetComponent <GroundDetector>();
 }
Example #26
0
 // Start is called before the first frame update
 void Start()
 {
     animator       = GetComponent <Animator>();
     myRigidbody2D  = GetComponent <Rigidbody2D>();
     groundDetector = GetComponent <GroundDetector>();
 }
 private void Start()
 {
     _gd = GetComponent <GroundDetector>();
 }
Example #28
0
 private void Awake()
 {
     _rigidbody      = GetComponent <Rigidbody>();
     _groundDetector = GetComponentInChildren <GroundDetector>();
 }
 void Start()
 {
     anim = GetComponent<Animator>();
     groundDetector_script = groundDetector.GetComponent<GroundDetector> ();
     camera_script = GameObject.FindGameObjectWithTag("MainCamera").GetComponent<CameraScript> ();
 }
Example #30
0
 //we need to initialize isOnGround to be false, since we start in the air.
 public void Start()
 {
     animator       = GetComponent <Animator>();
     groundDetector = GetComponent <GroundDetector>();
 }
Example #31
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (ModelType.Length != 0)
            {
                hash ^= ModelType.GetHashCode();
            }
            if (networkParam_ != null)
            {
                hash ^= NetworkParam.GetHashCode();
            }
            if (featureParam_ != null)
            {
                hash ^= FeatureParam.GetHashCode();
            }
            if (DoClassification != false)
            {
                hash ^= DoClassification.GetHashCode();
            }
            if (DoHeading != false)
            {
                hash ^= DoHeading.GetHashCode();
            }
            if (GpuId != 0)
            {
                hash ^= GpuId.GetHashCode();
            }
            if (GroundDetector.Length != 0)
            {
                hash ^= GroundDetector.GetHashCode();
            }
            if (RoiFilter.Length != 0)
            {
                hash ^= RoiFilter.GetHashCode();
            }
            if (RemoveGroundPoints != false)
            {
                hash ^= RemoveGroundPoints.GetHashCode();
            }
            if (ObjectnessThresh != 0F)
            {
                hash ^= ObjectnessThresh.GetHashCode();
            }
            if (ConfidenceThresh != 0F)
            {
                hash ^= ConfidenceThresh.GetHashCode();
            }
            if (HeightThresh != 0F)
            {
                hash ^= HeightThresh.GetHashCode();
            }
            if (MinPtsNum != 0)
            {
                hash ^= MinPtsNum.GetHashCode();
            }
            if (ConfidenceRange != 0F)
            {
                hash ^= ConfidenceRange.GetHashCode();
            }
            return(hash);
        }