public void OnTriggerExit(Collider other)
    {
        if (owner == null)
        {
            return;
        }

        var otherUnit = other.GetComponent <NTGBattleUnitController>();

        if (isFly)
        {
            if (otherUnit != null && otherUnit.alive && otherUnit.group != owner.group && (otherUnit.mask & mask) != 0)
            {
                otherUnit.RemovePassive(skillController.pBehaviours[0].passiveName);
            }
        }
        else
        {
            if (otherUnit != null && otherUnit.alive && otherUnit.group != owner.group && (otherUnit.mask & mask) != 0)
            {
                for (int i = 0; i < targetsInRange.Count; i++)
                {
                    NTGBattleUnitController temp = targetsInRange[i] as NTGBattleUnitController;
                    if (temp.name == otherUnit.name)
                    {
                        targetsInRange.Remove(targetsInRange[i]);
                    }
                }
            }
        }
    }
예제 #2
0
    public void OnTriggerEnter(Collider other)
    {
        if (other == null)
        {
            return;
        }

        var otherUnit = other.GetComponent <NTGBattleUnitController>();

        if (otherUnit != null && (otherUnit.group == owner.group || otherUnit.group == 3) && otherUnit.alive && (skillController as UTGBattlePassiveSkillControllerR60030110).targets.Count < 3 &&
            !(otherUnit is NTGBattleMobTowerController))
        {
            bool haveThisPassive = false;

            foreach (NTGBattleUnitController u in (skillController as UTGBattlePassiveSkillControllerR60030110).targets)
            {
                if (u.id == otherUnit.id)
                {
                    haveThisPassive = true;
                }
            }

            if (!haveThisPassive)
            {
                target = otherUnit;
                (skillController as UTGBattlePassiveSkillControllerR60030110).targets.Add(otherUnit);
                collider.enabled = false;
            }
        }
    }
예제 #3
0
 public void ShowUnitCoin(NTGBattleUnitController mob, NTGBattlePlayerController player, float coin)
 {
     if (player == localPlayerController && unitUiMap.ContainsKey(mob))
     {
         NTGApplicationController.Instance.LuaCall("UIDamage", "ShowDamage", unitUiMap[mob]["UIDamage"], 6, coin, false);
     }
 }
    public virtual void Init(NTGBattleUnitController owner, NTGBattleUnitController shooter = null, NTGBattleSkillController skillController = null, NTGBattleMemberSkillBehaviour behav = null, float[] p = null, string[] sp = null)
    {
        this.owner           = owner;
        this.shooter         = shooter;
        this.skillController = skillController;

        if (behav != null)
        {
            Load(behav);
        }

        this.p  = p;
        this.sp = sp;

        FXReset();

        if (audioController != null)
        {
            audioController.Init();
        }

        foreach (var ls in GetComponents <NTGLuaScript>())
        {
            if (ls.luaScript.Substring(0, ls.luaScript.LastIndexOf(".")) == "Logic.Battle.Skill")
            {
                //ls.LuaCall("Init", fxAnchor, owner, p, sp);
            }
        }
    }
예제 #5
0
    public override void Shoot(NTGBattleUnitController targetUnit, float xOffset, float zOffset)
    {
        owner.SyncShoot(id, targetUnit == null ? "" : targetUnit.id, xOffset, zOffset);

        owner.NotifyShoot(targetUnit, this);

        var specialAttack = false;

        foreach (NTGBattlePassiveSkillBehaviour passive in owner.passives)
        {
            if (passive.name == "PBehaviourR60000031")
            {
                specialAttack = true;
                break;
            }
        }

        if (specialAttack)
        {
            owner.RemovePassive("PBehaviourR60000031");
            StartCoroutine(doSpecialShoot(targetUnit, xOffset, zOffset));
        }
        else
        {
            StartCoroutine(doShoot(targetUnit, xOffset, zOffset));
        }

        StartCD();
    }
    public override void Shoot(NTGBattleUnitController lockedTarget, float xOffset, float zOffset)
    {
        lockedTarget = null;
        ShootBase(lockedTarget);

        startPos = owner.transform.position;

        collider.height = 2.0f;
        //collider.direction = 2;
        collider.center = new Vector3(0, 0, -0.1f);
        collider.radius = this.param[0];

        playerHit = false;

        foreach (NTGBattlePassiveSkillBehaviour passive in owner.passives)
        {
            if (passive.name == "PBehaviourR60000130")
            {
                (passive as UTGBattlePassiveSkillBehaviourR60000130).DoSpecialShootCount(4);
            }
        }

        collider.enabled = true;
        FXEA();
        FXEB();
        //DoFXES();



        StartCoroutine(doFly());
    }
    public void OnTriggerEnter(Collider other)
    {
        if (owner == null)
        {
            return;
        }

        var otherUnit = other.GetComponent <NTGBattleUnitController>();

        if (otherUnit != null && otherUnit != lastHitTarget && otherUnit.alive && otherUnit.group != owner.group && (mask & otherUnit.mask) != 0)
        {
            otherUnit.Hit(owner, this);

            FXHit(otherUnit);
            hitTarget     = true;
            lastHitTarget = otherUnit;
            GetComponent <CapsuleCollider>().enabled = false;
        }

        if (other.tag == "Ground")
        {
            FXHit(null);
            hitTarget = false;
            GetComponent <CapsuleCollider>().enabled = false;
        }
    }
예제 #8
0
    private IEnumerator doPreMove(NTGBattleUnitController lockedTarget, float xOffset, float zOffset)
    {
        //if (owner.alive && owner.navAgent != null)
        //    owner.navAgent.enabled = false;

        var time = pretime * 0.95f;
        var dist = (float)Math.Sqrt(xOffset * xOffset + zOffset * zOffset);

        if (dist > 1.0f)
        {
            var zSpeed = (dist - 1.0f) / time;

            float d = 0;
            while (d < time)
            {
                yield return(null);

                d += Time.deltaTime;

                owner.transform.Translate(0, 0, zSpeed * Time.deltaTime);
            }
        }

        //if (owner.alive && owner.navAgent != null)
        //    owner.navAgent.enabled = true;
    }
예제 #9
0
 public void ShowUnitKillMessage(NTGBattleUnitController killer, NTGBattleUnitController victim)
 {
     if (victim is NTGBattleMobTowerController)
     {
         ShowMessage(0, 8, victim.group == mainController.localGroup, killer.icon, victim.icon);
     }
 }
    public override void SkillShoot(int skillId, string targetId, float xOffset, float zOffset)
    {
        for (int i = 0; i < skills.Length; i++)
        {
            if (skills[i].id == skillId)
            {
                if (!Shootable)
                {
                    return;
                }

                targetUnit = mainController.FindUnit(targetId);

                if (targetUnit != null && skills[i].facingType == NTGBattleSkillFacingType.Target)
                {
                    transform.LookAt(new Vector3(targetUnit.transform.position.x, transform.position.y, targetUnit.transform.position.z));
                }

                if (mp >= skills[i].mpCost)
                {
                    mp -= skills[i].mpCost;

                    skills[i].Shoot(targetUnit, xOffset, zOffset);
                }

                break;
            }
        }

        //foreach (var equip in equips)
        //{
        //    if (equip != null)
        //        equip.SkillShoot(skillId, targetId);
        //}
    }
    public int SkillDecision(NTGBattleUnitController target, float sqrDist)
    {
        int skillIndex = 0;

        if (chainSkill)
        {
            return(SkillDecisionChain(target, sqrDist));
        }

        var chainRoll = Random.Range(0.0f, 1.0f);

        //Debug.LogError(String.Format("Roll {0} of {1}", chainRoll, chainWeight));
        if (chainRoll < chainWeight)
        {
            chainWeight     = 0.1f;
            chainSkill      = true;
            chainSkillReady = false;
            chainSkillIndex = 0;
            return(SkillDecisionChain(target, sqrDist));
        }

        float weight    = 0;
        var   skillRoll = Random.Range(0.0f, 1.0f);

        for (int i = 0; i < skillWeight.Length; i++)
        {
            if (skillRoll < weight + skillWeight[i])
            {
                skillIndex = i;
                break;
            }
            weight += skillWeight[i];
        }

        if (pc.skills[skillIndex].level > 0 && pc.skills[skillIndex].inCd <= 0 && pc.mp >= pc.skills[skillIndex].mpCost && (target.mask & pc.skills[skillIndex].mask) != 0 && sqrDist < pc.skills[skillIndex].sqrRange)
        {
            if (skillIndex > 0)
            {
                skillWeight[skillIndex] -= 0.05f;
                skillWeight[0]          += 0.05f;
                if (skillWeight[skillIndex] <= 0)
                {
                    skillWeight[0]          -= 0.25f;
                    skillWeight[skillIndex] += 0.25f;
                }

                chainWeight += 0.05f;
            }
            if (skillWeight[0] >= 0.75f)
            {
                skillWeight = new[] { 0.25f, 0.25f, 0.25f, 0.25f };
            }

            return(skillIndex);
        }

        skillIndex = 0;

        return(skillIndex);
    }
    private IEnumerator doCheck()
    {
        yield return(new WaitForSeconds(0.1f));

        Debug.Log(targetsInRange.Count);
        for (int i = 0; i < targetsInRange.Count; i++)
        {
            NTGBattleUnitController temp = targetsInRange[i] as NTGBattleUnitController;
            if (temp != null && temp.alive)
            {
                ShootBase(temp);
                effectType = EffectType.PhysicDamage;
                temp.Hit(owner, this);
                temp.AddPassive(skillController.pBehaviours[0].passiveName, owner, skillController);
                temp.AddPassive("Blow", shooter, p: new[] { this.param[1] });
                FXHit(temp);
            }
        }
        isFly = true;
        targetsInRange.Clear();
        yield return(new WaitForSeconds(pDuration));

        Debug.Log("asdbasd" + pDuration);

        Release();
    }
    public void FXE1(NTGBattleUnitController lockedTarget, float xOffset, float zOffset)
    {
        if (e1 == null)
        {
            return;
        }

        if (!owner.visibility || !owner.rendererVisible)
        {
            return;
        }

        e1.gameObject.SetActive(true);

        e1.parent   = owner.mainController.dynamics;
        e1.position = owner.transform.position + new Vector3(xOffset, 0, zOffset);
        e1.rotation = owner.transform.rotation;

        foreach (var fx in e1.GetComponentsInChildren <ParticleSystem>())
        {
            fx.Stop();
            fx.Play();
        }
        //foreach (var fx in e1.GetComponentsInChildren<Animator>())
        //{
        //    fx.SetTrigger("play");
        //}
    }
    public virtual void FXE0(NTGBattleUnitController lockedTarget, float xOffset, float zOffset)
    {
        FXE1(lockedTarget, xOffset, zOffset);

        if (audioController != null)
        {
            audioController.FXE0(owner.transform);
        }

        if (e0 == null)
        {
            return;
        }

        if (!owner.visibility || !owner.rendererVisible)
        {
            return;
        }

        e0.gameObject.SetActive(true);

        e0.parent        = owner.transform;
        e0.localPosition = Vector3.zero;
        e0.localRotation = Quaternion.identity;

        foreach (var fx in e0.GetComponentsInChildren <ParticleSystem>())
        {
            fx.Stop();
            fx.Play();
        }
        //foreach (var fx in e0.GetComponentsInChildren<Animator>())
        //{
        //    fx.SetTrigger("play");
        //}
    }
    public override void Shoot(NTGBattleUnitController lockedTarget, float xOffset, float zOffset)
    {
        if (owner.group == owner.mainController.uiController.localPlayerController.group)
        {
            allyFX.gameObject.SetActive(true);
            enemyFX.gameObject.SetActive(false);

            skillFX = allyFX;
        }
        else
        {
            allyFX.gameObject.SetActive(false);
            enemyFX.gameObject.SetActive(true);

            skillFX = enemyFX;
        }

        if (skillFX != null)
        {
            ea = skillFX.Find("EA");
            eb = skillFX.Find("EB");
            ec = skillFX.Find("EC");
            ed = skillFX.Find("ED");
        }

        FXReset();

        base.Shoot(lockedTarget, xOffset, zOffset);
    }
    private IEnumerator doSpecialShoot(NTGBattleUnitController targetUnit, float xOffset, float zOffset)
    {
        Vector3 targetPosition;

        if (xOffset == 0 && zOffset == 0 && targetUnit != null)
        {
            targetPosition = targetUnit.transform.position;
        }
        else
        {
            targetPosition = new Vector3(owner.transform.position.x + xOffset * range, owner.transform.position.y, owner.transform.position.z + zOffset * range);
        }

        yield return(StartCoroutine(CancelPreviousSkill()));

        owner.SetStatus(NTGBattleUnitController.UnitStatus.Shoot, true);
        if (type == NTGBattleSkillType.Attack)
        {
            owner.SetNavPriority(NTGBattleUnitController.NavPriority.Attack);
        }
        else if (type == NTGBattleSkillType.HostileSkill || type == NTGBattleSkillType.FriendlySkill)
        {
            owner.SetNavPriority(NTGBattleUnitController.NavPriority.Skill);
        }

        owner.AddPassive((specialSkillBehaviour as NTGBattlePassiveSkillBehaviour).passiveName, owner, psc);
        yield return(StartCoroutine(ShootBehaviour(specialSkillBehaviour, targetUnit, targetPosition, xOffset == 0 && zOffset == 0 && targetUnit == null)));

        owner.SetNavPriority(NTGBattleUnitController.NavPriority.Default);
        owner.SetStatus(NTGBattleUnitController.UnitStatus.Shoot, false);
    }
예제 #17
0
    //public LuaTable AddUnitUI(NTGBattleUnitController unit, string type)
    //{
    //    if (mainController.serverSimulator)
    //        return null;

    //    if (unitUiMap.ContainsKey(unit))
    //        return null;

    //    var unitUi = Instantiate(unitUiTemplate.gameObject);
    //    unitUi.transform.SetParent(unitUiBase.Find(type));
    //    unitUi.transform.localScale = unit.transform.localScale;
    //    unitUi.SetActive(true);

    //    unit.unitUi = unitUi.transform;

    //    foreach (var luaScript in unitUi.GetComponents<NTGLuaScript>())
    //    {
    //        if (luaScript.luaScript == "Logic.M022.UIBattle.UIPlayerInfo")
    //        {
    //            NTGApplicationController.Instance.LuaCall("UIPlayerInfo", "SetHeroUiMountPoint", luaScript.self, unit.unitUiAnchor);

    //            unitUiMap.Add(unit, luaScript.self);

    //            return luaScript.self;
    //        }
    //    }

    //    return null;
    //}

    public void HideUnitUI(NTGBattleUnitController unit, bool visibility)
    {
        if (unitUiMap.ContainsKey(unit))
        {
            NTGApplicationController.Instance.LuaCall("UIPlayerInfo", "HideHPInfo", unitUiMap[unit], visibility);
        }
    }
예제 #18
0
 public void SetUnitState(NTGBattleUnitController unit, UnitStateType type, float time)
 {
     if (unit is NTGBattlePlayerController && unit.visibility && unit.rendererVisible && unitUiMap.ContainsKey(unit))
     {
         NTGApplicationController.Instance.LuaCall("UIPlayerInfo", "SetState", unitUiMap[unit], (int)type, time);
     }
 }
예제 #19
0
 public void MiniMapDestory(NTGBattleUnitController unit)
 {
     if (unit.unitMinimap != null)
     {
         NTGApplicationController.Instance.LuaCall("UIBattleAPI", "MiniMapDestroy", uiBattleAPI, unit.id);
         unit.unitMinimap = null;
     }
 }
예제 #20
0
 public void MiniMapCreate(NTGBattleUnitController unit, int type, int camp, string icon)
 {
     if (unit.unitMinimap == null)
     {
         var r = NTGApplicationController.Instance.LuaCall("UIBattleAPI", "MiniMapCreate", uiBattleAPI, unit.id, type, camp, icon);
         unit.unitMinimap = (r[0] as GameObject).transform;
     }
 }
예제 #21
0
 public void ShowUnitSign(NTGBattleUnitController mob)
 {
     if (mob.visibility && mob.rendererVisible && unitUiMap.ContainsKey(mob))
     {
         NTGApplicationController.Instance.LuaCall("UIPlayerInfo", "ShowSign", unitUiMap[mob], 1, true);
         StartCoroutine(doShowUnitSign(mob));
     }
 }
 public override void PreShoot(NTGBattleUnitController target, float xOffset, float zOffset)
 {
     isFly = false;
     owner.transform.LookAt(new Vector3(xOffset + owner.transform.position.x, owner.transform.position.y, zOffset + owner.transform.position.z));
     base.PreShoot(target, xOffset, zOffset);
     FXEA();
     FXEB();
 }
예제 #23
0
 private void Damage(NTGBattleUnitController otherUnit)
 {
     if (otherUnit != null && otherUnit.alive && otherUnit.group != owner.group && (mask & otherUnit.mask) != 0)
     {
         otherUnit.Hit(shooter, this);
         FXHit(otherUnit);
     }
 }
    public override void Shoot(NTGBattleUnitController lockedTarget, float xOffset, float zOffset)
    {
        base.Shoot(lockedTarget, xOffset, zOffset);

        startPos = owner.transform.position;

        StartCoroutine(doFly());
    }
    public override void Shoot(NTGBattleUnitController lockedTarget, float xOffset, float zOffset)
    {
        base.Shoot(lockedTarget, xOffset, zOffset);

        collider.radius = param[0];

        StartCoroutine(doFly());
    }
    public override bool ShootCheck(NTGBattleUnitController targetUnit, float xOffset, float zOffset)
    {
        if (behaviours.Length > 0)
        {
            return(behaviours[stageIndex].ShootCheck(targetUnit, xOffset, zOffset));
        }

        return(true);
    }
    public override void Shoot(NTGBattleUnitController target, float xOffset, float zOffset)
    {
        base.Shoot(target, xOffset, zOffset);

        owner.AddPassive(pBehaviours[0].passiveName, owner, skillController);
        owner.AddPassive(pBehaviours[1].passiveName, owner, skillController);

        Release();
    }
    private IEnumerator deferStun(NTGBattleUnitController target)
    {
        yield return(new WaitForSeconds(2.0f));

        if (target != null && target.alive)
        {
            target.AddPassive("Stun", p: new[] { param[2] });
        }
    }
예제 #29
0
    public virtual bool ShootCheck(NTGBattleUnitController targetUnit, float xOffset = 0, float zOffset = 0)
    {
        if (behaviours.Length > 0)
        {
            return(behaviours[0].ShootCheck(targetUnit, xOffset, zOffset));
        }

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

        if (shooter != null && !targetList.Contains(shooter))
        {
            targetList.Add(shooter);
        }
    }