Example #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);
    }
Example #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))
    }
Example #3
0
    void    Update()
    {
        if (life == 0)
        {
            Debug.Log("Life 0");
            return;
        }
        CurrentLife += (int)(Time.deltaTime * 1000.0f);
        if (CurrentLife > life)
        {
            End();
        }
        if (GetComponent <Collider>().GetType() == typeof(SphereCollider))
        {
            SphereCollider sphere = (SphereCollider)GetComponent <Collider>();
            lastPostion = transform.TransformPoint(sphere.center);
        }

        if (bFly)
        {
            transform.position += Direction * Time.deltaTime;
            if (bParabola)
            {
                float   t = CurrentLife * 0.001f;
                Vector3 v = transform.position;
                v.y = initY + Direction.y * t + 0.5f * g * t * t;
                transform.position = v;
            }
        }

        if (Direction.magnitude < 0.1f)
        {
            colliShape.SetInfo(GetComponent <Collider>());
        }
        else
        {
            colliShape.SetCCDInfo(GetComponent <Collider>(), lastPostion);
        }

        if (dwDelayDamage <= 0)
        {
            if (bDelayExplosion)
            {
                bDelayExplosion = false;
                object ExplosionEffect = info["ExplosionEffect"];
                if (ExplosionEffect != null)
                {
                    string strExplosion = ExplosionEffect as string;
                    if (strExplosion.Length > 0)
                    {
                        int   ExplosionEffectLife = (int)info["ExplosionEffectLife"];
                        float flife = (float)ExplosionEffectLife * 0.001f;
                        sdGameLevel.instance.PlayEffect(strExplosion,
                                                        transform.position,
                                                        Vector3.one,
                                                        Quaternion.identity,
                                                        flife);
                    }
                }
            }
            int nCombo = CheckDamage();
            if (nCombo > 0 && castActor == sdGameLevel.instance.mainChar)
            {
                sdUICharacter.Instance.ShowComboWnd(true, nCombo);
            }
        }
        else
        {
            dwDelayDamage -= (int)(Time.deltaTime * 1000.0f);
        }

        UpdateDirection();
    }