예제 #1
0
        private void Awake()
        {
            if (damageable == null)
            {
                damageable = GetComponent <Damageable>();
            }

            if (movable == null)
            {
                movable = GetComponent <Movable>();
            }

            if (movement == null)
            {
                movement = GetComponent <ManualMove>();
            }

            if (pHealth == null)
            {
                pHealth = GetComponent <PlayerHealth>();
            }

            if (pScore == null)
            {
                pScore = GetComponent <PlayerTravelScore>();
            }

            if (rb == null)
            {
                rb = GetComponent <Rigidbody2D>();
            }

            if (sr == null)
            {
                sr = GetComponentInChildren <SpriteRenderer>();
                Debug.Log("Forgot to reference sr", this);
            }

            damageTimer = new WaitForSeconds(damageWait);

            hurtColor    = new Color(sr.color.r, sr.color.g, sr.color.b, 0.5f);
            defaultColor = new Color(sr.color.r, sr.color.g, sr.color.b, 1f);
        }
예제 #2
0
        private void Awake()
        {
            if (damageable == null)
            {
                damageable = GetComponent <Damageable>();
            }

            if (movable == null)
            {
                movable = GetComponent <Movable>();
            }

            if (obstComp == null)
            {
                obstComp = GetComponent <ObstacleComponent>();
            }

            if (pusher == null)
            {
                pusher = GetComponent <Pusher>();
            }

            obstComp.OnSetup += Setup;
        }
예제 #3
0
 public void DealDamage(Damageable damageable, int value)
 {
     damageable.ApplyChange(-value);
 }