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); }
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); }
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); }