private void OnEnterDie(MyAIBaes target)
    {
        //被攻击者死亡
        if (target.state == AIState.Die)
        {
            return;
        }

        var target_View = target.GetComponent <MyPlaceableView>();

        target_View.data.hitPoints = 0;

        if (target_View.data.pType == Placeable.PlaceableType.Unit)//移动单位
        {
            var nav1 = target.GetComponent <NavMeshAgent>();

            nav1.enabled = false;

            var targetAnim = target.GetComponent <Animator>();

            targetAnim.SetTrigger("IsDead");
        }
        else if (target_View.data.pType == Placeable.PlaceableType.Building)//防御塔
        {
            var targetAnim = target.GetComponent <Animator>();

            targetAnim.SetTrigger("IsDead");
        }

        // print($"{target.gameObject.name} is dead!");

        //设置溶解边颜色
        var rds   = target.GetComponentsInChildren <Renderer>();
        var color = target_View.data.faction == Placeable.Faction.Player ? Color.red : Color.green;

        target_View.DieProgress = 0;
        foreach (var rd in rds)
        {
            rd.material.SetColor("_EdgeColor", color * 8);
            rd.material.SetFloat("_EdgeWidth", 0.1f);
        }

        target.state = AIState.Die;
    }
    private MyAIBaes FindNearestEnemy(Vector3 myPos, Placeable.Faction faction)
    {
        List <MyPlaceableView> units = (faction == Placeable.Faction.Player) ? his : mine;
        float    x = float.MaxValue;
        MyAIBaes n = null;

        foreach (var unit in units)
        {
            var s = unit.GetComponent <MyAIBaes>();

            if (s.state != AIState.Die)
            {
                var d = Vector3.Distance(unit.transform.position, myPos);
                if (d < x)
                {
                    x = d;
                    n = unit.GetComponent <MyAIBaes>();
                }
            }
        }

        return(n);
    }