Esempio n. 1
0
    public override void DoByte()
    {
        AnimateOwner(BattleGlobals.ANIMATE_NPC_ATTACK);

        ApplyOnCastBuffs();

        // Check if byte should end
        bool interrupted = CheckInterruptedByDamage();
        bool channelOver = CheckChannelTime();

        if (interrupted || !channelOver)
        {
            ParentSkill.SkillSpriteRenderer.enabled = false;
            ParentSkill.AdvanceToNextByte();
            return;
        }

        if (Homing)
        {
            m_TargetPosition = NPCTargets[BEAM_PRIMARY_TARGET].Focus.transform.position;
        }

        RaycastHit2D[] hit         = Physics2D.LinecastAll(m_BeamStart.transform.position, m_TargetPosition, m_TargetMask);
        Vector3        endPosition = m_TargetPosition;

        foreach (RaycastHit2D r in hit)
        {
            if (r.collider != null)
            {
                BattleNPC b = GameGlobals.AttachCheckComponentChildren <BattleNPC>(r.collider.gameObject);
                if ((b != null) && b.Alive)
                {
                    endPosition = r.point;
                    _checkConditionsOnSkillHit(b);
                    break;
                }
            }
        }
        GameGlobals.Stretch(m_BeamMiddle.gameObject, m_BeamStart.transform.position,
                            endPosition, m_PositiveDirection);
        m_BeamEnd.transform.position = endPosition;

        if (Homing)
        {
            _updateRotation();
        }
    }