// Use this for initialization
        void Start()
        {
            id                = gameObject.GetInstanceID();
            m_Collider        = GetComponent <Collider2D>();
            m_Rigidbody       = GetComponent <Rigidbody2D>();
            m_Animator        = GetComponent <Animator>();
            m_Character       = GetComponent <PlatformerCharacter2D>();
            m_CarryableObject = GetComponent <CarryableObject>();
            m_LightArea       = GetComponent <CharacterLightArea>();
            m_DashControl     = GetComponent <DashControl>();
            m_Health          = GetComponent <Health>();
            m_Health.RegisterHealthEvent(OnHeathChange);

            m_DamageHandlers = new Dictionary <Damage.DamageType, DamageHandler>();
            foreach (DamageHandler handler in GetComponents <DamageHandler>())
            {
                m_DamageHandlers[handler.Type] = handler;
            }

            Physics2D.IgnoreLayerCollision(LayerMask.NameToLayer("Player"), LayerMask.NameToLayer("Hidden"), true);
            Physics2D.IgnoreLayerCollision(LayerMask.NameToLayer("Default"), LayerMask.NameToLayer("Hidden"), true);
            //Physics2D.IgnoreLayerCollision(LayerMask.NameToLayer("Hidden"), LayerMask.NameToLayer("Hidden"), true);

            Light2D.RegisterEventListener(LightEventListenerType.OnStay, OnLightStay);
            Light2D.RegisterEventListener(LightEventListenerType.OnEnter, OnLightEnter);
            Light2D.RegisterEventListener(LightEventListenerType.OnExit, OnLightExit);

            m_OriginGravityScale = m_Rigidbody.gravityScale;
            StartCoroutine(Recharge(m_DashChargeRate));
        }
Пример #2
0
 // Use this for initialization
 void Start()
 {
     m_Character        = GetComponent <DreammancerCharacter>();
     m_LightArea        = GetComponent <CharacterLightArea>();
     m_ColorList        = new ColorList(colors);
     m_ColorList.Cursor = m_StartLightIndex;
     m_LightArea.SwitchLightColor(m_ColorList.SelectedColor);
 }