public override void Hit(NTGBattleUnitController shooter, NTGBattleSkillBehaviour behav)
    {
        base.Hit(shooter, behav);

        if (shooter != null && !targetList.Contains(shooter))
        {
            targetList.Add(shooter);
        }
    }
 static int Hit(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 3);
         NTGBattlePlayerController obj  = (NTGBattlePlayerController)ToLua.CheckObject(L, 1, typeof(NTGBattlePlayerController));
         NTGBattleUnitController   arg0 = (NTGBattleUnitController)ToLua.CheckUnityObject(L, 2, typeof(NTGBattleUnitController));
         NTGBattleSkillBehaviour   arg1 = (NTGBattleSkillBehaviour)ToLua.CheckUnityObject(L, 3, typeof(NTGBattleSkillBehaviour));
         obj.Hit(arg0, arg1);
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
    public override void Hit(NTGBattleUnitController shooter, NTGBattleSkillBehaviour behav)
    {
        base.Hit(shooter, behav);

        var hitter = shooter as NTGBattlePlayerController;

        if (hitter != null && (behav.type == NTGBattleSkillType.Attack || behav.type == NTGBattleSkillType.HostileSkill || behav.type == NTGBattleSkillType.HostilePassive))
        {
            foreach (var unit in mainController.battleUnits)
            {
                var mc = unit as NTGBattleMobController;
                if (mc != null)
                {
                    mc.PlayerHit(this, hitter);
                }
            }
        }
    }
Example #4
0
    protected IEnumerator ShootBehaviour(NTGBattleSkillBehaviour template, NTGBattleUnitController targetUnit, Vector3 targetPosition, bool direct)
    {
        float ratio = 1.0f;

        if (type == NTGBattleSkillType.Attack)
        {
            ratio = 1.0f / (1.0f + owner.atkSpeed);
        }

        var behaviour = owner.mainController.NewSkillBehaviour(template);

        if (owner.unitAnimator != null && behaviour.animationIndex != -1)
        {
            owner.unitAnimator.SetBool("walk", false);
            owner.unitAnimator.SetInteger("skill", behaviour.animationIndex);
            owner.unitAnimator.SetInteger("subskill", behaviour.animationSubIndex);
            if (behaviour.pretime == 0)
            {
                owner.unitAnimator.SetFloat("skillspeed", 100.0f);
            }
            else
            {
                owner.unitAnimator.SetFloat("skillspeed", behaviour.animationPretime / (behaviour.pretime * ratio));
            }
            if (pretimeMovable)
            {
                owner.unitAnimator.SetBool("skillkeep", true);
            }
            owner.unitAnimator.SetTrigger("shoot");
        }

        behaviour.PreShoot(targetUnit, targetPosition.x - owner.transform.position.x, targetPosition.z - owner.transform.position.z);

        interrupt = false;

        owner.ShootableCount++;
        if (!pretimeMovable)
        {
            owner.MoveableCount++;
        }
        float d = 0;

        while (d < behaviour.pretime * ratio)
        {
            yield return(null);

            if (owner.GetStatus(NTGBattleUnitController.UnitStatus.Shoot) == false)
            {
                if (pretimeMovable && owner.interruptSource == NTGBattleUnitController.ShootInterruptSource.Move)
                {
                    owner.SetStatus(NTGBattleUnitController.UnitStatus.Shoot, true);
                }
                else
                {
                    interrupt = true;
                    break;
                }
            }
            d += Time.deltaTime;
        }
        if (owner.unitAnimator != null)
        {
            owner.unitAnimator.SetFloat("skillspeed", 1.0f / ratio);
            if (pretimeMovable)
            {
                owner.unitAnimator.SetBool("skillkeep", false);
            }
        }
        owner.ShootableCount--;
        if (!pretimeMovable)
        {
            owner.MoveableCount--;
        }
        if (interrupt)
        {
            behaviour.Release();
            yield break;
        }

        if (!direct && facingType == NTGBattleSkillFacingType.Target)
        {
            owner.transform.LookAt(new Vector3(targetPosition.x, owner.transform.position.y, targetPosition.z));
        }

        behaviour.Shoot(targetUnit, targetPosition.x - owner.transform.position.x, targetPosition.z - owner.transform.position.z);
        owner.ShootableCount++;
        owner.MoveableCount++;
        d = 0;
        while (d < behaviour.stiff * ratio)
        {
            yield return(null);

            if (owner.GetStatus(NTGBattleUnitController.UnitStatus.Shoot) == false)
            {
                interrupt = behaviour.Interrupt();
                if (interrupt)
                {
                    break;
                }
                owner.SetStatus(NTGBattleUnitController.UnitStatus.Shoot, true);
            }
            d += Time.deltaTime;
        }
        owner.ShootableCount--;
        owner.MoveableCount--;
        if (interrupt)
        {
            yield break;
        }

        if (posttimeNotShootable)
        {
            owner.ShootableCount++;
        }
        d = 0;
        while (d < (behaviour.duration - behaviour.pretime - behaviour.stiff) * ratio)
        {
            yield return(null);

            if (owner.GetStatus(NTGBattleUnitController.UnitStatus.Shoot) == false)
            {
                interrupt = behaviour.Interrupt();
                if (interrupt)
                {
                    break;
                }
            }
            d += Time.deltaTime;
        }
        if (posttimeNotShootable)
        {
            owner.ShootableCount--;
        }
        if (interrupt)
        {
            yield break;
        }
    }
 public void Init(NTGBattleSkillBehaviour template)
 {
     Init(template.owner, template.shooter, template.skillController, template.behaviour, template.p, template.sp);
 }
Example #6
0
    public void ShowUnitDamage(NTGBattleUnitController unit, float effectValue, NTGBattleSkillBehaviour.EffectType effectType, bool critical, NTGBattleUnitController shooter, NTGBattleSkillBehaviour behav)
    {
        if ((unit == localPlayerController || shooter == localPlayerController) && unitUiMap.ContainsKey(unit) && unit.GroupVisibleCount[mainController.localGroup - 1] <= 0)
        {
            var viewPoint = Camera.main.WorldToViewportPoint(unit.transform.position);

            //if (effectType != NTGBattleSkillBehaviour.EffectType.HpRecover && effectType != NTGBattleSkillBehaviour.EffectType.MpRecover)
            //{
            //    Debug.Log(behav.name + " " + behav.id + " " + effectValue + " " + effectType);
            //}

            NTGApplicationController.Instance.LuaCall("UIDamage", "ShowDamage", unitUiMap[unit]["UIDamage"], (int)effectType, effectValue, critical, (viewPoint.x - 0.5f) * ScreenX, (viewPoint.y - 0.5f) * ScreenY);
        }
    }