Ejemplo n.º 1
0
    public static VCollisionShape InitActorCollision(ActorRoot actor, GameObject gameObj, string actionName)
    {
        VCollisionShape vCollisionShape = null;

        if (actor.shape == null)
        {
            SCollisionComponent sCollisionComponent = null;
            if (null != gameObj && !VCollisionShape.s_componentCache.TryGetValue(actor.gameObject.GetInstanceID(), out sCollisionComponent))
            {
                sCollisionComponent = gameObj.GetComponent <SCollisionComponent>();
                VCollisionShape.s_componentCache[actor.gameObject.GetInstanceID()] = sCollisionComponent;
            }
            if (sCollisionComponent)
            {
                vCollisionShape = sCollisionComponent.CreateShape();
            }
//          else if (actor.CharInfo != null && actor.CharInfo.collisionType != CollisionShapeType.None)
//          {
//              vCollisionShape = actor.CharInfo.CreateCollisionShape();
//          }
            else if (gameObj)
            {
                vCollisionShape = VCollisionShape.createFromCollider(gameObj);
            }
            if (vCollisionShape != null)
            {
                vCollisionShape.Born(actor);
            }
        }
        return(actor.shape);
    }
Ejemplo n.º 2
0
    public static VCollisionShape InitActorCollision(ActorRoot actor, GameObject gameObj, string actionName)
    {
        VCollisionShape shape = null;

        if (actor.shape == null)
        {
            SCollisionComponent component = (gameObj == null) ? null : gameObj.GetComponent <SCollisionComponent>();
            if (component != null)
            {
                shape = component.CreateShape();
            }
            else if ((actor.CharInfo != null) && (actor.CharInfo.collisionType != CollisionShapeType.None))
            {
                shape = actor.CharInfo.CreateCollisionShape();
            }
            else if (gameObj != null)
            {
                shape = createFromCollider(gameObj);
            }
            if (shape != null)
            {
                shape.Born(actor);
            }
        }
        return(actor.shape);
    }
Ejemplo n.º 3
0
    public static VCollisionShape InitActorCollision(ActorRoot actor)
    {
        VCollisionShape shape = null;

        if (actor.shape == null)
        {
            SCollisionComponent component = actor.gameObject.GetComponent <SCollisionComponent>();
            if (component != null)
            {
                shape = component.CreateShape();
            }
            else if ((actor.CharInfo != null) && (actor.CharInfo.collisionType != CollisionShapeType.None))
            {
                shape = actor.CharInfo.CreateCollisionShape();
            }
            else
            {
                shape = createFromCollider(actor.gameObject);
            }
            if (shape != null)
            {
                shape.Born(actor);
            }
        }
        return(actor.shape);
    }
Ejemplo n.º 4
0
 public static VCollisionShape InitActorCollision(ActorRoot actor)
 {
     if (actor.shape == null)
     {
         SCollisionComponent sCollisionComponent = null;
         if (!VCollisionShape.s_componentCache.TryGetValue(actor.gameObject.GetInstanceID(), out sCollisionComponent))
         {
             sCollisionComponent = actor.gameObject.GetComponent <SCollisionComponent>();
             VCollisionShape.s_componentCache[actor.gameObject.GetInstanceID()] = sCollisionComponent;
         }
         VCollisionShape vCollisionShape;
         if (sCollisionComponent)
         {
             vCollisionShape = sCollisionComponent.CreateShape();
         }
         else if (actor.CharInfo != null && actor.CharInfo.collisionType != CollisionShapeType.None)
         {
             vCollisionShape = actor.CharInfo.CreateCollisionShape();
         }
         else
         {
             vCollisionShape = VCollisionShape.createFromCollider(actor.gameObject);
         }
         if (vCollisionShape != null)
         {
             vCollisionShape.Born(actor);
         }
     }
     return(actor.shape);
 }
Ejemplo n.º 5
0
 private VCollisionShape GetCollisionShape()
 {
     SCollisionComponent component = base.gameObject.GetComponent<SCollisionComponent>();
     if (component != null)
     {
         return component.CreateShape();
     }
     return VCollisionShape.createFromCollider(base.gameObject);
 }