// Use this for initialization protected virtual void Start() { m_BoxCollider = GetComponent <BoxCollider2D>(); m_BasicMovement = this.GetComponent <BasicMovement>(); m_Flash = GetComponent <Flash>(); if (m_Flash == null) { m_Flash = GetComponentInChildren <Flash>(); if (m_Flash == null) { m_Flash = gameObject.AddComponent <Flash>(); } } m_Collideable = GetComponent <Collideable>(); if (m_Collideable == null) { m_Collideable = gameObject.AddComponent <Collideable>(); } m_DetectMovingPlat = GetComponent <DetectMovingPlat>(); if (m_DetectMovingPlat == null) { m_DetectMovingPlat = gameObject.AddComponent <DetectMovingPlat>(); } }
private void Start() { m_BoxCollider = GetComponent <BoxCollider2D>(); m_Transform = GetComponent <Transform>(); detectMovingPlatScript = GetComponent <DetectMovingPlat>(); if (detectMovingPlatScript == null) { gameObject.AddComponent <DetectMovingPlat>(); } }