예제 #1
0
    void OnFightingAct()
    {
        if (body.IsPlaying())
        {
            if (body.GetCurFrameIndex() == 2 && !hadCheckAttack)
            {
                hadCheckAttack = true;
                if (isHitFront)
                {
                    int damage = 0;
                    if (!isMightyHit)
                    {
                        damage = Random.Range(gInfo.strength / 12 - 3, gInfo.strength / 12 + 3);
                    }
                    else
                    {
                        damage = Random.Range(gInfo.strength / 12, gInfo.strength / 12 + 5);
                    }
                    if (transform.localScale.x > 0)
                    {
                        warCtrl.OnGenenralHitChecking(side, damage, WarSceneController.Direction.Left, (int)(hitDistance / locationStepX), locationX, locationY);
                    }
                    else
                    {
                        warCtrl.OnGenenralHitChecking(side, damage, WarSceneController.Direction.Right, (int)(hitDistance / locationStepX), locationX, locationY);
                    }
                }
                else
                {
                    int damage = Random.Range(gInfo.strength / 12 - 3, gInfo.strength / 12 + 3);
                    if (transform.localScale.x > 0)
                    {
                        warCtrl.OnGenenralHitChecking(side, damage, WarSceneController.Direction.Right, (int)(hitDistance / locationStepX), locationX, locationY);
                    }
                    else
                    {
                        warCtrl.OnGenenralHitChecking(side, damage, WarSceneController.Direction.Left, (int)(hitDistance / locationStepX), locationX, locationY);
                    }
                }
            }
        }
        else
        {
            hadCheckAttack = false;
            isFighting     = false;
            timeCoolDown   = (1 - gInfo.strength / 120f) / 2;

            head.SetFrame("Idle", 0);
            body.SetFrame("Idle", 0);
            horse.SetFrame("Idle", 0);
        }
    }