public static Vector3 GetFillerPosition(BAgentSpace space, SpaceFillInfo fillInfo, Vector3 contenstSize, int index) { Vector3Int matrixIndex = Vector3Int.one; matrixIndex.z = index / (fillInfo.division[0] * fillInfo.division[1]); matrixIndex.y = (index - matrixIndex.z) / fillInfo.division[0]; matrixIndex.x = index % fillInfo.division[0]; var positionIndex = (matrixIndex + Vector3.one * 0.5f); for (int i = 0; i < 3; i++) { positionIndex[i] = space.upperBoundary[i] - space.lowerBoundary[i] == 0 ? 0 : positionIndex[i]; } /*var result = space.origin.localToWorldMatrix * Vector3.Scale( * Vector3.Scale(space.lowerBoundary, Vector3.Scale(contenstSize, fillInfo.contentScaling * (Vector3.one - positionIndex)) ) + Vector3.Scale(space.upperBoundary, Vector3.Scale(contenstSize, fillInfo.contentScaling * positionIndex)) + , new Vector3(-1, 1, 1));*/ var result = space.origin.TransformPoint(Vector3.Scale( space.lowerBoundary + Vector3.Scale(contenstSize, fillInfo.contentScaling * positionIndex) , new Vector3(-1, 1, 1)) ); return(result); }
void SpaceInfoListener.OnSpaceUpdated(BAgentSpace spaceInfo) { givenSpace = spaceInfo; if (parent.parent.unityBehaverInternal.avatar != null) { var apInterface = parent.parent.unityBehaverInternal.avatar.Physicalize(spaceInfo); apInterface.Ensure(parent.bExpr.subject, new PrvtAgentTaker { parent = this }); } }
AvatarPhysicalizeInterface BehaverAvatar.Physicalize(BAgentSpace spaceInfo) { var apInterface = apInterfaces.Find((item) => item.spaceInfo == spaceInfo); if (apInterface == null) { apInterface = new StdAPInterface { spaceInfo = spaceInfo, agentFactory = agentFactory }; apInterfaces.Add(apInterface); } return(apInterface); }
AvatarPhysicalizeInterface BehaverAvatar.Physicalize(BAgentSpace spaceInfo) { var baseItfc = (hostBehaver as UnityBehaver).avatar.Physicalize(spaceInfo); var obtained = apInterfaces.Find((item) => item.baseItfc == baseItfc); if (obtained != null) { return(obtained); } obtained = new PrvtAPInterface { baseItfc = baseItfc, parent = this }; apInterfaces.Add(obtained); return(obtained); }
public static Vector3 LocalPosition(BAgentSpace space, BehaviorExpression bExpr) { if (bExpr.verb.modifier != null) { var at_where = GrammarBlockUtils.ShallowSeek(bExpr.verb.modifier, "at"); if (at_where != null) { if (at_where.modifier.unit != null) { var positionDesc = at_where.modifier.unit.word.Split('-'); if (positionDesc.Length == 2) { var posOffset = Vector3.zero; posOffset.z = 0.5f; if (positionDesc[0] == "lower") { posOffset.y = 0.25f; } else if (positionDesc[0] == "middle") { posOffset.y = 0.5f; } else if (positionDesc[0] == "upper") { posOffset.y = 0.75f; } if (positionDesc[1] == "left") { posOffset.x = 0.25f; } else if (positionDesc[1] == "center") { posOffset.x = 0.5f; } else if (positionDesc[1] == "right") { posOffset.x = 0.75f; } return(space.lowerBoundary + Vector3.Scale(space.upperBoundary - space.lowerBoundary, posOffset)); } } } } return(Vector3.zero); }
void SpaceInfoListener.OnSpaceUpdated(BAgentSpace spaceInfo) { currentSpace = spaceInfo; }
AvatarPhysicalizeInterface BehaverAvatar.Physicalize(BAgentSpace spaceInfo) { return(new StbAPInterface { }); }