Example #1
0
    public bool damage(float p_dmg)
    {
        bool success = false;
        bool goAhead = true;
        if (isDying() || !m_animObj.renderer.enabled || m_buffer.isBeforeBuffer())
            goAhead = false;

        if (goAhead)
        {
            if (m_disabler == null)
            {
                TimeBasedDisabler disabler = gameObject.AddComponent<TimeBasedDisabler>() as TimeBasedDisabler;
                disabler.m_popEffectName = "EnemDeath";
                disabler.m_popEffect = true;
                // disabler.m_disableColliders = false;
                // disabler.m_disableRigidbodies = false;
                m_disabler = disabler;
            }
            else
            {
                m_disabler.m_forceRefresh = true;
            }
            m_disabler.m_time = GlobalTime.getTime() + m_dieAnimTime;
            m_dyingTime = GlobalTime.getTime();
            success = true;
        }
        return success;
    }
Example #2
0
 void updateDisabler()
 {
     if (m_disabler == null)
     {
         TimeBasedDisabler disabler = gameObject.AddComponent<TimeBasedDisabler>() as TimeBasedDisabler;
         disabler.m_time = m_buffer.getEndTime();
         m_explodedTime = GlobalTime.getTime();
         m_disabler = disabler;
     }
 }