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) { 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); }
private VCollisionShape GetCollisionShape() { SCollisionComponent component = base.gameObject.GetComponent<SCollisionComponent>(); if (component != null) { return component.CreateShape(); } return VCollisionShape.createFromCollider(base.gameObject); }
// Use this for initialization void Start() { vCollider1 = VCollisionShape.createFromCollider(collider1.gameObject); vCollider2 = VCollisionShape.createFromCollider(collider2.gameObject); }