Exemple #1
0
    void Start()
    {
        input = PlayerInputManager.instance;
        state = PlayerStateManager.instance;

        rb = GetComponent <Rigidbody2D>();
        carryableDetector    = GetComponentInChildren <CarryableDetector>();
        interactableDetector = GetComponentInChildren <InteractableDetector>();

        moveDir = new Vector2(1.0f, 0.0f);

        playerSortingGroup = GetComponentInChildren <SortingGroup>();
    }
Exemple #2
0
    // Use this for initialization
    void Start()
    {
        rigidBody            = gameObject.GetComponent <Rigidbody2D>();
        animator             = gameObject.GetComponent <Animator>();
        playerInput          = gameObject.GetComponent <PlayerInput>();
        barneyRenderer       = gameObject.GetComponentInChildren <BarneyRenderer>();
        interactableDetector = GetComponent <InteractableDetector>();

        rocketLauncher  = gameObject.GetComponentInChildren <RocketLauncher>();
        explosion       = gameObject.GetComponent <Explosion>();
        hitPointManager = gameObject.GetComponent <HitPointManager>();
        hitPointManager.OnHitPointsChangedEvent += _OnHitPointsChanged;

        playerConfig = GameObject.FindObjectOfType <PlayerConfig>();

        setBombCount(bombCount);
        ListenForDashEnded();
        StartCoroutine(EndWarpIn());
    }
Exemple #3
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;
    }