Esempio n. 1
0
    private void Start()
    {
        rb         = GetComponent <Rigidbody2D>();
        hs         = GetComponent <HealthSystem>();
        dr         = GetComponent <DamageReceiver>();
        lava       = FindObjectOfType <Lava>();
        coroutines = Coroutines.GetInstance();
        sf         = FindObjectOfType <ScreenFader>();
        anim       = GetComponent <Animator>();
        pc         = GetComponent <PlayerController>();
        sr         = GetComponent <SpriteRenderer>();
        tr         = GetComponent <Transform>();

        SetRespawnPoint(tr.position);

        #region delegate_subscriptions
        //I am fully aware of the fact that had I used unityEvents, I could do this in the inspector:
        pc.OnStartedRunning  += (() => { sfx.TryStartPlayLooped("Run"); });
        pc.OnStoppedRunning  += (() => { sfx.TryStopPlayLooped("Run"); });
        pc.OnStartedClimbing += (() => { sfx.TryStartPlayLooped("ClimbLadder"); });
        pc.OnStoppedClimbing += (() => { sfx.TryStopPlayLooped("ClimbLadder"); });
        pc.OnJumped          += (() => { sfx.TryPlayOnce("Jump"); });
        pc.OnHitGround       += (() => { sfx.TryPlayOnce("GroundImpact"); });
        pc.OnClimbedOnce     += (() => { sfx.TryPlayOnce("GrabbedLadder"); });
        dr.OnTakenDamage     += (() => { sfx.TryPlayOnce("Damaged"); });
        OnDamagedByLava      += (() => { sfx.TryPlayOnce("TouchLava"); });

        hs.OnDeath     += Death;
        dr.OnDamagedBy += ProcessDamager;
        #endregion delegate_subscriptions
    }
    private void Start()
    {
        coroutines = Coroutines.GetInstance();

        collideableLayersMask = Physics2D.GetLayerCollisionMask(dmgDetectionCollider.gameObject.layer);
        //Debug.Log(LayerMask.LayerToName(dmgDetectionCollider.gameObject.layer));
    }
Esempio n. 3
0
 private void Awake()
 {
     coroutines   = Coroutines.GetInstance();
     hs           = GetComponent <HealthSystem>();
     sr           = GetComponent <SpriteRenderer>();
     tr           = GetComponent <Transform>();
     pingPongWalk = GetComponent <PingPongWalk>();
 }
Esempio n. 4
0
 private void Start()
 {
     coroutines = Coroutines.GetInstance();
     sfx.TryStartPlayLooped("Flying");
 }
Esempio n. 5
0
 private void Start()
 {
     sf         = FindObjectOfType <ScreenFader>();
     coroutines = Coroutines.GetInstance();
     //gm = FindObjectOfType<GameManager>();
 }