Example #1
0
    public void TryUpdateTargetIcon()
    {
        Units selectedTarget = this.GetSelectedTarget();

        if (this.NeedUpdateTargetInfo(selectedTarget))
        {
            HUDModuleMsgTools.Get_AttactTarget(selectedTarget);
            this.BackupTargetInfo(selectedTarget);
        }
        if (selectedTarget == null || !selectedTarget.isLive)
        {
            HUDModuleMsgTools.Get_AttactTarget(null);
        }
    }
Example #2
0
    public void SetSelectedTarget(Units target)
    {
        if (BattleCameraMgr.Instance == null || PlayerControlMgr.Instance == null || PlayerControlMgr.Instance.GetPlayer() == null)
        {
            return;
        }
        if (target != null && target.teamType == PlayerControlMgr.Instance.GetPlayer().teamType)
        {
            return;
        }
        if (target == null)
        {
            HUDModuleMsgTools.Get_AttactTarget(null);
            if (this._selectedTarget != null)
            {
                this._selectedTarget.MarkAsTarget(false);
            }
            this.CleanSelectTag();
        }
        else
        {
            if (NewbieManager.Instance.IsForbidSelectTower(target))
            {
                return;
            }
            if (target != this._selectedTarget)
            {
                if (this._selectedTarget != null)
                {
                    this._selectedTarget.MarkAsTarget(false);
                    this.CleanSelectTag();
                }
                HUDModuleMsgTools.Get_AttactTarget(target);
                target.MarkAsTarget(true);
                this._selectedTarget = target;
                Singleton <TriggerManager> .Instance.SendGameStateEvent(GameEvent.ClickEnemyHero);

                BattleCameraMgr.Instance.SetTarget(this._selectedTarget);
            }
            NewbieManager.Instance.TryStopCheckSelEnemyHero(target);
        }
    }
Example #3
0
    public Units GetSelectedTarget()
    {
        if (this._selectedTarget != null && (!this._selectedTarget.isSelected || !this._selectedTarget.isLive))
        {
            HUDModuleMsgTools.Get_AttactTarget(null);
            this._selectedTarget.MarkAsTarget(false);
            this._selectedTarget = null;
            this.ClearOtherTargetTag();
            return(null);
        }
        Units player = MapManager.Instance.GetPlayer();

        if (player != null && player.transform != null && this._selectedTarget != null && Vector3.Distance(this._selectedTarget.transform.position, player.transform.position) > this.maxselecteddistance)
        {
            this._selectedTarget.MarkAsTarget(false);
            HUDModuleMsgTools.Get_AttactTarget(null);
            this._selectedTarget = null;
            this.ClearOtherTargetTag();
            return(null);
        }
        return(this._selectedTarget);
    }
Example #4
0
 private void SetAttackTarget(bool ismark)
 {
     if (this._player != null)
     {
         Units attackTarget = this._player.GetAttackTarget();
         if (ismark)
         {
             if (attackTarget != null && attackTarget.isLive)
             {
                 attackTarget.MarkAsTarget(true);
                 this._selectedTarget = attackTarget;
                 BattleCameraMgr.Instance.SetTarget(attackTarget);
                 HUDModuleMsgTools.Get_AttactTarget(attackTarget);
             }
         }
         else if (this._selectedTarget != null)
         {
             this._selectedTarget.MarkAsTarget(false);
             HUDModuleMsgTools.Get_AttactTarget(null);
         }
     }
 }