Ejemplo n.º 1
0
    // called when we have been hit by a melee attack
    override public bool OnMeleeAttackHit(APCharacterController character, APHitZone hitZone)
    {
        if (m_meleeAttackCanCatch)
        {
            HandleCatch(character);
        }

        // always ignore hit for now
        return(false);
    }
Ejemplo n.º 2
0
    // called when we have been hit by a melee attack
    override public bool OnMeleeAttackHit(APCharacterController character, APHitZone hitZone)
    {
        // Do nothing if player is currently blinking
        APSamplePlayer samplePlayer = character.GetComponent <APSamplePlayer>();

        if (samplePlayer && samplePlayer.IsGodModeEnabled())
        {
            return(false);
        }

        return(AddHitDamage(hitZone.m_damage));
    }
Ejemplo n.º 3
0
    // called when we have been hit by a melee attack
    override public void OnMeleeAttackHit(APCharacterController character, APHitZone hitZone)
    {
        // do nothing if already dead
        if (IsDead())
        {
            return;
        }

        // prevent checking hits too often
        if (Time.time < m_lastHitTime + m_minTimeBetweenTwoReceivedHits)
        {
            return;
        }

        // save current hit time
        m_lastHitTime = Time.time;

        // reduce hit count
        m_hitCount -= 1;

        // handle death & callbacks
        if (m_hitCount <= 0)
        {
            m_hitCount = 0;

            // launch die animation
            if (m_anim)
            {
                m_anim.Play("explode", 0, 0f);
            }
        }
        else
        {
            // launch hit animation
            if (m_anim)
            {
                m_anim.Play("hit", 0, 0f);
            }
        }
    }
Ejemplo n.º 4
0
    public void OnSceneGUI()
    {
        APHitZone oHitZone = (APHitZone)target;

        // simply draw hit zone
        if (oHitZone.m_active && oHitZone.gameObject.activeInHierarchy)
        {
            Vector3 pointPos = oHitZone.transform.position;
            Color   color    = Color.green;
            color.a       = 0.5f;
            Handles.color = color;
            Vector3 newPos = Handles.FreeMoveHandle(pointPos, Quaternion.identity, oHitZone.m_radius * 2f, Vector3.zero, Handles.SphereHandleCap);
            if (newPos != pointPos)
            {
                Undo.RecordObject(oHitZone.transform, "Move Hit Zone");
                oHitZone.transform.position = newPos;

                // mark object as dirty
                EditorUtility.SetDirty(oHitZone);
            }
        }
    }
Ejemplo n.º 5
0
 // called when we have been hit by a melee attack
 // - launcher : character controller launching the attack
 // - hitZone : hitzone detecting the hit
 virtual public void OnMeleeAttackHit(APCharacterController launcher, APHitZone hitZone)
 {
 }
Ejemplo n.º 6
0
 // called when we have been hit by a melee attack
 override public void OnMeleeAttackHit(APCharacterController character, APHitZone hitZone)
 {
     AddHitDamage(hitZone.m_damage);
 }
Ejemplo n.º 7
0
 // called when we have been hit by a melee attack
 override public bool OnMeleeAttackHit(APCharacterController character, APHitZone hitZone)
 {
     return(HandleHit());
 }
Ejemplo n.º 8
0
 // called when we have been hit by a melee attack
 // - launcher : character controller launching the attack
 // - hitZone : hitzone detecting the hit
 // - return false if you want engine to ignore the hit
 virtual public bool OnMeleeAttackHit(APCharacterController launcher, APHitZone hitZone)
 {
     return(false);
 }