コード例 #1
0
ファイル: sdSkillSummon.cs プロジェクト: tsinglee2009/Dczg
    sdActorInterface        FindOneActor()
    {
        Vector3 center = colliShape.point;
        float   radius = colliShape.radius;

        if (colliShape.type == ShapeType.eCapsule)
        {
            center = colliShape.point + colliShape.dir * colliShape.length * 0.5f;
            radius = colliShape.length * 0.5f + colliShape.radius;
        }
        HeaderProto.ESkillObjType objType  = (HeaderProto.ESkillObjType)((int)info["byTargetType"]);
        List <sdActorInterface>   lstActor = sdGameLevel.instance.actorMgr.FindActor(castActor, objType, center, new Vector3(0, 0, 1), 1, 0, radius, true);

        if (lstActor == null)
        {
            return(null);
        }
        if (colliShape.type == ShapeType.eCapsule)
        {
            sdCapsuleShape actorShape = new sdCapsuleShape();
            for (int i = 0; i < lstActor.Count; i++)
            {
                sdActorInterface actor = lstActor[i];
                if (!actor.IsCanSummonAttack(uniqueID))
                {
                    continue;
                }
                if (actor.GetComponent <Collider>() != null)
                {
                    if (actor.GetComponent <Collider>().GetType() == typeof(CharacterController))
                    {
                        actorShape.SetInfo(actor.GetComponent <Collider>() as CharacterController);

                        if (actorShape.IsIntersect(colliShape))
                        {
                            return(actor);
                        }
                    }
                }
            }
        }
        else if (colliShape.type == ShapeType.eSphere)
        {
            if (lstActor.Count > 0)
            {
                return(lstActor[0]);
            }
        }
        return(null);
    }
コード例 #2
0
ファイル: sdSkillSummon.cs プロジェクト: tsinglee2009/Dczg
    List <sdActorInterface> FindActor()
    {
        Vector3 center = colliShape.point;
        float   radius = colliShape.radius;

        if (colliShape.type == ShapeType.eCapsule)
        {
            center = colliShape.point + colliShape.dir * colliShape.length * 0.5f;
            radius = colliShape.length * 0.5f + colliShape.radius;
        }
        HeaderProto.ESkillObjType objType  = (HeaderProto.ESkillObjType)info["byTargetType"];
        List <sdActorInterface>   lstActor = sdGameLevel.instance.actorMgr.FindActor(castActor, objType, center, new Vector3(0, 0, 1), 1, 0, radius, true);

        if (lstActor == null)
        {
            return(null);
        }
        if (colliShape.type == ShapeType.eCapsule)
        {
            List <sdActorInterface> retActor   = new List <sdActorInterface>();
            sdCapsuleShape          actorShape = new sdCapsuleShape();
            for (int i = 0; i < lstActor.Count; i++)
            {
                sdActorInterface actor = lstActor[i];
                if (actor.GetComponent <Collider>() != null)
                {
                    if (actor.GetComponent <Collider>().GetType() == typeof(CharacterController))
                    {
                        actorShape.SetInfo(actor.GetComponent <Collider>() as CharacterController);
                        if (colliShape.IsIntersect(actorShape))
                        {
                            retActor.Add(actor);
                        }
                    }
                }
            }
            return(retActor);
        }
        else if (colliShape.type == ShapeType.eSphere)
        {
            return(lstActor);
        }
        return(null);
        //if(Physics.SphereCastAll(point,cc.radius,dir,halfheight*2.0f))
    }