Esempio n. 1
0
    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);
    }
Esempio n. 2
0
    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))
    }
Esempio n. 3
0
    void    PlayEffect()
    {
        if (m_Effect != null)
        {
            return;
        }
        Hashtable buffs = sdConfDataMgr.Instance().GetTable("buff");
        object    table = buffs[templateId.ToString()];

        if (table != null)
        {
            Hashtable buffinfo = table as Hashtable;
            if (buffinfo != null)
            {
                object texiao = buffinfo["Effect"];
                if (texiao != null)
                {
                    string str = texiao as string;
                    if (str != null && str.Length > 0)
                    {
                        object           bind     = buffinfo["Dummy"];
                        sdActorInterface actor    = GetActor();
                        GameObject       bindNode = GetActor().gameObject;
                        bool             bHead    = false;
                        if (actor.actorType == ActorType.AT_Player)
                        {
                            sdGameActor gactor = (sdGameActor)actor;
                            if (bind != null)
                            {
                                int Dummy = (int)bind;
                                if (Dummy == 1)
                                {
                                    bindNode = gactor.GetNode("Bip01_attack_target");
                                }
                                else if (Dummy == 2)
                                {
                                    bindNode = gactor.GetNode("Bip01 HeadNub");
                                    bHead    = true;
                                }
                            }
                        }
                        else
                        {
                            sdGameMonster monster = (sdGameMonster)actor;
                            if (bind != null)
                            {
                                int Dummy = (int)bind;
                                if (Dummy == 1)
                                {
                                    bindNode = monster.GetNode(monster.ChestPoint.Replace("\r\n", ""));
                                }
                                else if (Dummy == 2)
                                {
                                    bindNode = monster.GetNode(monster.HeadPoint.Replace("\r\n", ""));
                                    bHead    = true;
                                }
                            }
                        }
                        if (bindNode != null)
                        {
                            bool bRotate = (int.Parse((string)buffinfo["EffectRotate"])) != 0;
                            if (bHead)
                            {
                                CharacterController cc = actor.GetComponent <CharacterController>();
                                AddEffect(str, actor.transform, 0.0f, new Vector3(0, cc.height, 0), false);
                            }
                            else
                            {
                                AddEffect(str, bindNode.transform, 0.0f, new Vector3(0, 0.0f, 0), bRotate);
                            }
                        }
                        else
                        {
                            AddEffect(str, GetActor().transform, 0.0f, new Vector3(0, 0, 0), true);
                        }
                    }
                }
            }
        }
    }