Пример #1
0
    private void SphereCastAll()
    {
        for (int i = 0; i < this.ids.get_Count(); i++)
        {
            EntityParent entityByID = EntityWorld.Instance.GetEntityByID(this.ids.get_Item(i));
            if (entityByID != null)
            {
                ShaderEffectUtils.SetFadeRightNow(entityByID.alphaControls, false);
            }
        }
        Ray   ray = new Ray(base.get_transform().get_position(), base.get_transform().get_forward());
        float num = Vector3.Distance(this.GetRolePositionWithHeight(), base.get_transform().get_position());

        RaycastHit[] array = Physics.SphereCastAll(ray, 0.5f, num);
        string       text  = string.Empty;

        RaycastHit[] array2 = array;
        for (int j = 0; j < array2.Length; j++)
        {
            RaycastHit  raycastHit = array2[j];
            ActorParent component  = raycastHit.get_collider().get_gameObject().GetComponent <ActorParent>();
            if (!(component == null))
            {
                if (component is ActorMonster || component is ActorCityPlayer)
                {
                    text = text + raycastHit.get_collider().get_gameObject().get_name() + ", ";
                    ShaderEffectUtils.SetFadeRightNow(component.GetEntity().alphaControls, true);
                    this.ids.Add(component.GetEntity().ID);
                }
            }
        }
    }
Пример #2
0
    /// <summary>
    /// 返回 角色前方,指定范围内的所有对象
    /// </summary>
    /// <param name="t"></param>
    /// <param name="distance"></param>
    /// <param name="layerMask"></param>
    /// <returns></returns>
    static public List <uint> GetEntitiesFrontLine(Matrix4x4 ltwM, Quaternion rotation, Vector3 forward, Vector3 position, float distance, Vector3 direction, float radius = 0.5f, float offset = 0, float angleOffset = 0)
    {
        List <uint> list = new List <uint>();

        RaycastHit[] hits = Physics.SphereCastAll(position, radius, direction, distance);

        foreach (RaycastHit hit in hits)
        {
            ActorParent entity = hit.transform.GetComponent <ActorParent>();
            list.Add(entity.GetEntity().ID);
        }

        return(list);
    }
Пример #3
0
    private int GetPriority(Transform boss)
    {
        ActorParent component = boss.GetComponent <ActorParent>();
        int         typeID    = component.GetEntity().TypeID;
        int         result    = -1;

        if (component as ActorMonster)
        {
            Monster monster = DataReader <Monster> .Get(typeID);

            result = monster.cameraLock;
        }
        else if (component as ActorPlayer)
        {
            RoleCreate roleCreate = DataReader <RoleCreate> .Get(typeID);

            result = roleCreate.cameraLock;
        }
        else
        {
            Debug.Log("<color=red>Error:</color>GetPriority=NEITHER Monster NOR Player " + component);
        }
        return(result);
    }